Update DND strings

Fixes: 120497233
Bug: 111475013
Test: manually flash and check strings
Test: make RunSettingsRoboTests -j40
Change-Id: I0a8971226a485f8ec41d83c167e51dac1a9c8107
This commit is contained in:
Beverly
2018-12-05 12:33:02 -05:00
parent c4be214f47
commit fdebb9632b
16 changed files with 131 additions and 141 deletions

View File

@@ -31,6 +31,7 @@ import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.utils.ManagedServiceSettings;
import com.android.settings.utils.ZenServiceListing;
@@ -122,17 +123,17 @@ public class ZenRulePreference extends TwoTargetPreference {
return mChecked;
}
public void setChecked(boolean checked) {
mChecked = checked;
if (mCheckBox != null) {
mCheckBox.setChecked(checked);
}
}
public void setName(String name) {
if (!Objects.equals(mName, name)) {
mName = name;
public void updatePreference(AutomaticZenRule rule) {
if (!mRule.getName().equals(rule.getName())) {
mName = rule.getName();
setTitle(mName);
mRule.setName(mName.toString());
}
if (mRule.isEnabled() != rule.isEnabled()) {
mRule.setEnabled(rule.isEnabled());
setChecked(mRule.isEnabled());
setSummary(computeRuleSummary(mRule));
}
}
@@ -141,6 +142,13 @@ public class ZenRulePreference extends TwoTargetPreference {
mOnCheckBoxClickListener.onClick(null);
}
private void setChecked(boolean checked) {
mChecked = checked;
if (mCheckBox != null) {
mCheckBox.setChecked(checked);
}
}
private View.OnClickListener mOnCheckBoxClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -159,7 +167,7 @@ public class ZenRulePreference extends TwoTargetPreference {
try {
ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0);
setSummary(computeRuleSummary(rule, mIsSystemRule, info.loadLabel(mPm)));
setSummary(computeRuleSummary(rule));
} catch (PackageManager.NameNotFoundException e) {
appExists = false;
return;
@@ -179,8 +187,7 @@ public class ZenRulePreference extends TwoTargetPreference {
setKey(mId);
}
private String computeRuleSummary(AutomaticZenRule rule, boolean isSystemRule,
CharSequence providerLabel) {
private String computeRuleSummary(AutomaticZenRule rule) {
return (rule == null || !rule.isEnabled())
? mContext.getResources().getString(R.string.switch_off_text)
: mContext.getResources().getString(R.string.switch_on_text);