mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
use state to control RadioButtonItem and CheckBoxItem
This commit is contained in:
@@ -337,7 +337,7 @@ private fun Keyguard() {
|
||||
if(VERSION.SDK_INT >= 26) {
|
||||
CheckBoxItem(
|
||||
stringResource(R.string.require_enter_password_again),
|
||||
{ flag==FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY },
|
||||
flag == FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY,
|
||||
{ flag = if(flag==0) {1}else{0} }
|
||||
)
|
||||
}
|
||||
@@ -505,9 +505,9 @@ private fun PermissionPolicy() {
|
||||
Spacer(Modifier.padding(vertical = 10.dp))
|
||||
Text(text = stringResource(R.string.permission_policy), style = typography.headlineLarge)
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
RadioButtonItem(stringResource(R.string.default_stringres), { selectedPolicy==PERMISSION_POLICY_PROMPT }, { selectedPolicy= PERMISSION_POLICY_PROMPT })
|
||||
RadioButtonItem(stringResource(R.string.auto_grant), { selectedPolicy==PERMISSION_POLICY_AUTO_GRANT }, { selectedPolicy= PERMISSION_POLICY_AUTO_GRANT })
|
||||
RadioButtonItem(stringResource(R.string.auto_deny), { selectedPolicy==PERMISSION_POLICY_AUTO_DENY }, { selectedPolicy= PERMISSION_POLICY_AUTO_DENY })
|
||||
RadioButtonItem(stringResource(R.string.default_stringres), selectedPolicy == PERMISSION_POLICY_PROMPT, { selectedPolicy = PERMISSION_POLICY_PROMPT })
|
||||
RadioButtonItem(stringResource(R.string.auto_grant), selectedPolicy == PERMISSION_POLICY_AUTO_GRANT, { selectedPolicy = PERMISSION_POLICY_AUTO_GRANT })
|
||||
RadioButtonItem(stringResource(R.string.auto_deny), selectedPolicy == PERMISSION_POLICY_AUTO_DENY, { selectedPolicy = PERMISSION_POLICY_AUTO_DENY })
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
Button(
|
||||
onClick = {
|
||||
@@ -533,17 +533,17 @@ private fun MTEPolicy() {
|
||||
var selectedMtePolicy by remember { mutableIntStateOf(dpm.mtePolicy) }
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.decide_by_user),
|
||||
{ selectedMtePolicy == MTE_NOT_CONTROLLED_BY_POLICY },
|
||||
selectedMtePolicy == MTE_NOT_CONTROLLED_BY_POLICY,
|
||||
{ selectedMtePolicy = MTE_NOT_CONTROLLED_BY_POLICY }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.enabled),
|
||||
{ selectedMtePolicy == MTE_ENABLED },
|
||||
selectedMtePolicy == MTE_ENABLED,
|
||||
{ selectedMtePolicy = MTE_ENABLED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.disabled),
|
||||
{ selectedMtePolicy == MTE_DISABLED },
|
||||
selectedMtePolicy == MTE_DISABLED,
|
||||
{ selectedMtePolicy = MTE_DISABLED }
|
||||
)
|
||||
Button(
|
||||
@@ -578,22 +578,22 @@ private fun NearbyStreamingPolicy() {
|
||||
Spacer(Modifier.padding(vertical = 3.dp))
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.decide_by_user),
|
||||
{ appPolicy == NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY },
|
||||
appPolicy == NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY,
|
||||
{ appPolicy = NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.enabled),
|
||||
{ appPolicy == NEARBY_STREAMING_ENABLED },
|
||||
appPolicy == NEARBY_STREAMING_ENABLED,
|
||||
{ appPolicy = NEARBY_STREAMING_ENABLED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.disabled),
|
||||
{ appPolicy == NEARBY_STREAMING_DISABLED },
|
||||
appPolicy == NEARBY_STREAMING_DISABLED,
|
||||
{ appPolicy = NEARBY_STREAMING_DISABLED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.enable_if_secure_enough),
|
||||
{ appPolicy == NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY },
|
||||
appPolicy == NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY,
|
||||
{ appPolicy = NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY }
|
||||
)
|
||||
Spacer(Modifier.padding(vertical = 3.dp))
|
||||
@@ -612,22 +612,22 @@ private fun NearbyStreamingPolicy() {
|
||||
Spacer(Modifier.padding(vertical = 3.dp))
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.decide_by_user),
|
||||
{ notificationPolicy == NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY },
|
||||
notificationPolicy == NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY,
|
||||
{ notificationPolicy = NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.enabled),
|
||||
{ notificationPolicy == NEARBY_STREAMING_ENABLED },
|
||||
notificationPolicy == NEARBY_STREAMING_ENABLED,
|
||||
{ notificationPolicy = NEARBY_STREAMING_ENABLED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.disabled),
|
||||
{ notificationPolicy == NEARBY_STREAMING_DISABLED },
|
||||
notificationPolicy == NEARBY_STREAMING_DISABLED,
|
||||
{ notificationPolicy = NEARBY_STREAMING_DISABLED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.enable_if_secure_enough),
|
||||
{ notificationPolicy == NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY },
|
||||
notificationPolicy == NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY,
|
||||
{ notificationPolicy = NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY }
|
||||
)
|
||||
Spacer(Modifier.padding(vertical = 3.dp))
|
||||
@@ -689,17 +689,17 @@ private fun LockTaskFeatures() {
|
||||
Text(text = stringResource(R.string.lock_task_feature), style = typography.headlineLarge)
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
if(!inited) { refreshFeature(); custom=dpm.getLockTaskFeatures(receiver)!=0; inited= true }
|
||||
RadioButtonItem(stringResource(R.string.disable_all), { !custom }, { custom=false })
|
||||
RadioButtonItem(stringResource(R.string.custom), { custom }, { custom= true })
|
||||
RadioButtonItem(stringResource(R.string.disable_all), !custom, { custom = false })
|
||||
RadioButtonItem(stringResource(R.string.custom), custom, { custom = true })
|
||||
AnimatedVisibility(custom) {
|
||||
Column {
|
||||
CheckBoxItem(stringResource(R.string.ltf_sys_info), { sysInfo }, { sysInfo = !sysInfo })
|
||||
CheckBoxItem(stringResource(R.string.ltf_notifications), { notifications }, { notifications = !notifications })
|
||||
CheckBoxItem(stringResource(R.string.ltf_home), { home }, { home = !home })
|
||||
CheckBoxItem(stringResource(R.string.ltf_overview), { overview }, { overview = !overview })
|
||||
CheckBoxItem(stringResource(R.string.ltf_global_actions), { globalAction}, {globalAction = !globalAction})
|
||||
CheckBoxItem(stringResource(R.string.ltf_keyguard), { keyGuard }, { keyGuard = !keyGuard })
|
||||
if(VERSION.SDK_INT >= 30) { CheckBoxItem(stringResource(R.string.ltf_block_activity_start_in_task), { blockAct }, { blockAct=!blockAct }) }
|
||||
CheckBoxItem(stringResource(R.string.ltf_sys_info), sysInfo, { sysInfo = it })
|
||||
CheckBoxItem(stringResource(R.string.ltf_notifications), notifications, { notifications = it })
|
||||
CheckBoxItem(stringResource(R.string.ltf_home), home, { home = it })
|
||||
CheckBoxItem(stringResource(R.string.ltf_overview), overview, { overview = it })
|
||||
CheckBoxItem(stringResource(R.string.ltf_global_actions), globalAction, { globalAction = it })
|
||||
CheckBoxItem(stringResource(R.string.ltf_keyguard), keyGuard, { keyGuard = it })
|
||||
if(VERSION.SDK_INT >= 30) { CheckBoxItem(stringResource(R.string.ltf_block_activity_start_in_task), blockAct, { blockAct = it }) }
|
||||
}
|
||||
}
|
||||
Button(
|
||||
@@ -949,7 +949,7 @@ fun FactoryResetProtection() {
|
||||
}
|
||||
AnimatedVisibility(usePolicy) {
|
||||
Column {
|
||||
CheckBoxItem(stringResource(R.string.enable_frp), { enabled }, { enabled = !enabled })
|
||||
CheckBoxItem(stringResource(R.string.enable_frp), enabled, { enabled = it })
|
||||
Text(stringResource(R.string.account_list_is))
|
||||
Text(
|
||||
text = if(accountList.isEmpty()) stringResource(R.string.none) else accountList.toText(),
|
||||
@@ -1032,15 +1032,15 @@ private fun WipeData() {
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
CheckBoxItem(
|
||||
stringResource(R.string.wipe_external_storage),
|
||||
{ externalStorage }, { externalStorage = !externalStorage; confirmed = false }
|
||||
externalStorage, { externalStorage = it; confirmed = false }
|
||||
)
|
||||
if(VERSION.SDK_INT >= 22 && isDeviceOwner(dpm)) {
|
||||
CheckBoxItem(stringResource(R.string.wipe_reset_protection_data),
|
||||
{ protectionData }, { protectionData = !protectionData; confirmed = false}
|
||||
protectionData, { protectionData = it; confirmed = false}
|
||||
)
|
||||
}
|
||||
if(VERSION.SDK_INT >= 28) { CheckBoxItem(stringResource(R.string.wipe_euicc), { euicc }, { euicc = !euicc; confirmed = false }) }
|
||||
if(VERSION.SDK_INT >= 29) { CheckBoxItem(stringResource(R.string.wipe_silently), { silent }, { silent = !silent; confirmed = false }) }
|
||||
if(VERSION.SDK_INT >= 28) { CheckBoxItem(stringResource(R.string.wipe_euicc), euicc, { euicc = it; confirmed = false }) }
|
||||
if(VERSION.SDK_INT >= 29) { CheckBoxItem(stringResource(R.string.wipe_silently), silent, { silent = it; confirmed = false }) }
|
||||
AnimatedVisibility(!silent && VERSION.SDK_INT >= 28) {
|
||||
OutlinedTextField(
|
||||
value = reason, onValueChange = { reason = it },
|
||||
@@ -1120,17 +1120,17 @@ private fun SysUpdatePolicy() {
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.system_update_policy_automatic),
|
||||
{ selectedPolicy == TYPE_INSTALL_AUTOMATIC }, { selectedPolicy = TYPE_INSTALL_AUTOMATIC }
|
||||
selectedPolicy == TYPE_INSTALL_AUTOMATIC, { selectedPolicy = TYPE_INSTALL_AUTOMATIC }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.system_update_policy_install_windowed),
|
||||
{ selectedPolicy == TYPE_INSTALL_WINDOWED }, { selectedPolicy = TYPE_INSTALL_WINDOWED }
|
||||
selectedPolicy == TYPE_INSTALL_WINDOWED, { selectedPolicy = TYPE_INSTALL_WINDOWED }
|
||||
)
|
||||
RadioButtonItem(
|
||||
stringResource(R.string.system_update_policy_postpone),
|
||||
{ selectedPolicy == TYPE_POSTPONE}, { selectedPolicy = TYPE_POSTPONE }
|
||||
selectedPolicy == TYPE_POSTPONE, { selectedPolicy = TYPE_POSTPONE }
|
||||
)
|
||||
RadioButtonItem(stringResource(R.string.none), { selectedPolicy == null }, { selectedPolicy = null })
|
||||
RadioButtonItem(stringResource(R.string.none), selectedPolicy == null, { selectedPolicy = null })
|
||||
var windowedPolicyStart by remember { mutableStateOf("") }
|
||||
var windowedPolicyEnd by remember { mutableStateOf("") }
|
||||
if(selectedPolicy == 2) {
|
||||
|
||||
Reference in New Issue
Block a user