DND string fixes
Bug: 63077372 Test: make ROBOTEST_FILTER=ZenModeRepeatCallersPreferenceControllerTest RunSettingsRoboTests -j40 Change-Id: Ib2002c75fe86e829bfbbca947affc28dc801cedd
This commit is contained in:
@@ -6824,10 +6824,10 @@
|
||||
<string name="zen_mode_add">Add</string>
|
||||
|
||||
<!-- Do not disturb: Label for button that will turn on zen mode. [CHAR LIMIT=30] -->
|
||||
<string name="zen_mode_button_turn_on">TURN ON NOW</string>
|
||||
<string name="zen_mode_button_turn_on">Turn on now</string>
|
||||
|
||||
<!-- Do not disturb: Label for button that will turn off zen mode. [CHAR LIMIT=30] -->
|
||||
<string name="zen_mode_button_turn_off">TURN OFF NOW</string>
|
||||
<string name="zen_mode_button_turn_off">Turn off now</string>
|
||||
|
||||
<!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing end time of DND -->
|
||||
<string name="zen_mode_settings_dnd_manual_end_time">Do Not Disturb is on until <xliff:g id="formatted_time" example="7:00 AM">%s</xliff:g></string>
|
||||
|
@@ -61,7 +61,7 @@
|
||||
<!-- Repeat callers -->
|
||||
<SwitchPreference
|
||||
android:key="zen_mode_repeat_callers"
|
||||
android:title="@string/zen_mode_repeat_callers"/>
|
||||
android:title="@string/zen_mode_repeat_callers" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
@@ -45,7 +45,9 @@ public class ZenModeBehaviorSettings extends ZenModeSettingsBase implements Inde
|
||||
controllers.add(new ZenModeRemindersPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeMessagesPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeCallsPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeRepeatCallersPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeRepeatCallersPreferenceController(context, lifecycle,
|
||||
context.getResources().getInteger(com.android.internal.R.integer
|
||||
.config_zen_repeat_callers_threshold)));
|
||||
controllers.add(new ZenModeScreenOnPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeScreenOffPreferenceController(context, lifecycle));
|
||||
controllers.add(new ZenModeBehaviorFooterPreferenceController(context, lifecycle));
|
||||
|
@@ -21,9 +21,11 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePreferenceController
|
||||
@@ -31,8 +33,15 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
|
||||
|
||||
protected static final String KEY = "zen_mode_repeat_callers";
|
||||
|
||||
public ZenModeRepeatCallersPreferenceController(Context context, Lifecycle lifecycle) {
|
||||
private final ZenModeBackend mBackend;
|
||||
private final int mRepeatCallersThreshold;
|
||||
|
||||
public ZenModeRepeatCallersPreferenceController(Context context, Lifecycle lifecycle,
|
||||
int repeatCallersThreshold) {
|
||||
super(context, KEY, lifecycle);
|
||||
|
||||
mRepeatCallersThreshold = repeatCallersThreshold;
|
||||
mBackend = ZenModeBackend.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,12 +54,17 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
setRepeatCallerSummary(screen.findPreference(KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
|
||||
SwitchPreference pref = (SwitchPreference) preference;
|
||||
|
||||
switch (getZenMode()) {
|
||||
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
|
||||
case Settings.Global.ZEN_MODE_ALARMS:
|
||||
@@ -84,4 +98,9 @@ public class ZenModeRepeatCallersPreferenceController extends AbstractZenModePre
|
||||
mBackend.saveSoundPolicy(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS, allowRepeatCallers);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setRepeatCallerSummary(Preference preference) {
|
||||
preference.setSummary(mContext.getString(R.string.zen_mode_repeat_callers_summary,
|
||||
mRepeatCallersThreshold));
|
||||
}
|
||||
}
|
||||
|
@@ -78,7 +78,8 @@ public class ZenModeRepeatCallersPreferenceControllerTest {
|
||||
mContentResolver = RuntimeEnvironment.application.getContentResolver();
|
||||
when(mNotificationManager.getNotificationPolicy()).thenReturn(mPolicy);
|
||||
|
||||
mController = new ZenModeRepeatCallersPreferenceController(mContext, mock(Lifecycle.class));
|
||||
mController = new ZenModeRepeatCallersPreferenceController(mContext, mock(Lifecycle.class),
|
||||
15);
|
||||
ReflectionHelpers.setField(mController, "mBackend", mBackend);
|
||||
|
||||
when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
|
||||
|
Reference in New Issue
Block a user