• 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.panel;
18 
19 import static com.android.settingslib.media.MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT;
20 
21 import android.content.Context;
22 import android.provider.Settings;
23 
24 public class PanelFeatureProviderImpl implements PanelFeatureProvider {
25 
26     @Override
getPanel(Context context, String panelType, String mediaPackageName)27     public PanelContent getPanel(Context context, String panelType, String mediaPackageName) {
28         if (context == null) {
29             return null;
30         }
31 
32         switch (panelType) {
33             case Settings.Panel.ACTION_INTERNET_CONNECTIVITY:
34                 return InternetConnectivityPanel.create(context);
35             case ACTION_MEDIA_OUTPUT:
36                 return MediaOutputPanel.create(context, mediaPackageName);
37             case Settings.Panel.ACTION_NFC:
38                 return NfcPanel.create(context);
39             case Settings.Panel.ACTION_WIFI:
40                 return WifiPanel.create(context);
41             case Settings.Panel.ACTION_VOLUME:
42                 return VolumePanel.create(context);
43         }
44 
45         throw new IllegalStateException("No matching panel for: "  + panelType);
46     }
47 }
48