• 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;
18 
19 import android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.os.Bundle;
22 import android.service.notification.ZenPolicy;
23 
24 import com.android.settings.R;
25 import com.android.settingslib.core.AbstractPreferenceController;
26 
27 import java.util.ArrayList;
28 import java.util.List;
29 
30 public class ZenCustomRuleBlockedEffectsSettings extends ZenCustomRuleSettingsBase {
31 
32     @Override
onCreate(Bundle bundle)33     public void onCreate(Bundle bundle) {
34         super.onCreate(bundle);
35         mFooterPreferenceMixin.createFooterPreference().setTitle(
36                 R.string.zen_mode_blocked_effects_footer);
37     }
38 
39     @Override
getPreferenceScreenResId()40     protected int getPreferenceScreenResId() {
41         return R.xml.zen_mode_block_settings;
42     }
43 
44     @Override
createPreferenceControllers(Context context)45     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
46         mControllers = new ArrayList<>();
47         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
48                 "zen_effect_intent", ZenPolicy.VISUAL_EFFECT_FULL_SCREEN_INTENT,
49                 SettingsEnums.ACTION_ZEN_BLOCK_FULL_SCREEN_INTENTS, null));
50         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
51                 "zen_effect_light", ZenPolicy.VISUAL_EFFECT_LIGHTS,
52                 SettingsEnums.ACTION_ZEN_BLOCK_LIGHT, null));
53         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
54                 "zen_effect_peek", ZenPolicy.VISUAL_EFFECT_PEEK,
55                 SettingsEnums.ACTION_ZEN_BLOCK_PEEK, null));
56         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
57                 "zen_effect_status", ZenPolicy.VISUAL_EFFECT_STATUS_BAR,
58                 SettingsEnums.ACTION_ZEN_BLOCK_STATUS,
59                 new int[] {ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST}));
60         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
61                 "zen_effect_badge", ZenPolicy.VISUAL_EFFECT_BADGE,
62                 SettingsEnums.ACTION_ZEN_BLOCK_BADGE, null));
63         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
64                 "zen_effect_ambient", ZenPolicy.VISUAL_EFFECT_AMBIENT,
65                 SettingsEnums.ACTION_ZEN_BLOCK_AMBIENT, null));
66         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
67                 "zen_effect_list", ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST,
68                 SettingsEnums.ACTION_ZEN_BLOCK_NOTIFICATION_LIST, null));
69         return mControllers;
70     }
71 
72     @Override
getPreferenceCategoryKey()73     String getPreferenceCategoryKey() {
74         return null;
75     }
76 
77     @Override
getMetricsCategory()78     public int getMetricsCategory() {
79         return SettingsEnums.ZEN_CUSTOM_RULE_VIS_EFFECTS;
80     }
81 }
82