0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-29 14:33:01 +00:00

T H I C C progressbar

This commit is contained in:
X1nto 2021-06-28 19:28:36 +04:00
parent aa3234a83c
commit 493b6d3963
2 changed files with 8 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package com.vanced.manager.ui.components.progressindicator
import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material.LinearProgressIndicator import androidx.compose.material.LinearProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.ProgressIndicatorDefaults import androidx.compose.material.ProgressIndicatorDefaults
@ -10,17 +11,19 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.composed import androidx.compose.ui.composed
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import com.vanced.manager.ui.components.color.managerAccentColor import com.vanced.manager.ui.components.color.managerAccentColor
private val progressBarModifier = Modifier.composed { private val progressBarModifier = Modifier.composed {
then( then(
height(5.dp)
).then(
fillMaxWidth() fillMaxWidth()
).then( ).then(
clip(MaterialTheme.shapes.medium) clip(MaterialTheme.shapes.medium)
) )
} }
@Composable @Composable
fun ManagerProgressIndicator() { fun ManagerProgressIndicator() {
LinearProgressIndicator( LinearProgressIndicator(

View file

@ -1,9 +1,11 @@
package com.vanced.manager.ui.widgets.home.download package com.vanced.manager.ui.widgets.home.download
import androidx.compose.animation.core.animateIntAsState
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import com.vanced.manager.R import com.vanced.manager.R
@ -20,6 +22,7 @@ fun AppDownloadDialogProgress(
true -> ManagerProgressIndicator() true -> ManagerProgressIndicator()
false -> ManagerProgressIndicator(progress = progress) false -> ManagerProgressIndicator(progress = progress)
} }
val animatedProgress by animateIntAsState(targetValue = progress.toInt())
Row { Row {
Text( Text(
modifier = Modifier modifier = Modifier
@ -34,7 +37,7 @@ fun AppDownloadDialogProgress(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.wrapContentWidth(Alignment.End), .wrapContentWidth(Alignment.End),
text = "%$progress" text = "%$animatedProgress"
) )
} }
} }