• 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 
22 import com.android.settings.R;
23 import com.android.settingslib.core.AbstractPreferenceController;
24 import com.android.settingslib.widget.FooterPreference;
25 
26 import java.util.ArrayList;
27 import java.util.List;
28 
29 public class ZenCustomRuleNotificationsSettings extends ZenCustomRuleSettingsBase {
30     private static final String VIS_EFFECTS_ALL_KEY = "zen_mute_notifications";
31     private static final String VIS_EFFECTS_NONE_KEY = "zen_hide_notifications";
32     private static final String VIS_EFFECTS_CUSTOM_KEY = "zen_custom";
33     private static final String PREFERENCE_CATEGORY_KEY = "restrict_category";
34 
35     @Override
getPreferenceScreenResId()36     protected int getPreferenceScreenResId() {
37         return R.xml.zen_mode_restrict_notifications_settings;
38     }
39 
40     @Override
createPreferenceControllers(Context context)41     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
42         mControllers = new ArrayList<>();
43         mControllers.add(new ZenRuleVisEffectsAllPreferenceController(
44                 context, getSettingsLifecycle(), VIS_EFFECTS_ALL_KEY));
45         mControllers.add(new ZenRuleVisEffectsNonePreferenceController(
46                 context, getSettingsLifecycle(), VIS_EFFECTS_NONE_KEY));
47         mControllers.add(new ZenRuleVisEffectsCustomPreferenceController(
48                 context, getSettingsLifecycle(), VIS_EFFECTS_CUSTOM_KEY));
49         mControllers.add(new ZenRuleNotifFooterPreferenceController(context, getSettingsLifecycle(),
50                 FooterPreference.KEY_FOOTER));
51         return mControllers;
52     }
53 
54     @Override
getPreferenceCategoryKey()55     String getPreferenceCategoryKey() {
56         return PREFERENCE_CATEGORY_KEY;
57     }
58 
59     @Override
getMetricsCategory()60     public int getMetricsCategory() {
61         return SettingsEnums.ZEN_CUSTOM_RULE_NOTIFICATION_RESTRICTIONS;
62     }
63 }
64