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:
Kevin Chang
2019-05-17 08:02:06 +00:00
parent 7eddb0e4dc
commit d8927cbabf
3 changed files with 11 additions and 35 deletions

View File

@@ -61,16 +61,6 @@ 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,
@@ -100,7 +90,6 @@ 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) {
@@ -189,11 +178,7 @@ 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);
}
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
updateText();
}
@@ -398,9 +383,4 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
requestLayout();
}
public void setLabelDelegate(LabelDelegate labelDelegate) {
mLabelDelegate = labelDelegate;
setTextViewLabelAndBackground(isChecked());
}
}