blob: c3c08f0c408c577866f624ddf712e463ff1d90b0 [file] [log] [blame]
Tony Mantler99b255c2016-01-22 14:59:22 -08001/*
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 */
16package com.android.settings.wifi;
17
Tony Mantler99b255c2016-01-22 14:59:22 -080018import android.content.Context;
Fan Zhangc7162cd2018-06-18 15:21:41 -070019
tmfang99cc23d2018-06-26 19:01:57 +080020import androidx.fragment.app.Fragment;
Fan Zhangc7162cd2018-06-18 15:21:41 -070021import androidx.preference.PreferenceViewHolder;
22
Fan Zhang23f8d592018-08-28 15:11:40 -070023import com.android.settingslib.wifi.AccessPoint;
24import com.android.settingslib.wifi.AccessPointPreference;
25
Tony Mantler99b255c2016-01-22 14:59:22 -080026public class LongPressAccessPointPreference extends AccessPointPreference {
27
28 private final Fragment mFragment;
29
Tony Mantler99b255c2016-01-22 14:59:22 -080030 public LongPressAccessPointPreference(AccessPoint accessPoint, Context context,
Salvador Martinez47568de2016-08-12 10:31:43 -070031 UserBadgeCache cache, boolean forSavedNetworks, int iconResId, Fragment fragment) {
32 super(accessPoint, context, cache, iconResId, forSavedNetworks);
33 mFragment = fragment;
34 }
35
Tony Mantler99b255c2016-01-22 14:59:22 -080036 @Override
37 public void onBindViewHolder(final PreferenceViewHolder view) {
38 super.onBindViewHolder(view);
39 if (mFragment != null) {
40 view.itemView.setOnCreateContextMenuListener(mFragment);
41 view.itemView.setTag(this);
42 view.itemView.setLongClickable(true);
43 }
Tony Mantler99b255c2016-01-22 14:59:22 -080044 }
45}