@@ -46,10 +46,9 @@ import androidx.compose.ui.Alignment
4646import androidx.compose.ui.Modifier
4747import androidx.compose.ui.draw.clip
4848import androidx.compose.ui.graphics.vector.ImageVector
49- import androidx.compose.ui.platform.LocalContext
5049import androidx.compose.ui.res.stringResource
5150import androidx.compose.ui.unit.dp
52- import androidx.hilt.navigation .compose.hiltViewModel
51+ import androidx.hilt.lifecycle.viewmodel .compose.hiltViewModel
5352import androidx.lifecycle.Lifecycle
5453import androidx.lifecycle.compose.LifecycleEventEffect
5554import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -98,7 +97,11 @@ private fun SettingsContent(
9897 onNavigateToAbout : () -> Unit ,
9998 viewModel : SettingsViewModel ,
10099) {
101- val context = LocalContext .current
100+ val screenDescription = stringResource(R .string.screen_description)
101+ val shizukuSoftScreenOffExplanation =
102+ stringResource(R .string.shizuku_feature_soft_screen_off)
103+ val shizukuWifiExplanation = stringResource(R .string.shizuku_feature_wifi)
104+ val shizukuBluetoothExplanation = stringResource(R .string.shizuku_feature_bluetooth)
102105
103106 val deviceAdminLauncher = rememberLauncherForActivityResult(
104107 ActivityResultContracts .StartActivityForResult (),
@@ -148,14 +151,14 @@ private fun SettingsContent(
148151 )
149152 putExtra(
150153 DevicePolicyManager .EXTRA_ADD_EXPLANATION ,
151- context.getString( R .string.screen_description) ,
154+ screenDescription ,
152155 )
153156 }
154157 deviceAdminLauncher.launch(intent)
155158 }
156159 },
157160 onSoftLockSelected = {
158- requestWithShizuku(context.getString( R .string.shizuku_feature_soft_screen_off) ) {
161+ requestWithShizuku(shizukuSoftScreenOffExplanation ) {
159162 viewModel.updateScreenOff(true )
160163 viewModel.updateSoftScreenOff(true )
161164 }
@@ -266,7 +269,7 @@ private fun SettingsContent(
266269 checked = uiState.settings.turnOffWifi,
267270 onCheckedChange = { enabled ->
268271 if (enabled) {
269- requestWithShizuku(context.getString( R .string.shizuku_feature_wifi) ) {
272+ requestWithShizuku(shizukuWifiExplanation ) {
270273 viewModel.updateTurnOffWifi(true )
271274 }
272275 } else {
@@ -282,7 +285,7 @@ private fun SettingsContent(
282285 checked = uiState.settings.turnOffBluetooth,
283286 onCheckedChange = { enabled ->
284287 if (enabled) {
285- requestWithShizuku(context.getString( R .string.shizuku_feature_bluetooth) ) {
288+ requestWithShizuku(shizukuBluetoothExplanation ) {
286289 viewModel.updateTurnOffBluetooth(true )
287290 }
288291 } else {
0 commit comments