mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-16 20:00:40 +01:00
Fix SleepTimer visibility on main screen
This commit is contained in:
parent
cd02f52d12
commit
87e92df993
@ -58,7 +58,7 @@ class MainActivity : SimpleActivity() {
|
||||
setContent {
|
||||
AppThemeSurface {
|
||||
val showMoreApps = onEventValue { !resources.getBoolean(R.bool.hide_google_relations) }
|
||||
val timerVisible by viewModel.timerVisible.collectAsStateWithLifecycle(false)
|
||||
val timerVisible by viewModel.timerVisible.collectAsStateWithLifecycle()
|
||||
val timerText by viewModel.timerText.collectAsStateWithLifecycle()
|
||||
val flashlightActive by viewModel.flashlightOn.collectAsStateWithLifecycle()
|
||||
val showBrightDisplayButton by preferences.brightDisplayFlow.collectAsStateWithLifecycle(
|
||||
|
@ -28,7 +28,7 @@ import com.simplemobiletools.flashlight.views.SleepTimer
|
||||
@Composable
|
||||
internal fun BrightDisplayScreen(
|
||||
backgroundColor: Int,
|
||||
timerText: String?,
|
||||
timerText: String,
|
||||
timerVisible: Boolean,
|
||||
onChangeColorPress: () -> Unit,
|
||||
onTimerClosePress: () -> Unit
|
||||
@ -59,7 +59,7 @@ internal fun BrightDisplayScreen(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.navigationBarsPadding(),
|
||||
visible = timerVisible,
|
||||
visible = timerVisible && timerText.isNotEmpty(),
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut()
|
||||
) {
|
||||
|
@ -3,7 +3,6 @@ package com.simplemobiletools.flashlight.screens
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.*
|
||||
@ -37,7 +36,7 @@ import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
@Composable
|
||||
internal fun MainScreen(
|
||||
timerText: String?,
|
||||
timerText: String,
|
||||
timerVisible: Boolean,
|
||||
onTimerClosePress: () -> Unit,
|
||||
flashlightActive: Boolean,
|
||||
@ -200,12 +199,12 @@ internal fun MainScreen(
|
||||
|
||||
AnimatedVisibility(
|
||||
modifier = Modifier.align(Alignment.BottomEnd),
|
||||
visible = timerVisible,
|
||||
visible = timerVisible && timerText.isNotEmpty(),
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut(),
|
||||
) {
|
||||
SleepTimer(
|
||||
timerText = timerText ?: "",
|
||||
timerText = timerText,
|
||||
onCloseClick = onTimerClosePress
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user