Remove PreferenceActivity
Its broken and isn't worth maintaining, instead port the few things using it over to SettingsPreferenceActivity with wrapping blank Activities like the rest of Settings. Change-Id: Ic82f0dcb63ed9b4078f7da6a79c0c52f0130e8d1 Fixes: 28779941
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -25,15 +27,16 @@ import android.support.v7.preference.PreferenceScreen;
|
||||
import android.text.Editable;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.android.settings.PreferenceActivity;
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
|
||||
|
||||
/**
|
||||
* Provide an interface for testing out the Wifi API
|
||||
*/
|
||||
public class WifiAPITest extends PreferenceActivity implements
|
||||
Preference.OnPreferenceClickListener {
|
||||
public class WifiAPITest extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceClickListener {
|
||||
|
||||
private static final String TAG = "WifiAPITest";
|
||||
private int netid;
|
||||
@@ -58,15 +61,14 @@ Preference.OnPreferenceClickListener {
|
||||
//============================
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
onCreatePreferences();
|
||||
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
private void onCreatePreferences() {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.layout.wifi_api_test);
|
||||
|
||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
@@ -82,6 +84,11 @@ Preference.OnPreferenceClickListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
return MetricsEvent.TESTING;
|
||||
}
|
||||
|
||||
//============================
|
||||
// Preference callbacks
|
||||
//============================
|
||||
@@ -99,11 +106,11 @@ Preference.OnPreferenceClickListener {
|
||||
if (pref == mWifiDisconnect) {
|
||||
mWifiManager.disconnect();
|
||||
} else if (pref == mWifiDisableNetwork) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
||||
alert.setTitle("Input");
|
||||
alert.setMessage("Enter Network ID");
|
||||
// Set an EditText view to get user input
|
||||
final EditText input = new EditText(this);
|
||||
final EditText input = new EditText(getPrefContext());
|
||||
alert.setView(input);
|
||||
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
@@ -125,11 +132,11 @@ Preference.OnPreferenceClickListener {
|
||||
});
|
||||
alert.show();
|
||||
} else if (pref == mWifiEnableNetwork) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
||||
alert.setTitle("Input");
|
||||
alert.setMessage("Enter Network ID");
|
||||
// Set an EditText view to get user input
|
||||
final EditText input = new EditText(this);
|
||||
final EditText input = new EditText(getPrefContext());
|
||||
alert.setView(input);
|
||||
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
|
Reference in New Issue
Block a user