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.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
27 import com.android.settings.slices.CustomSliceRegistry;
28 import com.android.settings.slices.SliceBuilderUtils;
29 
30 import java.util.ArrayList;
31 import java.util.List;
32 
33 @Deprecated(forRemoval = true)
34 public class NfcPanel implements PanelContent {
35 
36     private final Context mContext;
37 
create(Context context)38     public static NfcPanel create(Context context) {
39         return new NfcPanel(context);
40     }
41 
NfcPanel(Context context)42     private NfcPanel(Context context) {
43         mContext = context.getApplicationContext();
44     }
45 
46     @Override
getTitle()47     public CharSequence getTitle() {
48         return mContext.getText(R.string.nfc_quick_toggle_title);
49     }
50 
51     @Override
getSlices()52     public List<Uri> getSlices() {
53         final List<Uri> uris = new ArrayList<>();
54         uris.add(CustomSliceRegistry.NFC_SLICE_URI);
55         return uris;
56     }
57 
58     @Override
getSeeMoreIntent()59     public Intent getSeeMoreIntent() {
60         final String screenTitle =
61                 mContext.getText(R.string.connected_device_connections_title).toString();
62         Intent intent = SliceBuilderUtils.buildSearchResultPageIntent(mContext,
63                 AdvancedConnectedDeviceDashboardFragment.class.getName(),
64                 null /* key */,
65                 screenTitle,
66                 SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY,
67                 R.string.menu_key_connected_devices);
68         intent.setClassName(mContext.getPackageName(), SubSettings.class.getName());
69         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
70         return intent;
71     }
72 
73     @Override
getMetricsCategory()74     public int getMetricsCategory() {
75         return SettingsEnums.PANEL_NFC;
76     }
77 }
78