Add filters

This commit is contained in:
Vineyro 2023-06-29 09:10:30 +07:00
parent 1270f48422
commit 7afa2861e7
1 changed files with 15 additions and 17 deletions

View File

@ -199,28 +199,27 @@ private fun BleItem(
val highAlpha = ContentAlpha.high val highAlpha = ContentAlpha.high
val disabledAlpha = ContentAlpha.disabled val disabledAlpha = ContentAlpha.disabled
var alpha by remember {
mutableStateOf( var time by remember {
if(SystemClock.elapsedRealtime() - ble.scanTime > 10_000){ mutableLongStateOf(
disabledAlpha SystemClock.elapsedRealtime()
} else {
highAlpha
}
) )
} }
LaunchedEffect(ble.scanTime) { LaunchedEffect(ble.scanTime) {
while(true) { while(true) {
alpha = if(SystemClock.elapsedRealtime() - ble.scanTime > 10_000){ time = SystemClock.elapsedRealtime()
disabledAlpha delay(100)
} else {
highAlpha
}
delay(800)
} }
} }
var alpha = if(SystemClock.elapsedRealtime() - ble.scanTime > 10_000){
disabledAlpha
} else {
highAlpha
}
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp),
@ -338,8 +337,7 @@ private fun BleItem(
Icon( Icon(
modifier = Modifier.size(16.dp), modifier = Modifier.size(16.dp),
imageVector = Icons.Rounded.ArrowRightAlt, imageVector = Icons.Rounded.ArrowRightAlt,
contentDescription = null, contentDescription = null
tint = color
) )
Box { Box {
@ -356,7 +354,7 @@ private fun BleItem(
modifier = Modifier.alpha(0f) modifier = Modifier.alpha(0f)
) )
val lastAdv = ((SystemClock.elapsedRealtime() - ble.scanTime) / 1_000) val lastAdv = ((time - ble.scanTime) / 1_000)
Text( Text(
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,