• 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 android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.os.Bundle;
22 
23 import com.android.settings.R;
24 import com.android.settingslib.core.AbstractPreferenceController;
25 import com.android.settingslib.core.lifecycle.Lifecycle;
26 import com.android.settingslib.search.Indexable;
27 import com.android.settingslib.widget.FooterPreference;
28 
29 import java.util.ArrayList;
30 import java.util.List;
31 
32 public class ZenModeRestrictNotificationsSettings extends ZenModeSettingsBase implements Indexable {
33 
34     @Override
onCreate(Bundle icicle)35     public void onCreate(Bundle icicle) {
36         super.onCreate(icicle);
37     }
38 
39     @Override
createPreferenceControllers(Context context)40     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
41         return buildPreferenceControllers(context, getSettingsLifecycle());
42     }
43 
44     @Override
getHelpResource()45     public int getHelpResource() {
46         return R.string.help_uri_interruptions;
47     }
48 
buildPreferenceControllers(Context context, Lifecycle lifecycle)49     private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
50             Lifecycle lifecycle) {
51         List<AbstractPreferenceController> controllers = new ArrayList<>();
52         controllers.add(new ZenModeVisEffectsNonePreferenceController(
53                 context, lifecycle, "zen_mute_notifications"));
54         controllers.add(new ZenModeVisEffectsAllPreferenceController(
55                 context, lifecycle, "zen_hide_notifications"));
56         controllers.add(new ZenModeVisEffectsCustomPreferenceController(
57                 context, lifecycle, "zen_custom"));
58         controllers.add(new ZenFooterPreferenceController(context, lifecycle,
59                 FooterPreference.KEY_FOOTER));
60         return controllers;
61     }
62 
63     @Override
getPreferenceScreenResId()64     protected int getPreferenceScreenResId() {
65         return R.xml.zen_mode_restrict_notifications_settings;
66     }
67 
68     @Override
getMetricsCategory()69     public int getMetricsCategory() {
70         return SettingsEnums.SETTINGS_ZEN_NOTIFICATIONS;
71     }
72 }
73