Revert "Change string of switchbar and installed service category title"
This reverts commit 7eddb0e4dc
.
Reason for revert: There's some side effects with string.
Create a new CL in master branch to fix it.
Bug: 132840332
Change-Id: I17526a06474d25bdb32beda96f5bb6371f0e5ade
This commit is contained in:
@@ -4806,7 +4806,7 @@
|
|||||||
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
|
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
|
||||||
<string name="interaction_control_category_title">Interaction controls</string>
|
<string name="interaction_control_category_title">Interaction controls</string>
|
||||||
<!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
|
<!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
|
||||||
<string name="user_installed_services_category_title">Downloaded apps</string>
|
<string name="user_installed_services_category_title">Downloaded services</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] -->
|
<!-- 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>
|
<string name="experimental_category_title">Experimental</string>
|
||||||
<!-- Title for feature flags dashboard where developers can turn on experimental features [CHAR LIMIT=50] -->
|
<!-- Title for feature flags dashboard where developers can turn on experimental features [CHAR LIMIT=50] -->
|
||||||
@@ -4912,7 +4912,7 @@
|
|||||||
<!-- Title for accessibility preference for configuring touch feedback vibrations. -->
|
<!-- Title for accessibility preference for configuring touch feedback vibrations. -->
|
||||||
<string name="accessibility_touch_vibration_title">Touch feedback</string>
|
<string name="accessibility_touch_vibration_title">Touch feedback</string>
|
||||||
<!-- Used in the acessibilty service settings to control turning on/off the service entirely -->
|
<!-- Used in the acessibilty service settings to control turning on/off the service entirely -->
|
||||||
<string name="accessibility_service_master_switch_title">Use <xliff:g id="service" example="TalkBack">%1$s</xliff:g></string>
|
<string name="accessibility_service_master_switch_title">Use service</string>
|
||||||
<!-- Used in the Color correction settings screen to control turning on/off the feature entirely -->
|
<!-- 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>
|
<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 -->
|
<!-- Used in the Captions settings screen to control turning on/off the feature entirely -->
|
||||||
@@ -5138,7 +5138,7 @@
|
|||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Title for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
|
<!-- Title for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_service_action_perform_title">View and perform actions</string>
|
<string name="accessibility_service_action_perform_title">View and platform actions</string>
|
||||||
|
|
||||||
<!-- Description for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
|
<!-- Description for the action perform in accessibility dialog. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_service_action_perform_description">It can track your interactions
|
<string name="accessibility_service_action_perform_description">It can track your interactions
|
||||||
|
@@ -85,16 +85,6 @@ public class ToggleAccessibilityServicePreferenceFragment
|
|||||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
mSettingsContentObserver.register(getContentResolver());
|
||||||
@@ -130,7 +120,7 @@ public class ToggleAccessibilityServicePreferenceFragment
|
|||||||
return serviceInfo;
|
return serviceInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("ServiceInfo is not found.");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -138,12 +128,18 @@ public class ToggleAccessibilityServicePreferenceFragment
|
|||||||
switch (dialogId) {
|
switch (dialogId) {
|
||||||
case DIALOG_ID_ENABLE_WARNING: {
|
case DIALOG_ID_ENABLE_WARNING: {
|
||||||
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
||||||
|
if (info == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
mDialog = AccessibilityServiceWarning
|
mDialog = AccessibilityServiceWarning
|
||||||
.createCapabilitiesDialog(getActivity(), info, this);
|
.createCapabilitiesDialog(getActivity(), info, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIALOG_ID_DISABLE_WARNING: {
|
case DIALOG_ID_DISABLE_WARNING: {
|
||||||
AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
||||||
|
if (info == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
mDialog = AccessibilityServiceWarning
|
mDialog = AccessibilityServiceWarning
|
||||||
.createDisableDialog(getActivity(), info, this);
|
.createDisableDialog(getActivity(), info, this);
|
||||||
break;
|
break;
|
||||||
|
@@ -61,16 +61,6 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
void onSwitchChanged(Switch switchView, boolean isChecked);
|
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 = {
|
private static final int[] XML_ATTRIBUTES = {
|
||||||
R.attr.switchBarMarginStart,
|
R.attr.switchBarMarginStart,
|
||||||
R.attr.switchBarMarginEnd,
|
R.attr.switchBarMarginEnd,
|
||||||
@@ -100,7 +90,6 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
private boolean mDisabledByAdmin;
|
private boolean mDisabledByAdmin;
|
||||||
private EnforcedAdmin mEnforcedAdmin = null;
|
private EnforcedAdmin mEnforcedAdmin = null;
|
||||||
private String mMetricsTag;
|
private String mMetricsTag;
|
||||||
private LabelDelegate mLabelDelegate;
|
|
||||||
|
|
||||||
|
|
||||||
public SwitchBar(Context context) {
|
public SwitchBar(Context context) {
|
||||||
@@ -189,11 +178,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setTextViewLabelAndBackground(boolean isChecked) {
|
public void setTextViewLabelAndBackground(boolean isChecked) {
|
||||||
if(mLabelDelegate != null) {
|
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
|
||||||
mLabel = mLabelDelegate.createLabel(isChecked);
|
|
||||||
} else {
|
|
||||||
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
|
|
||||||
}
|
|
||||||
setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
|
setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
@@ -398,9 +383,4 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
|
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabelDelegate(LabelDelegate labelDelegate) {
|
|
||||||
mLabelDelegate = labelDelegate;
|
|
||||||
setTextViewLabelAndBackground(isChecked());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user