Skip to content

Instantly share code, notes, and snippets.

View AungThiha's full-sized avatar

Aung Thiha AungThiha

View GitHub Profile
@AungThiha
AungThiha / HelloActivity.smali
Created February 5, 2025 17:26
Top-level Constants vs Companion-enclosed Constants in Kotlin [Step 2]
.class public final Lcom/example/myapplication/HelloActivity;
.super Landroidx/activity/ComponentActivity;
.source "HelloActivity.kt"
# annotations
.annotation runtime Lkotlin/Metadata;
d1 = {
"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0007\u00a2\u0006\u0004\u0008\u0002\u0010\u0003J\u0012\u0010\u0004\u001a\u00020\u00052\u0008\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0014\u00a8\u0006\u0008"
}
@AungThiha
AungThiha / MainActivity$Companion.smali
Created February 5, 2025 15:34
Top-level Constants vs Companion-enclosed Constants in Kotlin
.class public final Lcom/example/myapplication/MainActivity$Companion;
.super Ljava/lang/Object;
.source "MainActivity.kt"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/example/myapplication/MainActivity;
.end annotation
@AungThiha
AungThiha / ComposeUiTest.md
Last active December 9, 2023 08:13
Jetpack Compose: Assert Intent Data Consumption in Instrumented Tests

Gists for medium article titled Jetpack Compose: Assert Intent Data Consumption in Instrumented Tests

@AungThiha
AungThiha / RecipeDetail5.kt
Created September 16, 2023 10:14
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
...
val actionsProperties = motionProperties("actions")
Box(
modifier = Modifier
.background(actionsProperties.value.color("background"))
.layoutId("actionsTopBg")
)
Row(
@AungThiha
AungThiha / motion_scene5.json5
Last active September 16, 2023 10:07
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
{
ConstraintSets: {
start: {
...
actionsTopBg: {
width: 'spread',
height: 0,
start: ['parent', 'start', 16],
end: ['parent', 'end', 16],
top: ['date','bottom'],
@AungThiha
AungThiha / RecipeDetail4.kt
Created September 16, 2023 09:53
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
...
val actionsProperties = motionProperties("actions") // new code
Row(
modifier = Modifier
.background(actionsProperties.value.color("background")) // new code
.layoutId("actions")
...
@AungThiha
AungThiha / motion_scene4.json5
Created September 16, 2023 09:46
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
{
ConstraintSets: {
start: {
...
actions: {
...
top: ['date','bottom'],
custom: {
background: '#444444'
}
@AungThiha
AungThiha / RecipeDetai4.kt
Created September 15, 2023 17:51
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
...
Box(
modifier = Modifier
.anchoredDraggable(anchoredDraggableState, Orientation.Vertical)
.shadow(elevation = 4.dp, shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp))
.background(
Color.White,
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp)
)
.layoutId("contentBg")
@AungThiha
AungThiha / RecipeDetail3.kt
Last active September 15, 2023 17:50
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
...
val draggedDownAnchorTop = with(LocalDensity.current) { 200.dp.toPx() }
val anchors = DraggableAnchors {
AnchoredDraggableCardState.DRAGGED_DOWN at draggedDownAnchorTop
AnchoredDraggableCardState.DRAGGED_UP at 0f
}
val density = LocalDensity.current
val anchoredDraggableState = remember {
AnchoredDraggableState(
initialValue = AnchoredDraggableCardState.DRAGGED_DOWN,
@AungThiha
AungThiha / RecipeDetailLoadingMotionScene.kt
Created September 15, 2023 17:32
Used in article "Jetpack Compose Anchored Draggable Item in MotionLayout"
...
val context = LocalContext.current
val motionSceneContent = remember {
context.resources
.openRawResource(R.raw.motion_scene)
.readBytes()
.decodeToString()
}
MotionLayout(