Skip to content

Commit 6e7c5db

Browse files
committed
#1819 change text for restricted settings
1 parent de607f5 commit 6e7c5db

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

base/src/main/java/io/github/sds100/keymapper/base/onboarding/SetupAccessibilityServiceDialog.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import androidx.compose.ui.text.withStyle
2222
import androidx.compose.ui.tooling.preview.Preview
2323
import androidx.compose.ui.unit.dp
2424
import io.github.sds100.keymapper.base.R
25+
import io.github.sds100.keymapper.base.compose.KeyMapperTheme
2526
import io.github.sds100.keymapper.base.utils.ui.compose.openUriSafe
2627

2728
@Composable
@@ -85,15 +86,16 @@ private fun EnableAccessibilityServiceDialog(
8586
},
8687
text = {
8788
Column {
89+
if (isRestrictedSetting) {
90+
RestrictedSettingText()
91+
Spacer(modifier = Modifier.height(16.dp))
92+
}
93+
8894
Text(
8995
stringResource(R.string.dialog_message_accessibility_service_explanation),
9096
style = MaterialTheme.typography.bodyMedium,
9197
)
9298

93-
if (isRestrictedSetting) {
94-
Spacer(modifier = Modifier.height(16.dp))
95-
RestrictedSettingText()
96-
}
9799
}
98100
},
99101
confirmButton = {
@@ -204,14 +206,14 @@ private fun RestrictedSettingText(modifier: Modifier = Modifier) {
204206
Text(
205207
modifier = modifier,
206208
text = annotatedString,
207-
style = MaterialTheme.typography.bodyMedium,
209+
style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Medium),
208210
)
209211
}
210212

211213
@Preview
212214
@Composable
213215
private fun EnableAccessibilityServiceDialogPreview() {
214-
MaterialTheme {
216+
KeyMapperTheme {
215217
EnableAccessibilityServiceDialog(
216218
isRestrictedSetting = false,
217219
onDismissRequest = {},
@@ -223,7 +225,7 @@ private fun EnableAccessibilityServiceDialogPreview() {
223225
@Preview
224226
@Composable
225227
private fun EnableAccessibilityServiceDialogRestrictedPreview() {
226-
MaterialTheme {
228+
KeyMapperTheme {
227229
EnableAccessibilityServiceDialog(
228230
isRestrictedSetting = true,
229231
onDismissRequest = {},
@@ -235,7 +237,7 @@ private fun EnableAccessibilityServiceDialogRestrictedPreview() {
235237
@Preview
236238
@Composable
237239
private fun RestartAccessibilityServiceDialogPreview() {
238-
MaterialTheme {
240+
KeyMapperTheme {
239241
RestartAccessibilityServiceDialog(
240242
onDismissRequest = {},
241243
onRestartClick = {},
@@ -248,7 +250,7 @@ private fun RestartAccessibilityServiceDialogPreview() {
248250
@Preview
249251
@Composable
250252
private fun CantFindAccessibilitySettingsDialogPreview() {
251-
MaterialTheme {
253+
KeyMapperTheme {
252254
CantFindAccessibilitySettingsDialog(
253255
onDismissRequest = {},
254256
onOpenGuide = {},

base/src/main/java/io/github/sds100/keymapper/base/system/accessibility/ControlAccessibilityServiceUseCase.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class ControlAccessibilityServiceUseCaseImpl @Inject constructor(
4747

4848
override fun isRestrictedSetting(): Boolean {
4949
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
50-
packageManagerAdapter.getInstallSourcePackageName() == "com.android.vending"
50+
// If the app is installed outside of Google Play then Android disables
51+
// the accessibility service until restricted settings are enabled.
52+
packageManagerAdapter.getInstallSourcePackageName() != "com.android.vending"
5153
} else {
5254
false
5355
}

base/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@
455455
<string name="dialog_title_accessibility_service_explanation">Accessibility service must be enabled</string>
456456
<string name="dialog_message_accessibility_service_explanation">@string/accessibility_service_explanation</string>
457457

458-
<string name="dialog_restricted_setting_message">Since you installed Key Mapper from the Google Play Store, you will need to follow some extra steps to enable the accessibility service.</string>
459-
<string name="dialog_restricted_setting_link_text">Read instructions.</string>
458+
<string name="dialog_restricted_setting_message">You may need to allow Restricted Settings.</string>
459+
<string name="dialog_restricted_setting_link_text">Tap to read instructions.</string>
460460

461461
<string name="dialog_title_fix_dnd_trigger_error">Grant Do Not Disturb access</string>
462462
<string name="dialog_message_fix_dnd_trigger_error">You will be taken to your device\'s settings page to manage which apps can modify the Do Not Disturb state. This is <b>not present on some devices</b> so tap don\'t show again if you do not see Key Mapper in the list.</string>

0 commit comments

Comments
 (0)