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 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     }
36 
37     @Override
getPreferenceScreenResId()38     protected int getPreferenceScreenResId() {
39         return R.xml.zen_mode_block_settings;
40     }
41 
42     @Override
createPreferenceControllers(Context context)43     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
44         mControllers = new ArrayList<>();
45         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
46                 "zen_effect_intent", ZenPolicy.VISUAL_EFFECT_FULL_SCREEN_INTENT,
47                 SettingsEnums.ACTION_ZEN_BLOCK_FULL_SCREEN_INTENTS, null));
48         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
49                 "zen_effect_light", ZenPolicy.VISUAL_EFFECT_LIGHTS,
50                 SettingsEnums.ACTION_ZEN_BLOCK_LIGHT, null));
51         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
52                 "zen_effect_peek", ZenPolicy.VISUAL_EFFECT_PEEK,
53                 SettingsEnums.ACTION_ZEN_BLOCK_PEEK, null));
54         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
55                 "zen_effect_status", ZenPolicy.VISUAL_EFFECT_STATUS_BAR,
56                 SettingsEnums.ACTION_ZEN_BLOCK_STATUS,
57                 new int[] {ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST}));
58         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
59                 "zen_effect_badge", ZenPolicy.VISUAL_EFFECT_BADGE,
60                 SettingsEnums.ACTION_ZEN_BLOCK_BADGE, null));
61         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
62                 "zen_effect_ambient", ZenPolicy.VISUAL_EFFECT_AMBIENT,
63                 SettingsEnums.ACTION_ZEN_BLOCK_AMBIENT, null));
64         mControllers.add(new ZenRuleVisEffectPreferenceController(context, getSettingsLifecycle(),
65                 "zen_effect_list", ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST,
66                 SettingsEnums.ACTION_ZEN_BLOCK_NOTIFICATION_LIST, null));
67         return mControllers;
68     }
69 
70     @Override
getPreferenceCategoryKey()71     String getPreferenceCategoryKey() {
72         return null;
73     }
74 
75     @Override
getMetricsCategory()76     public int getMetricsCategory() {
77         return SettingsEnums.ZEN_CUSTOM_RULE_VIS_EFFECTS;
78     }
79 }
80