Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02b81c13 authored by Beverly's avatar Beverly
Browse files

DND string fixes

Bug: 63077372
Test: make ROBOTEST_FILTER=ZenModeRepeatCallersPreferenceControllerTest RunSettingsRoboTests -j40
Change-Id: Ib2002c75fe86e829bfbbca947affc28dc801cedd
parent 5ff1df89
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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>
+3 −1
Original line number Diff line number Diff line
@@ -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 −2
Original line number Diff line number Diff line
@@ -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));
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -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(
+1 −1

File changed.

Contains only whitespace changes.