Loading res/values/strings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -4815,7 +4815,7 @@ <!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] --> <string name="interaction_control_category_title">Interaction controls</string> <!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] --> <string name="user_installed_services_category_title">Downloaded services</string> <string name="user_installed_services_category_title">Downloaded apps</string> <!-- Title for the accessibility preference category of settings considered to be experimental, meaning they might be changed or removed in the future. [CHAR LIMIT=50] --> <string name="experimental_category_title">Experimental</string> <!-- Title for feature flags dashboard where developers can turn on experimental features [CHAR LIMIT=50] --> Loading Loading @@ -4921,7 +4921,7 @@ <!-- Title for accessibility preference for configuring touch feedback vibrations. --> <string name="accessibility_touch_vibration_title">Touch feedback</string> <!-- Used in the acessibilty service settings to control turning on/off the service entirely --> <string name="accessibility_service_master_switch_title">Use service</string> <string name="accessibility_service_master_switch_title">Use <xliff:g id="service" example="TalkBack">%1$s</xliff:g></string> <!-- Used in the Color correction settings screen to control turning on/off the feature entirely --> <string name="accessibility_daltonizer_master_switch_title">Use color correction</string> <!-- Used in the Captions settings screen to control turning on/off the feature entirely --> Loading Loading @@ -5147,7 +5147,7 @@ </string> <!-- Title for the action perform in accessibility dialog. [CHAR LIMIT=NONE] --> <string name="accessibility_service_action_perform_title">View and platform actions</string> <string name="accessibility_service_action_perform_title">View and perform actions</string> <!-- Description for the action perform in accessibility dialog. [CHAR LIMIT=NONE] --> <string name="accessibility_service_action_perform_description">It can track your interactions Loading src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java +11 −7 Original line number Diff line number Diff line Loading @@ -85,6 +85,16 @@ public class ToggleAccessibilityServicePreferenceFragment mLockPatternUtils = new LockPatternUtils(getActivity()); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mSwitchBar.setLabelDelegate((boolean isChecked) -> { final AccessibilityServiceInfo info = getAccessibilityServiceInfo(); return getString(R.string.accessibility_service_master_switch_title, info.getResolveInfo().loadLabel(getPackageManager())); }); } @Override public void onResume() { mSettingsContentObserver.register(getContentResolver()); Loading Loading @@ -120,7 +130,7 @@ public class ToggleAccessibilityServicePreferenceFragment return serviceInfo; } } return null; throw new IllegalStateException("ServiceInfo is not found."); } @Override Loading @@ -128,18 +138,12 @@ public class ToggleAccessibilityServicePreferenceFragment switch (dialogId) { case DIALOG_ID_ENABLE_WARNING: { final AccessibilityServiceInfo info = getAccessibilityServiceInfo(); if (info == null) { return null; } mDialog = AccessibilityServiceWarning .createCapabilitiesDialog(getActivity(), info, this); break; } case DIALOG_ID_DISABLE_WARNING: { AccessibilityServiceInfo info = getAccessibilityServiceInfo(); if (info == null) { return null; } mDialog = AccessibilityServiceWarning .createDisableDialog(getActivity(), info, this); break; Loading src/com/android/settings/widget/SwitchBar.java +21 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,16 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC void onSwitchChanged(Switch switchView, boolean isChecked); } public interface LabelDelegate { /** * Called to create label and set the title with Accessibility * service name to the textView of switchBar. * * @param isChecked The checked state of switchView. */ String createLabel(boolean isChecked); } private static final int[] XML_ATTRIBUTES = { R.attr.switchBarMarginStart, R.attr.switchBarMarginEnd, Loading Loading @@ -90,6 +100,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC private boolean mDisabledByAdmin; private EnforcedAdmin mEnforcedAdmin = null; private String mMetricsTag; private LabelDelegate mLabelDelegate; public SwitchBar(Context context) { Loading Loading @@ -178,7 +189,11 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC } public void setTextViewLabelAndBackground(boolean isChecked) { if(mLabelDelegate != null) { mLabel = mLabelDelegate.createLabel(isChecked); } else { mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId); } setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor); updateText(); } Loading Loading @@ -383,4 +398,9 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC requestLayout(); } public void setLabelDelegate(LabelDelegate labelDelegate) { mLabelDelegate = labelDelegate; setTextViewLabelAndBackground(isChecked()); } } Loading
res/values/strings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -4815,7 +4815,7 @@ <!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] --> <string name="interaction_control_category_title">Interaction controls</string> <!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] --> <string name="user_installed_services_category_title">Downloaded services</string> <string name="user_installed_services_category_title">Downloaded apps</string> <!-- Title for the accessibility preference category of settings considered to be experimental, meaning they might be changed or removed in the future. [CHAR LIMIT=50] --> <string name="experimental_category_title">Experimental</string> <!-- Title for feature flags dashboard where developers can turn on experimental features [CHAR LIMIT=50] --> Loading Loading @@ -4921,7 +4921,7 @@ <!-- Title for accessibility preference for configuring touch feedback vibrations. --> <string name="accessibility_touch_vibration_title">Touch feedback</string> <!-- Used in the acessibilty service settings to control turning on/off the service entirely --> <string name="accessibility_service_master_switch_title">Use service</string> <string name="accessibility_service_master_switch_title">Use <xliff:g id="service" example="TalkBack">%1$s</xliff:g></string> <!-- Used in the Color correction settings screen to control turning on/off the feature entirely --> <string name="accessibility_daltonizer_master_switch_title">Use color correction</string> <!-- Used in the Captions settings screen to control turning on/off the feature entirely --> Loading Loading @@ -5147,7 +5147,7 @@ </string> <!-- Title for the action perform in accessibility dialog. [CHAR LIMIT=NONE] --> <string name="accessibility_service_action_perform_title">View and platform actions</string> <string name="accessibility_service_action_perform_title">View and perform actions</string> <!-- Description for the action perform in accessibility dialog. [CHAR LIMIT=NONE] --> <string name="accessibility_service_action_perform_description">It can track your interactions Loading
src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java +11 −7 Original line number Diff line number Diff line Loading @@ -85,6 +85,16 @@ public class ToggleAccessibilityServicePreferenceFragment mLockPatternUtils = new LockPatternUtils(getActivity()); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mSwitchBar.setLabelDelegate((boolean isChecked) -> { final AccessibilityServiceInfo info = getAccessibilityServiceInfo(); return getString(R.string.accessibility_service_master_switch_title, info.getResolveInfo().loadLabel(getPackageManager())); }); } @Override public void onResume() { mSettingsContentObserver.register(getContentResolver()); Loading Loading @@ -120,7 +130,7 @@ public class ToggleAccessibilityServicePreferenceFragment return serviceInfo; } } return null; throw new IllegalStateException("ServiceInfo is not found."); } @Override Loading @@ -128,18 +138,12 @@ public class ToggleAccessibilityServicePreferenceFragment switch (dialogId) { case DIALOG_ID_ENABLE_WARNING: { final AccessibilityServiceInfo info = getAccessibilityServiceInfo(); if (info == null) { return null; } mDialog = AccessibilityServiceWarning .createCapabilitiesDialog(getActivity(), info, this); break; } case DIALOG_ID_DISABLE_WARNING: { AccessibilityServiceInfo info = getAccessibilityServiceInfo(); if (info == null) { return null; } mDialog = AccessibilityServiceWarning .createDisableDialog(getActivity(), info, this); break; Loading
src/com/android/settings/widget/SwitchBar.java +21 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,16 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC void onSwitchChanged(Switch switchView, boolean isChecked); } public interface LabelDelegate { /** * Called to create label and set the title with Accessibility * service name to the textView of switchBar. * * @param isChecked The checked state of switchView. */ String createLabel(boolean isChecked); } private static final int[] XML_ATTRIBUTES = { R.attr.switchBarMarginStart, R.attr.switchBarMarginEnd, Loading Loading @@ -90,6 +100,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC private boolean mDisabledByAdmin; private EnforcedAdmin mEnforcedAdmin = null; private String mMetricsTag; private LabelDelegate mLabelDelegate; public SwitchBar(Context context) { Loading Loading @@ -178,7 +189,11 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC } public void setTextViewLabelAndBackground(boolean isChecked) { if(mLabelDelegate != null) { mLabel = mLabelDelegate.createLabel(isChecked); } else { mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId); } setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor); updateText(); } Loading Loading @@ -383,4 +398,9 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC requestLayout(); } public void setLabelDelegate(LabelDelegate labelDelegate) { mLabelDelegate = labelDelegate; setTextViewLabelAndBackground(isChecked()); } }