@@ -15,6 +15,7 @@ import androidx.compose.foundation.rememberScrollState
1515import androidx.compose.foundation.text.KeyboardActions
1616import androidx.compose.foundation.text.KeyboardOptions
1717import androidx.compose.foundation.verticalScroll
18+ import androidx.compose.material3.Checkbox
1819import androidx.compose.material3.ExperimentalMaterial3Api
1920import androidx.compose.material3.Icon
2021import androidx.compose.material3.IconButton
@@ -35,13 +36,17 @@ import androidx.compose.ui.Modifier
3536import androidx.compose.ui.focus.FocusRequester
3637import androidx.compose.ui.focus.focusRequester
3738import androidx.compose.ui.graphics.Color
39+ import androidx.compose.ui.platform.LocalContext
3840import androidx.compose.ui.text.input.ImeAction
3941import androidx.compose.ui.text.input.KeyboardType
4042import androidx.compose.ui.text.style.TextDecoration
4143import androidx.compose.ui.unit.dp
4244import androidx.compose.ui.window.Dialog
4345import androidx.compose.ui.window.DialogProperties
46+ import com.paulcoding.hviewer.MainActivity
47+ import com.paulcoding.hviewer.extensions.setSecureScreen
4448import com.paulcoding.hviewer.network.Github
49+ import com.paulcoding.hviewer.preference.Preferences
4550import com.paulcoding.hviewer.ui.component.HBackIcon
4651import com.paulcoding.hviewer.ui.icon.EditIcon
4752
@@ -51,6 +56,8 @@ fun SettingsPage(goBack: () -> Boolean) {
5156 val githubState by Github .stateFlow.collectAsState()
5257 val prevSiteConfigs = remember { githubState.siteConfigs }
5358 var modalVisible by remember { mutableStateOf(false ) }
59+ var secureScreen by remember { mutableStateOf(Preferences .secureScreen) }
60+ val window = (LocalContext .current as MainActivity ).window
5461
5562 LaunchedEffect (githubState.siteConfigs) {
5663 if (prevSiteConfigs == null && githubState.siteConfigs != null ) {
@@ -69,7 +76,8 @@ fun SettingsPage(goBack: () -> Boolean) {
6976 .padding(horizontal = 16 .dp)
7077 .verticalScroll(
7178 rememberScrollState()
72- )
79+ ),
80+ verticalArrangement = Arrangement .spacedBy(16 .dp)
7381 ) {
7482 Row (
7583 verticalAlignment = Alignment .CenterVertically ,
@@ -84,6 +92,18 @@ fun SettingsPage(goBack: () -> Boolean) {
8492 githubState.remoteUrl.ifEmpty { " https://github.com/{OWNER}/{REPO}/" },
8593 textDecoration = TextDecoration .Underline
8694 )
95+
96+ Row (
97+ verticalAlignment = Alignment .CenterVertically ,
98+ horizontalArrangement = Arrangement .spacedBy(8 .dp)
99+ ) {
100+ Text (" Enable secure screen" , modifier = Modifier .weight(1f ))
101+ Checkbox (checked = secureScreen, onCheckedChange = {
102+ secureScreen = it
103+ Preferences .secureScreen = it
104+ window.setSecureScreen(it)
105+ })
106+ }
87107 }
88108 }
89109
0 commit comments