1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 03:50:43 +02:00

use isConnected() rather than getState() == CONNECTED

because getState() == INITIALIZED implies CONNECTED
This commit is contained in:
cpfeiffer 2015-04-19 15:53:43 +02:00
parent 40c76fcabf
commit 54784100b8

View File

@ -81,7 +81,7 @@ public class ControlCenter extends Activity {
deviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { deviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView parent, View v, int position, long id) { public void onItemClick(AdapterView parent, View v, int position, long id) {
if (deviceList.get(position).getState() == GBDevice.State.CONNECTED) { if (deviceList.get(position).isConnected()) {
Intent startIntent = new Intent(ControlCenter.this, AppManagerActivity.class); Intent startIntent = new Intent(ControlCenter.this, AppManagerActivity.class);
startActivity(startIntent); startActivity(startIntent);
} else { } else {
@ -163,7 +163,7 @@ public class ControlCenter extends Activity {
private void refreshPairedDevices() { private void refreshPairedDevices() {
GBDevice connectedDevice = null; GBDevice connectedDevice = null;
for (GBDevice device : deviceList) { for (GBDevice device : deviceList) {
if (device.getState() == GBDevice.State.CONNECTED) { if (device.isConnected()) {
connectedDevice = device; connectedDevice = device;
} }
} }