1 /* 2 * Copyright (C) 2015 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 package com.android.settings.wifi; 17 18 import android.content.Context; 19 20 import androidx.fragment.app.Fragment; 21 import androidx.preference.PreferenceViewHolder; 22 23 import com.android.settingslib.wifi.AccessPoint; 24 import com.android.settingslib.wifi.AccessPointPreference; 25 26 /** 27 * An AP preference for the currently connected AP. 28 * 29 * Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near 30 * future, please develop in {@link com.android.settingslib.wifi.LongPressWifiEntryPreference}. 31 */ 32 public class LongPressAccessPointPreference extends AccessPointPreference { 33 34 private final Fragment mFragment; 35 LongPressAccessPointPreference(AccessPoint accessPoint, Context context, UserBadgeCache cache, boolean forSavedNetworks, int iconResId, Fragment fragment)36 public LongPressAccessPointPreference(AccessPoint accessPoint, Context context, 37 UserBadgeCache cache, boolean forSavedNetworks, int iconResId, Fragment fragment) { 38 super(accessPoint, context, cache, iconResId, forSavedNetworks); 39 mFragment = fragment; 40 } 41 42 @Override onBindViewHolder(final PreferenceViewHolder view)43 public void onBindViewHolder(final PreferenceViewHolder view) { 44 super.onBindViewHolder(view); 45 if (mFragment != null) { 46 view.itemView.setOnCreateContextMenuListener(mFragment); 47 view.itemView.setTag(this); 48 view.itemView.setLongClickable(true); 49 } 50 } 51 } 52