Clean up unused WifiManager.ActionListener
Bug: 285231003 Test: m Settings Change-Id: I84ec6a76e486df207140c0f5cbda1c6727fe4989
This commit is contained in:
@@ -1953,8 +1953,6 @@
|
|||||||
<string name="wifi_forget">Forget</string>
|
<string name="wifi_forget">Forget</string>
|
||||||
<!-- Button label to modify a Wi-Fi network -->
|
<!-- Button label to modify a Wi-Fi network -->
|
||||||
<string name="wifi_modify">Modify</string>
|
<string name="wifi_modify">Modify</string>
|
||||||
<!-- Failured notification for forget -->
|
|
||||||
<string name="wifi_failed_forget_message">Failed to forget network</string>
|
|
||||||
<!-- Button label to save a Wi-Fi network configuration -->
|
<!-- Button label to save a Wi-Fi network configuration -->
|
||||||
<string name="wifi_save">Save</string>
|
<string name="wifi_save">Save</string>
|
||||||
<!-- Failured notification for save -->
|
<!-- Failured notification for save -->
|
||||||
|
@@ -74,7 +74,6 @@ import com.android.settings.wifi.ConfigureWifiEntryFragment;
|
|||||||
import com.android.settings.wifi.ConnectedWifiEntryPreference;
|
import com.android.settings.wifi.ConnectedWifiEntryPreference;
|
||||||
import com.android.settings.wifi.LongPressWifiEntryPreference;
|
import com.android.settings.wifi.LongPressWifiEntryPreference;
|
||||||
import com.android.settings.wifi.WifiConfigUiBase2;
|
import com.android.settings.wifi.WifiConfigUiBase2;
|
||||||
import com.android.settings.wifi.WifiConnectListener;
|
|
||||||
import com.android.settings.wifi.WifiDialog2;
|
import com.android.settings.wifi.WifiDialog2;
|
||||||
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
||||||
import com.android.settings.wifi.WifiUtils;
|
import com.android.settings.wifi.WifiUtils;
|
||||||
@@ -199,9 +198,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected WifiManager mWifiManager;
|
protected WifiManager mWifiManager;
|
||||||
private WifiManager.ActionListener mConnectListener;
|
|
||||||
private WifiManager.ActionListener mSaveListener;
|
private WifiManager.ActionListener mSaveListener;
|
||||||
private WifiManager.ActionListener mForgetListener;
|
|
||||||
|
|
||||||
protected InternetResetHelper mInternetResetHelper;
|
protected InternetResetHelper mInternetResetHelper;
|
||||||
|
|
||||||
@@ -407,8 +404,6 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
mInternetUpdater = new InternetUpdater(getContext(), getSettingsLifecycle(), this);
|
mInternetUpdater = new InternetUpdater(getContext(), getSettingsLifecycle(), this);
|
||||||
|
|
||||||
mConnectListener = new WifiConnectListener(getActivity());
|
|
||||||
|
|
||||||
mSaveListener = new WifiManager.ActionListener() {
|
mSaveListener = new WifiManager.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -424,22 +419,6 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mForgetListener = new WifiManager.ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(int reason) {
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity != null) {
|
|
||||||
Toast.makeText(activity,
|
|
||||||
R.string.wifi_failed_forget_message,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.settings.wifi;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A listener to display a toast on failure to connect
|
|
||||||
*/
|
|
||||||
public class WifiConnectListener implements WifiManager.ActionListener {
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
public WifiConnectListener(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(int reason) {
|
|
||||||
if (mContext != null) {
|
|
||||||
Toast.makeText(mContext,
|
|
||||||
R.string.wifi_failed_connect_message,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -59,7 +59,6 @@ import com.android.settings.LinkifyUtils;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.RestrictedSettingsFragment;
|
import com.android.settings.RestrictedSettingsFragment;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.Utils;
|
|
||||||
import com.android.settings.core.FeatureFlags;
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.datausage.DataUsagePreference;
|
import com.android.settings.datausage.DataUsagePreference;
|
||||||
@@ -175,9 +174,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected WifiManager mWifiManager;
|
protected WifiManager mWifiManager;
|
||||||
private WifiManager.ActionListener mConnectListener;
|
|
||||||
private WifiManager.ActionListener mSaveListener;
|
private WifiManager.ActionListener mSaveListener;
|
||||||
private WifiManager.ActionListener mForgetListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of {@link #isUiRestricted()} at {@link #onCreate(Bundle)}}. This is neccesary to
|
* The state of {@link #isUiRestricted()} at {@link #onCreate(Bundle)}}. This is neccesary to
|
||||||
@@ -310,8 +307,6 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
mWifiManager = getActivity().getSystemService(WifiManager.class);
|
mWifiManager = getActivity().getSystemService(WifiManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
mConnectListener = new WifiConnectListener(getActivity());
|
|
||||||
|
|
||||||
mSaveListener = new WifiManager.ActionListener() {
|
mSaveListener = new WifiManager.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -328,21 +323,6 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mForgetListener = new WifiManager.ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(int reason) {
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity != null) {
|
|
||||||
Toast.makeText(activity,
|
|
||||||
R.string.wifi_failed_forget_message,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
registerForContextMenu(getListView());
|
registerForContextMenu(getListView());
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user