• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.net.Uri;
23 
24 import com.android.settings.R;
25 import com.android.settings.SubSettings;
26 import com.android.settings.slices.CustomSliceRegistry;
27 import com.android.settings.slices.SliceBuilderUtils;
28 import com.android.settings.wifi.WifiSettings;
29 
30 import java.util.ArrayList;
31 import java.util.List;
32 
33 /**
34  * Panel data class for Wifi settings.
35  */
36 public class WifiPanel implements PanelContent {
37 
38     private final Context mContext;
39 
create(Context context)40     public static WifiPanel create(Context context) {
41         return new WifiPanel(context);
42     }
43 
WifiPanel(Context context)44     private WifiPanel(Context context) {
45         mContext = context.getApplicationContext();
46     }
47 
48     @Override
getTitle()49     public CharSequence getTitle() {
50         return mContext.getText(R.string.wifi_settings);
51     }
52 
53     @Override
getSlices()54     public List<Uri> getSlices() {
55         final List<Uri> uris = new ArrayList<>();
56         uris.add(CustomSliceRegistry.WIFI_SLICE_URI);
57         return uris;
58     }
59 
60     @Override
getSeeMoreIntent()61     public Intent getSeeMoreIntent() {
62         final String screenTitle =
63                 mContext.getText(R.string.wifi_settings).toString();
64         final Intent intent = SliceBuilderUtils.buildSearchResultPageIntent(mContext,
65                 WifiSettings.class.getName(),
66                 null /* key */,
67                 screenTitle,
68                 SettingsEnums.WIFI);
69         intent.setClassName(mContext.getPackageName(), SubSettings.class.getName());
70         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
71         return intent;
72     }
73 
74     @Override
getMetricsCategory()75     public int getMetricsCategory() {
76         return SettingsEnums.PANEL_WIFI;
77     }
78 }
79