Skip to content

Commit afe23bf

Browse files
committed
Use new compat helpers for window flags
1 parent c546aab commit afe23bf

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/BrightDisplayActivity.kt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
1717
import androidx.lifecycle.viewModelScope
1818
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
1919
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
20+
import com.simplemobiletools.commons.compose.extensions.setShowWhenLockedCompat
21+
import com.simplemobiletools.commons.compose.extensions.setTurnScreenOnCompat
2022
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
2123
import com.simplemobiletools.commons.dialogs.ColorPickerAlertDialog
2224
import com.simplemobiletools.commons.extensions.getContrastColor
2325
import com.simplemobiletools.commons.extensions.getFormattedDuration
24-
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
2526
import com.simplemobiletools.flashlight.extensions.config
2627
import com.simplemobiletools.flashlight.helpers.SleepTimer
2728
import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown
@@ -38,18 +39,8 @@ class BrightDisplayActivity : ComponentActivity() {
3839
private val preferences by lazy { config }
3940

4041
override fun onCreate(savedInstanceState: Bundle?) {
41-
if (isOreoMr1Plus()) {
42-
setShowWhenLocked(true)
43-
setTurnScreenOn(true)
44-
} else {
45-
window.addFlags(
46-
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
47-
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
48-
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
49-
WindowManager.LayoutParams.FLAG_FULLSCREEN
50-
)
51-
}
52-
42+
setShowWhenLockedCompat(true)
43+
setTurnScreenOnCompat(true)
5344
super.onCreate(savedInstanceState)
5445
enableEdgeToEdgeSimple()
5546
setContent {

app/src/main/kotlin/com/simplemobiletools/flashlight/dialogs/SleepTimerCustomAlertDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import androidx.compose.ui.text.input.KeyboardType
1212
import androidx.compose.ui.unit.dp
1313
import com.simplemobiletools.commons.R
1414
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
15+
import com.simplemobiletools.commons.compose.alert_dialog.DialogSurface
1516
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
1617
import com.simplemobiletools.commons.compose.extensions.MyDevices
1718
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
1819
import com.simplemobiletools.commons.compose.theme.SimpleTheme
19-
import com.simplemobiletools.commons.dialogs.DialogSurface
2020
import kotlinx.collections.immutable.toImmutableList
2121

2222
@Composable

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ androidx-customView = "1.2.0-alpha02"
66
androidx-customViewPooling = "1.0.0"
77
androidx-lifecycle = "2.7.0-alpha02"
88
#Simple tools
9-
simple-commons = "d91dbb64bd"
9+
simple-commons = "7076fbaf6e"
1010
#Compose
1111
composeActivity = "1.8.0"
1212
compose = "1.6.0-alpha07"

0 commit comments

Comments
 (0)