Change string of switchbar and installed service category title

Bug: 122897712
Test: Visual
Change-Id: I0f56b4b7375e651a74189dd17e6b3bd8b99ccfca
This commit is contained in:
Kevin Chang
2019-07-15 16:23:51 +08:00
parent ccf9715464
commit a6308c09a8
9 changed files with 68 additions and 13 deletions

View File

@@ -77,14 +77,12 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
private TextView mTextView;
private String mLabel;
private String mSummary;
private String mOnText;
private String mOffText;
@ColorInt
private int mBackgroundColor;
@ColorInt
private int mBackgroundActivatedColor;
@StringRes
private int mOnTextId;
@StringRes
private int mOffTextId;
private boolean mLoggingIntialized;
private boolean mDisabledByAdmin;
@@ -178,14 +176,20 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
}
public void setTextViewLabelAndBackground(boolean isChecked) {
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
mLabel = isChecked ? mOnText : mOffText;
setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
updateText();
}
public void setSwitchBarText(int onText, int offText) {
mOnTextId = onText;
mOffTextId = offText;
public void setSwitchBarText(int onTextId, int offTextId) {
mOnText = getResources().getString(onTextId);
mOffText = getResources().getString(offTextId);
setTextViewLabelAndBackground(isChecked());
}
public void setSwitchBarText(String onText, String offText) {
mOnText = onText;
mOffText = offText;
setTextViewLabelAndBackground(isChecked());
}