Use new compat helpers for window flags
This commit is contained in:
parent
c546aab7f1
commit
afe23bfb2e
|
@ -17,11 +17,12 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
||||||
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
|
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
|
||||||
|
import com.simplemobiletools.commons.compose.extensions.setShowWhenLockedCompat
|
||||||
|
import com.simplemobiletools.commons.compose.extensions.setTurnScreenOnCompat
|
||||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
import com.simplemobiletools.commons.dialogs.ColorPickerAlertDialog
|
import com.simplemobiletools.commons.dialogs.ColorPickerAlertDialog
|
||||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
import com.simplemobiletools.commons.extensions.getContrastColor
|
||||||
import com.simplemobiletools.commons.extensions.getFormattedDuration
|
import com.simplemobiletools.commons.extensions.getFormattedDuration
|
||||||
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
|
|
||||||
import com.simplemobiletools.flashlight.extensions.config
|
import com.simplemobiletools.flashlight.extensions.config
|
||||||
import com.simplemobiletools.flashlight.helpers.SleepTimer
|
import com.simplemobiletools.flashlight.helpers.SleepTimer
|
||||||
import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown
|
import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown
|
||||||
|
@ -38,18 +39,8 @@ class BrightDisplayActivity : ComponentActivity() {
|
||||||
private val preferences by lazy { config }
|
private val preferences by lazy { config }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
if (isOreoMr1Plus()) {
|
setShowWhenLockedCompat(true)
|
||||||
setShowWhenLocked(true)
|
setTurnScreenOnCompat(true)
|
||||||
setTurnScreenOn(true)
|
|
||||||
} else {
|
|
||||||
window.addFlags(
|
|
||||||
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
|
||||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
|
||||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
|
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdgeSimple()
|
enableEdgeToEdgeSimple()
|
||||||
setContent {
|
setContent {
|
||||||
|
|
|
@ -12,11 +12,11 @@ import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.simplemobiletools.commons.R
|
import com.simplemobiletools.commons.R
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
|
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
|
||||||
|
import com.simplemobiletools.commons.compose.alert_dialog.DialogSurface
|
||||||
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
||||||
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
||||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
import com.simplemobiletools.commons.dialogs.DialogSurface
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -6,7 +6,7 @@ androidx-customView = "1.2.0-alpha02"
|
||||||
androidx-customViewPooling = "1.0.0"
|
androidx-customViewPooling = "1.0.0"
|
||||||
androidx-lifecycle = "2.7.0-alpha02"
|
androidx-lifecycle = "2.7.0-alpha02"
|
||||||
#Simple tools
|
#Simple tools
|
||||||
simple-commons = "d91dbb64bd"
|
simple-commons = "7076fbaf6e"
|
||||||
#Compose
|
#Compose
|
||||||
composeActivity = "1.8.0"
|
composeActivity = "1.8.0"
|
||||||
compose = "1.6.0-alpha07"
|
compose = "1.6.0-alpha07"
|
||||||
|
|
Loading…
Reference in New Issue