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