Change a bit read button component UI
This commit is contained in:
@@ -1,43 +1,28 @@
|
||||
package org.xtimms.tokusho.core.components
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.core.Animatable
|
||||
import androidx.compose.animation.core.FloatTweenSpec
|
||||
import androidx.compose.animation.core.LinearEasing
|
||||
import androidx.compose.animation.core.TweenSpec
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.PathEffect
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.times
|
||||
import kotlinx.coroutines.launch
|
||||
import org.xtimms.tokusho.core.components.shape.WavyShape
|
||||
import org.xtimms.tokusho.utils.lang.clamp
|
||||
import org.xtimms.tokusho.utils.material.HarmonizedColorPalette
|
||||
import kotlin.math.ceil
|
||||
|
||||
@Composable
|
||||
fun BackgroundProgress(
|
||||
color: Color,
|
||||
) {
|
||||
|
||||
val percentWithNewSpent = 0.5f
|
||||
val percentWithNewSpent = 0.2f // TODO
|
||||
|
||||
val percentWithNewSpentAnimated = animateFloatAsState(
|
||||
label = "percentWithNewSpentAnimated",
|
||||
@@ -46,22 +31,6 @@ fun BackgroundProgress(
|
||||
).value
|
||||
|
||||
val shift = remember { Animatable(0f) }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
fun anim() {
|
||||
coroutineScope.launch {
|
||||
shift.animateTo(
|
||||
1f,
|
||||
animationSpec = FloatTweenSpec(4000, 0, LinearEasing)
|
||||
)
|
||||
shift.snapTo(0f)
|
||||
anim()
|
||||
}
|
||||
}
|
||||
|
||||
anim()
|
||||
}
|
||||
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
Box(
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.compose.animation.core.TweenSpec
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -113,7 +114,12 @@ fun RowScope.ReadButton() {
|
||||
horizontalArrangement = Arrangement.Start,
|
||||
) {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(text = "Continue reading", color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
Text(text = "Chap. 123 - Test", style = MaterialTheme.typography.labelMedium) // TODO
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user