• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.notification.zen;
18 
19 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
20 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
21 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
22 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
23 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
24 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
25 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
26 
27 import android.app.settings.SettingsEnums;
28 import android.content.Context;
29 import android.os.Bundle;
30 
31 import com.android.settings.R;
32 import com.android.settingslib.core.AbstractPreferenceController;
33 import com.android.settingslib.core.lifecycle.Lifecycle;
34 import com.android.settingslib.search.Indexable;
35 
36 import java.util.ArrayList;
37 import java.util.List;
38 
39 public class ZenModeBlockedEffectsSettings extends ZenModeSettingsBase implements Indexable {
40 
41     @Override
onCreate(Bundle icicle)42     public void onCreate(Bundle icicle) {
43         super.onCreate(icicle);
44     }
45 
46     @Override
createPreferenceControllers(Context context)47     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
48         return buildPreferenceControllers(context, getSettingsLifecycle());
49     }
50 
buildPreferenceControllers(Context context, Lifecycle lifecycle)51     private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
52             Lifecycle lifecycle) {
53         List<AbstractPreferenceController> controllers = new ArrayList<>();
54         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
55                 "zen_effect_intent", SUPPRESSED_EFFECT_FULL_SCREEN_INTENT,
56                 SettingsEnums.ACTION_ZEN_BLOCK_FULL_SCREEN_INTENTS, null));
57         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
58                 "zen_effect_light", SUPPRESSED_EFFECT_LIGHTS,
59                 SettingsEnums.ACTION_ZEN_BLOCK_LIGHT, null));
60         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
61                 "zen_effect_peek", SUPPRESSED_EFFECT_PEEK,
62                 SettingsEnums.ACTION_ZEN_BLOCK_PEEK, null));
63         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
64                 "zen_effect_status", SUPPRESSED_EFFECT_STATUS_BAR,
65                 SettingsEnums.ACTION_ZEN_BLOCK_STATUS,
66                 new int[] {SUPPRESSED_EFFECT_NOTIFICATION_LIST}));
67         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
68                 "zen_effect_badge", SUPPRESSED_EFFECT_BADGE,
69                 SettingsEnums.ACTION_ZEN_BLOCK_BADGE, null));
70         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
71                 "zen_effect_ambient", SUPPRESSED_EFFECT_AMBIENT,
72                 SettingsEnums.ACTION_ZEN_BLOCK_AMBIENT, null));
73         controllers.add(new ZenModeVisEffectPreferenceController(context, lifecycle,
74                 "zen_effect_list", SUPPRESSED_EFFECT_NOTIFICATION_LIST,
75                 SettingsEnums.ACTION_ZEN_BLOCK_NOTIFICATION_LIST, null));
76         return controllers;
77     }
78 
79     @Override
getPreferenceScreenResId()80     protected int getPreferenceScreenResId() {
81         return R.xml.zen_mode_block_settings;
82     }
83 
84     @Override
getMetricsCategory()85     public int getMetricsCategory() {
86         return SettingsEnums.ZEN_WHAT_TO_BLOCK;
87     }
88 }
89