1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-02 23:12:57 +01:00

Refreshing device list when paired devices change now works.

I was using LocalBroadcastManager.... :/
This commit is contained in:
Andreas Shimokawa 2015-05-10 17:05:24 +02:00
parent 0d77a5ac05
commit c8feea9f37

View File

@ -96,12 +96,14 @@ public class ControlCenter extends Activity {
} }
}); });
IntentFilter filter = new IntentFilter(); IntentFilter filterLocal = new IntentFilter();
filter.addAction(ACTION_QUIT); filterLocal.addAction(ACTION_QUIT);
filter.addAction(ACTION_REFRESH_DEVICELIST); filterLocal.addAction(ACTION_REFRESH_DEVICELIST);
filter.addAction(GBDevice.ACTION_DEVICE_CHANGED); filterLocal.addAction(GBDevice.ACTION_DEVICE_CHANGED);
filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); filterLocal.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter); LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filterLocal);
registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
refreshPairedDevices(); refreshPairedDevices();
/* /*
@ -179,6 +181,7 @@ public class ControlCenter extends Activity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver); LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
unregisterReceiver(mReceiver);
super.onDestroy(); super.onDestroy();
} }