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
org.gradle.jvmargs=-Xmx4g | |
org.gradle.caching=true | |
org.gradle.configuration-cache=true | |
org.gradle.parallel=true |
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
on: | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
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 MaxSizeBox( | |
modifier: Modifier = Modifier, | |
contentAlignment: Alignment = Alignment.TopStart, | |
content: @Composable BoxScope.() -> Unit | |
) { | |
Box( | |
modifier = modifier.fillMaxSize(), | |
contentAlignment = contentAlignment, | |
) { |
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 Screen() { | |
MaxSizeBox { | |
.. | |
} | |
} |
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 Screen() { | |
var pressedLocation by rememberState { null } | |
MaxSizeBox( | |
modifier = Modifier.onPress { pressedLocation = it } | |
) { | |
.. | |
} | |
} |
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
/** | |
* Intercept [MotionEvent.ACTION_DOWN] events. | |
*/ | |
fun Modifier.onPress(pressHandler: (offset: Offset) -> Unit): Modifier { | |
return this.pointerInteropFilter { event -> | |
when (event.action) { | |
MotionEvent.ACTION_DOWN -> pressHandler(Offset(event.x, event.y)) | |
else -> return@pointerInteropFilter false | |
} | |
true |
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 Screen( | |
onDismiss: () -> Unit | |
) { | |
Topbar( | |
onDismiss = onDismiss, | |
modifier = Modifier.consumeTaps() | |
) | |
.. | |
} |
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 Modifier.consumeTaps(): Modifier = composed { | |
clickable( | |
indication = null, | |
interactionSource = remember { MutableInteractionSource() } | |
) {} | |
} |
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
inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier = composed { | |
clickable( | |
indication = null, | |
interactionSource = remember { MutableInteractionSource() } | |
) { | |
onClick() | |
} | |
} |
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 ClickableText( | |
text: String, | |
onClick: () -> Unit | |
) { | |
Text( | |
text = text, | |
modifier = Modifier.clickable(onClick) | |
) | |
} |
NewerOlder