• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.app.Fragment;
19 import android.content.Context;
20 import android.support.v7.preference.PreferenceViewHolder;
21 import android.widget.ImageView;
22 import com.android.settings.R;
23 import com.android.settingslib.wifi.AccessPoint;
24 import com.android.settingslib.wifi.AccessPointPreference;
25 
26 public class LongPressAccessPointPreference extends AccessPointPreference {
27 
28     private final Fragment mFragment;
29 
LongPressAccessPointPreference(AccessPoint accessPoint, Context context, UserBadgeCache cache, boolean forSavedNetworks, Fragment fragment)30     public LongPressAccessPointPreference(AccessPoint accessPoint, Context context,
31             UserBadgeCache cache, boolean forSavedNetworks, Fragment fragment) {
32         super(accessPoint, context, cache, forSavedNetworks);
33         mFragment = fragment;
34     }
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