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