Code review fixes:
Redundant Box in SkipButton
Unused string resources
remember { fadeIn() } pattern
This commit is contained in:
+7
-5
@@ -29,13 +29,15 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
private val FadeIn = fadeIn()
|
||||
private val FadeOut = fadeOut()
|
||||
|
||||
private val TopGradientColors =
|
||||
listOf(
|
||||
Color.Black.copy(alpha = 0.6f),
|
||||
@@ -59,8 +61,8 @@ fun TopGradientOverlay(
|
||||
AnimatedVisibility(
|
||||
visible = controllerVisible.value,
|
||||
modifier = modifier,
|
||||
enter = remember { fadeIn() },
|
||||
exit = remember { fadeOut() },
|
||||
enter = FadeIn,
|
||||
exit = FadeOut,
|
||||
) {
|
||||
Box(
|
||||
modifier =
|
||||
@@ -83,8 +85,8 @@ fun BottomGradientOverlay(
|
||||
AnimatedVisibility(
|
||||
visible = controllerVisible.value,
|
||||
modifier = modifier,
|
||||
enter = remember { fadeIn() },
|
||||
exit = remember { fadeOut() },
|
||||
enter = FadeIn,
|
||||
exit = FadeOut,
|
||||
) {
|
||||
Box(
|
||||
modifier =
|
||||
|
||||
+5
-2
@@ -55,6 +55,9 @@ import com.vitorpamplona.amethyst.ui.theme.Size50Modifier
|
||||
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
|
||||
import com.vitorpamplona.amethyst.ui.theme.VolumeBottomIconSize
|
||||
|
||||
private val FadeIn = fadeIn()
|
||||
private val FadeOut = fadeOut()
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun OverflowMenuButtonPreview() {
|
||||
@@ -86,8 +89,8 @@ fun AnimatedOverflowMenuButton(
|
||||
AnimatedVisibility(
|
||||
visible = controllerVisible.value,
|
||||
modifier = modifier,
|
||||
enter = remember { fadeIn() },
|
||||
exit = remember { fadeOut() },
|
||||
enter = FadeIn,
|
||||
exit = FadeOut,
|
||||
) {
|
||||
OverflowMenuButton(
|
||||
showShare = showShare,
|
||||
|
||||
+18
-22
@@ -33,8 +33,6 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
@@ -44,6 +42,9 @@ import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
||||
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
|
||||
|
||||
private val FadeIn = fadeIn()
|
||||
private val FadeOut = fadeOut()
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun SkipBackButtonPreview() {
|
||||
@@ -83,8 +84,8 @@ fun AnimatedSkipButton(
|
||||
AnimatedVisibility(
|
||||
visible = controllerVisible.value,
|
||||
modifier = modifier,
|
||||
enter = remember { fadeIn() },
|
||||
exit = remember { fadeOut() },
|
||||
enter = FadeIn,
|
||||
exit = FadeOut,
|
||||
) {
|
||||
SkipButton(
|
||||
isForward = isForward,
|
||||
@@ -100,25 +101,20 @@ fun SkipButton(
|
||||
skipSeconds: Int = 10,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
Box(
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.size(48.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.size(48.dp),
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isForward) Icons.Default.Forward10 else Icons.Default.Replay10,
|
||||
contentDescription =
|
||||
if (isForward) {
|
||||
stringRes(R.string.skip_forward, skipSeconds)
|
||||
} else {
|
||||
stringRes(R.string.skip_back, skipSeconds)
|
||||
},
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(32.dp),
|
||||
)
|
||||
}
|
||||
Icon(
|
||||
imageVector = if (isForward) Icons.Default.Forward10 else Icons.Default.Replay10,
|
||||
contentDescription =
|
||||
if (isForward) {
|
||||
stringRes(R.string.skip_forward, skipSeconds)
|
||||
} else {
|
||||
stringRes(R.string.skip_back, skipSeconds)
|
||||
},
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(32.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,8 +904,6 @@
|
||||
<string name="skip_back">Skip back %d seconds</string>
|
||||
<string name="skip_forward">Skip forward %d seconds</string>
|
||||
<string name="picture_in_picture">Picture-in-Picture</string>
|
||||
<string name="live">LIVE</string>
|
||||
<string name="tap_to_retry">Tap to retry</string>
|
||||
<string name="search_button">Search local and remote records</string>
|
||||
|
||||
<string name="nip05_verified">Nostr address was verified</string>
|
||||
@@ -1505,7 +1503,7 @@
|
||||
<string name="share_of">%1$d/%2$d</string>
|
||||
<string name="broadcasting">Broadcasting</string>
|
||||
<string name="broadcasting_name">Broadcasting %1$s</string>
|
||||
<string name="broadcasting_number_events">Broadcasting %1$d events...</string>
|
||||
<string name="broadcasting_number_events">Broadcasting %1$d events…</string>
|
||||
<string name="sent_number_events">%1$d events sent</string>
|
||||
|
||||
<string name="bradcasting_result_partial">Some events failed</string>
|
||||
|
||||
Reference in New Issue
Block a user