Update commons to remove the need for `minActiveState`
This commit is contained in:
parent
afe23bfb2e
commit
c755c67011
|
@ -87,10 +87,7 @@ class MainActivity : ComponentActivity() {
|
|||
)
|
||||
},
|
||||
brightDisplayButton = {
|
||||
val showBrightDisplayButton by preferences.brightDisplayFlow.collectAsStateWithLifecycle(
|
||||
config.brightDisplay,
|
||||
minActiveState = Lifecycle.State.CREATED
|
||||
)
|
||||
val showBrightDisplayButton by preferences.brightDisplayFlow.collectAsStateWithLifecycle(config.brightDisplay)
|
||||
if (showBrightDisplayButton) {
|
||||
BrightDisplayButton(
|
||||
onBrightDisplayPress = {
|
||||
|
@ -100,7 +97,7 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
},
|
||||
sosButton = {
|
||||
val showSosButton by preferences.sosFlow.collectAsStateWithLifecycle(config.sos, minActiveState = Lifecycle.State.CREATED)
|
||||
val showSosButton by preferences.sosFlow.collectAsStateWithLifecycle(config.sos)
|
||||
val sosActive by viewModel.sosActive.collectAsStateWithLifecycle()
|
||||
|
||||
if (showSosButton) {
|
||||
|
@ -113,10 +110,7 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
},
|
||||
stroboscopeButton = {
|
||||
val showStroboscopeButton by preferences.stroboscopeFlow.collectAsStateWithLifecycle(
|
||||
config.stroboscope,
|
||||
minActiveState = Lifecycle.State.CREATED
|
||||
)
|
||||
val showStroboscopeButton by preferences.stroboscopeFlow.collectAsStateWithLifecycle(config.stroboscope)
|
||||
val stroboscopeActive by viewModel.stroboscopeActive.collectAsStateWithLifecycle()
|
||||
|
||||
if (showStroboscopeButton) {
|
||||
|
|
|
@ -13,19 +13,19 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getBoolean(BRIGHT_DISPLAY, true)
|
||||
set(brightDisplay) = prefs.edit().putBoolean(BRIGHT_DISPLAY, brightDisplay).apply()
|
||||
|
||||
val brightDisplayFlow = ::brightDisplay.asFlowNonNull()
|
||||
val brightDisplayFlow = ::brightDisplay.asFlowNonNull(emitOnCollect = true)
|
||||
|
||||
var stroboscope: Boolean
|
||||
get() = prefs.getBoolean(STROBOSCOPE, true)
|
||||
set(stroboscope) = prefs.edit().putBoolean(STROBOSCOPE, stroboscope).apply()
|
||||
|
||||
val stroboscopeFlow = ::stroboscope.asFlowNonNull()
|
||||
val stroboscopeFlow = ::stroboscope.asFlowNonNull(emitOnCollect = true)
|
||||
|
||||
var sos: Boolean
|
||||
get() = prefs.getBoolean(SOS, true)
|
||||
set(sos) = prefs.edit().putBoolean(SOS, sos).apply()
|
||||
|
||||
val sosFlow = ::sos.asFlowNonNull()
|
||||
val sosFlow = ::sos.asFlowNonNull(emitOnCollect = true)
|
||||
|
||||
var turnFlashlightOn: Boolean
|
||||
get() = prefs.getBoolean(TURN_FLASHLIGHT_ON, false)
|
||||
|
|
|
@ -6,7 +6,7 @@ androidx-customView = "1.2.0-alpha02"
|
|||
androidx-customViewPooling = "1.0.0"
|
||||
androidx-lifecycle = "2.7.0-alpha02"
|
||||
#Simple tools
|
||||
simple-commons = "7076fbaf6e"
|
||||
simple-commons = "fd497d3719"
|
||||
#Compose
|
||||
composeActivity = "1.8.0"
|
||||
compose = "1.6.0-alpha07"
|
||||
|
|
Loading…
Reference in New Issue