am be38a39f: merge from open-source master

Merge commit 'be38a39fc98d8574b747c57fea2aedd5d97fd333'

* commit 'be38a39fc98d8574b747c57fea2aedd5d97fd333':
  Fix window leak problems in settings.
This commit is contained in:
The Android Open Source Project
2010-07-19 13:01:37 -07:00
committed by Android Git Automerger
6 changed files with 208 additions and 79 deletions

View File

@@ -67,6 +67,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
private final LocalBluetoothManager mLocalManager;
private AlertDialog mDialog = null;
private List<Callback> mCallbacks = new ArrayList<Callback>();
/**
@@ -199,12 +201,29 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
};
new AlertDialog.Builder(context)
.setTitle(getName())
.setMessage(message)
.setPositiveButton(android.R.string.ok, disconnectListener)
.setNegativeButton(android.R.string.cancel, null)
.show();
if (mDialog == null) {
mDialog = new AlertDialog.Builder(context)
.setPositiveButton(android.R.string.ok, disconnectListener)
.setNegativeButton(android.R.string.cancel, null)
.create();
} else {
if (mDialog.isShowing()) {
mDialog.dismiss();
}
}
mDialog.setTitle(getName());
mDialog.setMessage(message);
mDialog.show();
}
@Override
protected void finalize() throws Throwable {
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
}
super.finalize();
}
public void connect() {