am be38a39f: merge from open-source master
Merge commit 'be38a39fc98d8574b747c57fea2aedd5d97fd333' * commit 'be38a39fc98d8574b747c57fea2aedd5d97fd333': Fix window leak problems in settings.
This commit is contained in:
committed by
Android Git Automerger
commit
e50496fb35
@@ -57,6 +57,8 @@ public class LanguageSettings extends PreferenceActivity {
|
||||
|
||||
private String mLastInputMethodId;
|
||||
private String mLastTickedInputMethodId;
|
||||
|
||||
private AlertDialog mDialog = null;
|
||||
|
||||
static public String getInputMethodIdFromKey(String key) {
|
||||
return key;
|
||||
@@ -257,29 +259,35 @@ public class LanguageSettings extends PreferenceActivity {
|
||||
if (selImi == null) {
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
AlertDialog d = (new AlertDialog.Builder(this))
|
||||
.setTitle(android.R.string.dialog_alert_title)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setMessage(getString(R.string.ime_security_warning,
|
||||
selImi.getServiceInfo().applicationInfo.loadLabel(
|
||||
getPackageManager())))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
chkPref.setChecked(true);
|
||||
mLastTickedInputMethodId = id;
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
|
||||
})
|
||||
.create();
|
||||
d.show();
|
||||
if (mDialog == null) {
|
||||
mDialog = (new AlertDialog.Builder(this))
|
||||
.setTitle(android.R.string.dialog_alert_title)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
chkPref.setChecked(true);
|
||||
mLastTickedInputMethodId = id;
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
|
||||
})
|
||||
.create();
|
||||
} else {
|
||||
if (mDialog.isShowing()) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
mDialog.setMessage(getString(R.string.ime_security_warning,
|
||||
selImi.getServiceInfo().applicationInfo.loadLabel(
|
||||
getPackageManager())));
|
||||
mDialog.show();
|
||||
} else if (id.equals(mLastTickedInputMethodId)) {
|
||||
mLastTickedInputMethodId = null;
|
||||
}
|
||||
@@ -307,4 +315,13 @@ public class LanguageSettings extends PreferenceActivity {
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
mDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user