mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-30 22:12:55 +01:00
Listen to device_changed in addition to refresh_device_list
This commit is contained in:
parent
88e2b7ff99
commit
7b4c7926d3
@ -45,7 +45,7 @@ public class ControlCenter extends Activity {
|
|||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (action.equals(ACTION_QUIT)) {
|
if (action.equals(ACTION_QUIT)) {
|
||||||
finish();
|
finish();
|
||||||
} else if (action.equals(ACTION_REFRESH_DEVICELIST)) {
|
} else if (action.equals(ACTION_REFRESH_DEVICELIST) || action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
|
||||||
String deviceAddress = intent.getStringExtra("device_address");
|
String deviceAddress = intent.getStringExtra("device_address");
|
||||||
GBDevice.State state = GBDevice.State.values()[intent.getIntExtra("device_state", 0)];
|
GBDevice.State state = GBDevice.State.values()[intent.getIntExtra("device_state", 0)];
|
||||||
String firmwareVersion = intent.getStringExtra("firmware_version");
|
String firmwareVersion = intent.getStringExtra("firmware_version");
|
||||||
@ -57,7 +57,7 @@ public class ControlCenter extends Activity {
|
|||||||
device.setFirmwareVersion(firmwareVersion);
|
device.setFirmwareVersion(firmwareVersion);
|
||||||
device.setState(state);
|
device.setState(state);
|
||||||
mGBDeviceAdapter.notifyDataSetChanged();
|
mGBDeviceAdapter.notifyDataSetChanged();
|
||||||
if (state == GBDevice.State.CONNECTED) {
|
if (device.isConnected()) {
|
||||||
hintTextView.setText("tap connected device for App Mananger");
|
hintTextView.setText("tap connected device for App Mananger");
|
||||||
} else if (state == GBDevice.State.NOT_CONNECTED) {
|
} else if (state == GBDevice.State.NOT_CONNECTED) {
|
||||||
hintTextView.setText("tap a device to connect");
|
hintTextView.setText("tap a device to connect");
|
||||||
@ -97,6 +97,7 @@ public class ControlCenter extends Activity {
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(ACTION_QUIT);
|
filter.addAction(ACTION_QUIT);
|
||||||
filter.addAction(ACTION_REFRESH_DEVICELIST);
|
filter.addAction(ACTION_REFRESH_DEVICELIST);
|
||||||
|
filter.addAction(GBDevice.ACTION_DEVICE_CHANGED);
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
|
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
|
||||||
|
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
|
Loading…
Reference in New Issue
Block a user