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

Commit b90e5aff authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reorder visual effect fields" into pi-dev

parents 42646539 9c3e2f6c
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -7218,9 +7218,11 @@
    <string name="zen_mode_visual_signals_settings_subtitle">Allow visual signals</string>
    <!-- Do not disturb: what to block title [CHAR LIMIT = 60] -->
    <string name="zen_mode_what_to_block_title">What to block</string>
    <string name="zen_mode_what_to_block_title">Block visual disturbances</string>
    <!-- Do not disturb: what to block > effects title [CHAR LIMIT = 60] -->
    <string name="zen_mode_block_effects_title">When notifications arrive</string>
    <string name="zen_mode_block_effects_screen_on">When the screen is on</string>
    <!-- Do not disturb: what to block > effects title [CHAR LIMIT = 60] -->
    <string name="zen_mode_block_effects_screen_off">When the screen is off</string>
    <!-- Do not disturb: what to block option [CHAR LIMIT=NONE] -->
    <string name="zen_mode_block_effect_sound">Mute sound and vibration</string>
    <!-- Do not disturb: what to block option [CHAR LIMIT=NONE] -->
@@ -7238,6 +7240,12 @@
    <!-- Do not disturb: what to block option [CHAR LIMIT=NONE] -->
    <string name="zen_mode_block_effect_list">Hide from notification list</string>
    <!-- Do not disturb: what to block summary, none -->
    <string name="zen_mode_block_effect_summary_none">Never</string>
    <!-- Do not disturb: what to block summary, screen off -->
    <string name="zen_mode_block_effect_summary_screen_off">When screen is off</string>
    <!-- Do not disturb: what to block summary, screen on -->
    <string name="zen_mode_block_effect_summary_screen_on">When screen is on</string>
    <!-- Do not disturb: what to block summary, only sound and vibration -->
    <string name="zen_mode_block_effect_summary_sound">Sound and vibration</string>
    <!-- Do not disturb: what to block summary, sound vibration and some visual signals-->
@@ -7245,6 +7253,8 @@
    <!-- Do not disturb: what to block summary, all effects -->
    <string name="zen_mode_block_effect_summary_all">Sound, vibration, and visual signs of notifications</string>
    <string name="zen_mode_blocked_effects_footer">Notifications needed for basic phone activity and status will never be hidden</string>
    <!--  Do not disturb: Zen mode no sounds are exceptions to bypass do not disturb-->
    <string name="zen_mode_no_exceptions">None</string>
    <!--  Do not disturb: Zen mode catch all "other" sounds can bypass do not disturb -->
+16 −18
Original line number Diff line number Diff line
@@ -18,17 +18,11 @@
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="zen_mode_block_settings_page"
    android:title="@string/zen_mode_behavior_settings_title">

    <!-- sound vibration -->
    <CheckBoxPreference
        android:key="zen_effect_sound"
        android:title="@string/zen_mode_block_effect_sound"
        android:enabled="false" />
    android:title="@string/zen_mode_what_to_block_title">

   <PreferenceCategory
       android:title="@string/zen_mode_block_effects_title"
       android:key="zen_mode_block_vis_effects">
       android:title="@string/zen_mode_block_effects_screen_off"
       android:key="zen_mode_block_screen_off">

       <CheckBoxPreference
           android:key="zen_effect_intent"
@@ -39,20 +33,24 @@
           android:title="@string/zen_mode_block_effect_light" />

       <CheckBoxPreference
           android:key="zen_effect_peek"
           android:title="@string/zen_mode_block_effect_peek" />

       <CheckBoxPreference
           android:key="zen_effect_status"
           android:title="@string/zen_mode_block_effect_status" />
           android:key="zen_effect_ambient"
           android:title="@string/zen_mode_block_effect_ambient" />

   </PreferenceCategory>
    <PreferenceCategory
        android:title="@string/zen_mode_block_effects_screen_on"
        android:key="zen_mode_block_screen_on">
       <CheckBoxPreference
           android:key="zen_effect_badge"
           android:title="@string/zen_mode_block_effect_badge" />

        <CheckBoxPreference
           android:key="zen_effect_ambient"
           android:title="@string/zen_mode_block_effect_ambient" />
            android:key="zen_effect_status"
            android:title="@string/zen_mode_block_effect_status" />

        <CheckBoxPreference
            android:key="zen_effect_peek"
            android:title="@string/zen_mode_block_effect_peek" />

       <CheckBoxPreference
           android:key="zen_effect_list"
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@
    android:title="@string/zen_mode_settings_title"
    settings:keywords="@string/keywords_zen_mode_settings">

    <!-- sound vibration -->
    <CheckBoxPreference
        android:key="zen_effect_sound"
        android:title="@string/zen_mode_block_effect_sound"
        android:enabled="false" />

    <!-- What to block (effects) -->
    <Preference
        android:key="zen_mode_block_effects_settings"
+5 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;

import android.content.Context;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.support.v7.preference.CheckBoxPreference;

@@ -41,13 +42,10 @@ import java.util.List;
public class ZenModeBlockedEffectsSettings extends ZenModeSettingsBase implements Indexable {

    @Override
    public void onResume() {
        super.onResume();
        CheckBoxPreference soundPreference =
                (CheckBoxPreference) getPreferenceScreen().findPreference("zen_effect_sound");
        if (soundPreference != null) {
            soundPreference.setChecked(true);
        }
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        mFooterPreferenceMixin.createFooterPreference().setTitle(
                R.string.zen_mode_blocked_effects_footer);
    }

    @Override
+29 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.service.notification.ZenModeConfig;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.CheckBoxPreference;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -40,6 +41,17 @@ import java.util.Map;
import java.util.Map.Entry;

public class ZenModeSettings extends ZenModeSettingsBase {
    private static final String KEY_SOUND = "zen_effect_sound";
    @Override
    public void onResume() {
        super.onResume();
        CheckBoxPreference soundPreference =
                (CheckBoxPreference) getPreferenceScreen().findPreference(KEY_SOUND);
        if (soundPreference != null) {
            soundPreference.setChecked(true);
        }
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.zen_mode_settings;
@@ -146,15 +158,25 @@ public class ZenModeSettings extends ZenModeSettingsBase {
        }

        String getBlockedEffectsSummary(Policy policy) {
            if (policy.suppressedVisualEffects == 0) {
                return mContext.getResources().getString(
                        R.string.zen_mode_block_effect_summary_sound);
            } else if (Policy.areAllVisualEffectsSuppressed(policy.suppressedVisualEffects)) {
                return mContext.getResources().getString(
                        R.string.zen_mode_block_effect_summary_all);
            List<String> blockedStrings = new ArrayList<>();
            if (Policy.areAnyScreenOffEffectsSuppressed(policy.suppressedVisualEffects)) {
                blockedStrings.add(mContext.getResources().getString(
                        R.string.zen_mode_block_effect_summary_screen_off));
            }
            if (Policy.areAnyScreenOnEffectsSuppressed(policy.suppressedVisualEffects)) {
                blockedStrings.add(mContext.getResources().getString(
                        R.string.zen_mode_block_effect_summary_screen_on));
            }

            if (blockedStrings.size() == 0) {
                return mContext.getResources().getString(
                    R.string.zen_mode_block_effect_summary_some);
                        R.string.zen_mode_block_effect_summary_none);
            } else if (blockedStrings.size() == 1) {
                return blockedStrings.get(0);
            } else {
                return mContext.getResources().getString(R.string.join_two_unrelated_items,
                        blockedStrings.get(0), blockedStrings.get(1));
            }
        }

        String getAutomaticRulesSummary() {
Loading