Change a bit read button component UI

master
Zakhar Timoshenko 2 years ago
parent 57e490fe28
commit ac9626616d
Signed by: Xtimms
SSH Key Fingerprint: SHA256:wH6spYepK/A5erBh7ZyAnr1ru9H4eaMVBEuiw6DSpxI

@ -1,43 +1,28 @@
package org.xtimms.tokusho.core.components package org.xtimms.tokusho.core.components
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.Animatable 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.TweenSpec
import androidx.compose.animation.core.animateFloatAsState 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.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color 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.dp
import androidx.compose.ui.unit.times import androidx.compose.ui.unit.times
import kotlinx.coroutines.launch
import org.xtimms.tokusho.core.components.shape.WavyShape import org.xtimms.tokusho.core.components.shape.WavyShape
import org.xtimms.tokusho.utils.lang.clamp import org.xtimms.tokusho.utils.lang.clamp
import org.xtimms.tokusho.utils.material.HarmonizedColorPalette
import kotlin.math.ceil
@Composable @Composable
fun BackgroundProgress( fun BackgroundProgress(
color: Color, color: Color,
) { ) {
val percentWithNewSpent = 0.5f val percentWithNewSpent = 0.2f // TODO
val percentWithNewSpentAnimated = animateFloatAsState( val percentWithNewSpentAnimated = animateFloatAsState(
label = "percentWithNewSpentAnimated", label = "percentWithNewSpentAnimated",
@ -46,22 +31,6 @@ fun BackgroundProgress(
).value ).value
val shift = remember { Animatable(0f) } 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(Modifier.fillMaxSize()) {
Box( Box(

@ -8,6 +8,7 @@ import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
@ -113,7 +114,12 @@ fun RowScope.ReadButton() {
horizontalArrangement = Arrangement.Start, horizontalArrangement = Arrangement.Start,
) { ) {
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
Column(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Continue reading", color = MaterialTheme.colorScheme.onPrimaryContainer) Text(text = "Continue reading", color = MaterialTheme.colorScheme.onPrimaryContainer)
Text(text = "Chap. 123 - Test", style = MaterialTheme.typography.labelMedium) // TODO
}
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
} }
} }

Loading…
Cancel
Save