• 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 android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.net.Uri;
23 import android.provider.Settings;
24 
25 import com.android.settings.R;
26 import com.android.settings.slices.CustomSliceRegistry;
27 
28 import java.util.ArrayList;
29 import java.util.List;
30 
31 /**
32  * Represents the Internet Connectivity Panel.
33  *
34  * <p>
35  * Displays Wifi (full Slice) and Airplane mode.
36  * </p>
37  */
38 public class InternetConnectivityPanel implements PanelContent {
39 
40     private final Context mContext;
41 
create(Context context)42     public static InternetConnectivityPanel create(Context context) {
43         return new InternetConnectivityPanel(context);
44     }
45 
InternetConnectivityPanel(Context context)46     private InternetConnectivityPanel(Context context) {
47         mContext = context.getApplicationContext();
48     }
49 
50     @Override
getTitle()51     public CharSequence getTitle() {
52         return mContext.getText(R.string.internet_connectivity_panel_title);
53     }
54 
55     @Override
getSlices()56     public List<Uri> getSlices() {
57         final List<Uri> uris = new ArrayList<>();
58         uris.add(CustomSliceRegistry.WIFI_SLICE_URI);
59         uris.add(CustomSliceRegistry.MOBILE_DATA_SLICE_URI);
60         uris.add(CustomSliceRegistry.AIRPLANE_URI);
61         return uris;
62     }
63 
64     @Override
getSeeMoreIntent()65     public Intent getSeeMoreIntent() {
66         return new Intent(Settings.ACTION_WIRELESS_SETTINGS)
67                 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
68     }
69 
70     @Override
getMetricsCategory()71     public int getMetricsCategory() {
72         return SettingsEnums.PANEL_INTERNET_CONNECTIVITY;
73     }
74 }
75