Fixed a receiver leak, added a FIXME.

This commit is contained in:
akwizgran
2013-05-01 11:54:28 +01:00
parent 5179e2fde1
commit 4290e3d1e5
2 changed files with 4 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ implements InvitationListener {
private AuthorId localAuthorId = null; private AuthorId localAuthorId = null;
private String networkName = null; private String networkName = null;
private boolean bluetoothEnabled = false; private boolean bluetoothEnabled = false;
private BluetoothWifiStateReceiver receiver = null;
private int localInvitationCode = -1, remoteInvitationCode = -1; private int localInvitationCode = -1, remoteInvitationCode = -1;
private int localConfirmationCode = -1, remoteConfirmationCode = -1; private int localConfirmationCode = -1, remoteConfirmationCode = -1;
private boolean connectionFailed = false; private boolean connectionFailed = false;
@@ -145,7 +146,7 @@ implements InvitationListener {
filter.addAction(ACTION_STATE_CHANGED); filter.addAction(ACTION_STATE_CHANGED);
filter.addAction(ACTION_SCAN_MODE_CHANGED); filter.addAction(ACTION_SCAN_MODE_CHANGED);
filter.addAction(NETWORK_STATE_CHANGED_ACTION); filter.addAction(NETWORK_STATE_CHANGED_ACTION);
BluetoothWifiStateReceiver receiver = new BluetoothWifiStateReceiver(); receiver = new BluetoothWifiStateReceiver();
registerReceiver(receiver, filter); registerReceiver(receiver, filter);
// Get the current Bluetooth and WiFi state // Get the current Bluetooth and WiFi state
@@ -188,6 +189,7 @@ implements InvitationListener {
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
if(task != null) task.removeListener(this); if(task != null) task.removeListener(this);
unregisterReceiver(receiver);
unbindService(serviceConnection); unbindService(serviceConnection);
} }

View File

@@ -54,7 +54,7 @@ implements OnEditorActionListener, OnClickListener {
continueButton.setEnabled(getText().length() == 6); continueButton.setEnabled(getText().length() == 6);
} }
}; };
codeEntry.setId(1); codeEntry.setId(1); // FIXME: State is not saved and restored
codeEntry.setTextSize(26); codeEntry.setTextSize(26);
codeEntry.setOnEditorActionListener(this); codeEntry.setOnEditorActionListener(this);
codeEntry.setMinEms(5); codeEntry.setMinEms(5);