Use new compat helpers for window flags

This commit is contained in:
Ensar Sarajčić 2023-10-16 09:54:04 +02:00
parent c546aab7f1
commit afe23bfb2e
3 changed files with 6 additions and 15 deletions

View File

@ -17,11 +17,12 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewModelScope
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
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.dialogs.ColorPickerAlertDialog
import com.simplemobiletools.commons.extensions.getContrastColor
import com.simplemobiletools.commons.extensions.getFormattedDuration
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.helpers.SleepTimer
import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown
@ -38,18 +39,8 @@ class BrightDisplayActivity : ComponentActivity() {
private val preferences by lazy { config }
override fun onCreate(savedInstanceState: Bundle?) {
if (isOreoMr1Plus()) {
setShowWhenLocked(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
)
}
setShowWhenLockedCompat(true)
setTurnScreenOnCompat(true)
super.onCreate(savedInstanceState)
enableEdgeToEdgeSimple()
setContent {

View File

@ -12,11 +12,11 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.simplemobiletools.commons.R
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.extensions.MyDevices
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.compose.theme.SimpleTheme
import com.simplemobiletools.commons.dialogs.DialogSurface
import kotlinx.collections.immutable.toImmutableList
@Composable

View File

@ -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 = "d91dbb64bd"
simple-commons = "7076fbaf6e"
#Compose
composeActivity = "1.8.0"
compose = "1.6.0-alpha07"