This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun PinnableItemSample(modifier: Modifier = Modifier) { | |
LazyColumn( | |
modifier = modifier | |
.background(color = Color.LightGray) | |
) { | |
items(5, key = { it + 1 }) { | |
ListItem( | |
modifier = Modifier.fillMaxWidth().padding(all = 16.dp), | |
item = it + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box( | |
modifier = Modifier | |
.offset { | |
// [1] | |
IntOffset( | |
x = (roll * 0.9).dp.roundToPx(), | |
y = -(pitch * 0.9).dp.roundToPx() | |
) | |
} | |
// [2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ParallaxScreen(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val scope = rememberCoroutineScope() | |
var data by remember { mutableStateOf<SensorData?>(null) } | |
DisposableEffect(Unit) { | |
val dataManager = SensorDataManager(context) | |
dataManager.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Reference link: https://developer.here.com/documentation/identity-access-management/dev_guide/topics/sdk.html | |
*/ | |
class OAuthInterceptor : Interceptor { | |
override fun intercept(chain: Interceptor.Chain): Response { | |
val timeStampInMillis = System.currentTimeMillis() | |
val request = chain.request() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a sample note since first file isn't being recognised in Medium. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DragDropList( | |
items: List<ReorderItem>, | |
onMove: (Int, Int) -> Unit, | |
modifier: Modifier = Modifier | |
) { | |
val scope = rememberCoroutineScope() | |
var overscrollJob by remember { mutableStateOf<Job?>(null) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun checkForOverScroll(): Float { | |
return initiallyDraggedElement?.let { | |
val startOffset = it.offset + draggedDistance | |
val endOffset = it.offsetEnd + draggedDistance | |
val viewPortStart = lazyListState.layoutInfo.viewportStartOffset | |
val viewPortEnd = lazyListState.layoutInfo.viewportEndOffset | |
when { | |
draggedDistance > 0 -> (endOffset - viewPortEnd).takeIf { diff -> diff > 0 } | |
draggedDistance < 0 -> (startOffset - viewPortStart).takeIf { diff -> diff < 0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: ( | |
function (){ | |
var e = document.createElement('input'); | |
let ts = document.getElementsByClassName('time-first')[0].innerHTML; | |
let parts = ts.split(':'); | |
var inSeconds = 0; | |
if (parts.length == 3) { | |
inSeconds = (+parts[0]) * 3600 + (+parts[1]) * 60 + (+parts[2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# public/index.html | |
# | |
# <!DOCTYPE html> | |
# <html> | |
# <head> | |
# <title>URL Schemes</title> | |
# <meta charset="UTF-8"> | |
# <meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@file:DependsOn("io.javalin:javalin:3.13.6") | |
import io.javalin.* | |
val html="""<html> | |
<body> | |
<h1><a href="https://www.google.com">Google (External)</a></h1> | |
<h1><a href="twitter://user?screen_name=monsterhunter">Monster Hunter (Twitter)</a></h1> | |
</body> | |
</html>""" |
NewerOlder