Fix window leak on orientation change
Use Activity managed dialogs Bug: 2571764 Bug: 2571820 Change-Id: Id506988abd4200155774e92b31dd132519e29172
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import com.android.settings.R;
|
||||
import android.app.Dialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -48,6 +49,8 @@ public class WifiApSettings extends PreferenceActivity
|
||||
private static final int OPEN_INDEX = 0;
|
||||
private static final int WPA_INDEX = 1;
|
||||
|
||||
private static final int DIALOG_AP_SETTINGS = 1;
|
||||
|
||||
private String[] mSecurityType;
|
||||
private Preference mCreateNetwork;
|
||||
private CheckBoxPreference mEnableWifiAp;
|
||||
@@ -84,6 +87,15 @@ public class WifiApSettings extends PreferenceActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
if (id == DIALOG_AP_SETTINGS) {
|
||||
mDialog = new WifiApDialog(this, this, mWifiConfig);
|
||||
return mDialog;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -99,19 +111,11 @@ public class WifiApSettings extends PreferenceActivity
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||
if (preference == mCreateNetwork) {
|
||||
showDialog();
|
||||
showDialog(DIALOG_AP_SETTINGS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
mDialog = new WifiApDialog(this, this, mWifiConfig);
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
public void onClick(DialogInterface dialogInterface, int button) {
|
||||
|
||||
if (button == DialogInterface.BUTTON_POSITIVE) {
|
||||
|
||||
Reference in New Issue
Block a user