Skip to content

Commit 780be1f

Browse files
committed
feat: ux improvements to the group config dialogs
1 parent 4f06d1f commit 780be1f

6 files changed

Lines changed: 295 additions & 235 deletions

File tree

app/src/main/java/me/ash/reader/ui/interaction/Clickable.kt

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import androidx.compose.animation.core.animateFloatAsState
44
import androidx.compose.foundation.clickable
55
import androidx.compose.foundation.interaction.MutableInteractionSource
66
import androidx.compose.foundation.interaction.collectIsPressedAsState
7+
import androidx.compose.foundation.selection.selectable
8+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
9+
import androidx.compose.material3.MaterialTheme
710
import androidx.compose.runtime.Composable
811
import androidx.compose.runtime.getValue
912
import androidx.compose.runtime.remember
1013
import androidx.compose.ui.Modifier
1114
import androidx.compose.ui.draw.alpha
1215
import androidx.compose.ui.semantics.Role
1316

17+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
1418
@Composable
1519
fun Modifier.alphaIndicationClickable(
1620
enabled: Boolean = true,
@@ -21,7 +25,11 @@ fun Modifier.alphaIndicationClickable(
2125
): Modifier {
2226
val interactionSource = interactionSource ?: remember { MutableInteractionSource() }
2327
val isPressed by interactionSource.collectIsPressedAsState()
24-
val animatedAlpha by animateFloatAsState(if (isPressed) .5f else 1f)
28+
val animatedAlpha by
29+
animateFloatAsState(
30+
if (isPressed) .5f else 1f,
31+
animationSpec = MaterialTheme.motionScheme.fastEffectsSpec(),
32+
)
2533

2634
return clickable(
2735
enabled = enabled,
@@ -33,3 +41,31 @@ fun Modifier.alphaIndicationClickable(
3341
)
3442
.alpha(animatedAlpha)
3543
}
44+
45+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
46+
@Composable
47+
fun Modifier.alphaIndicationSelectable(
48+
selected: Boolean,
49+
enabled: Boolean = true,
50+
role: Role? = null,
51+
interactionSource: MutableInteractionSource? = null,
52+
onClick: () -> Unit,
53+
): Modifier {
54+
val interactionSource = interactionSource ?: remember { MutableInteractionSource() }
55+
val isPressed by interactionSource.collectIsPressedAsState()
56+
val animatedAlpha by
57+
animateFloatAsState(
58+
if (isPressed) .5f else 1f,
59+
animationSpec = MaterialTheme.motionScheme.fastEffectsSpec(),
60+
)
61+
62+
return selectable(
63+
selected = selected,
64+
enabled = enabled,
65+
role = role,
66+
indication = null,
67+
interactionSource = interactionSource,
68+
onClick = onClick,
69+
)
70+
.alpha(animatedAlpha)
71+
}

app/src/main/java/me/ash/reader/ui/page/home/feeds/drawer/group/AllAllowNotificationDialog.kt

Lines changed: 0 additions & 78 deletions
This file was deleted.

app/src/main/java/me/ash/reader/ui/page/home/feeds/drawer/group/AllOpenInBrowserDialog.kt

Lines changed: 0 additions & 78 deletions
This file was deleted.

app/src/main/java/me/ash/reader/ui/page/home/feeds/drawer/group/AllParseFullContentDialog.kt

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)