For simplicity hide some internal states from the user
Display connecting->connected instead of connecting->connected->initializing->initialized
This commit is contained in:
parent
cbc57b4407
commit
b3590fed35
|
@ -53,7 +53,6 @@ public class GBDevice implements Parcelable {
|
||||||
private BatteryState mBatteryState;
|
private BatteryState mBatteryState;
|
||||||
private short mRssi = RSSI_UNKNOWN;
|
private short mRssi = RSSI_UNKNOWN;
|
||||||
private String mBusyTask;
|
private String mBusyTask;
|
||||||
private String infoString;
|
|
||||||
private List<ItemWithDetails> mDeviceInfos;
|
private List<ItemWithDetails> mDeviceInfos;
|
||||||
|
|
||||||
public GBDevice(String address, String name, DeviceType deviceType) {
|
public GBDevice(String address, String name, DeviceType deviceType) {
|
||||||
|
@ -204,23 +203,25 @@ public class GBDevice implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStateString() {
|
public String getStateString() {
|
||||||
|
/*
|
||||||
|
* for simplicity the user wont see all internal states, just connecting -> connected
|
||||||
|
* instead of connecting->connected->initializing->initialized
|
||||||
|
*/
|
||||||
switch (mState) {
|
switch (mState) {
|
||||||
case NOT_CONNECTED:
|
case NOT_CONNECTED:
|
||||||
return GBApplication.getContext().getString(R.string.not_connected);
|
return GBApplication.getContext().getString(R.string.not_connected);
|
||||||
case WAITING_FOR_RECONNECT:
|
case WAITING_FOR_RECONNECT:
|
||||||
return GBApplication.getContext().getString(R.string.waiting_for_reconnect);
|
return GBApplication.getContext().getString(R.string.waiting_for_reconnect);
|
||||||
case CONNECTING:
|
case CONNECTING:
|
||||||
return GBApplication.getContext().getString(R.string.connecting);
|
|
||||||
case CONNECTED:
|
case CONNECTED:
|
||||||
return GBApplication.getContext().getString(R.string.connected);
|
|
||||||
case INITIALIZING:
|
case INITIALIZING:
|
||||||
return GBApplication.getContext().getString(R.string.initializing);
|
return GBApplication.getContext().getString(R.string.connecting);
|
||||||
case AUTHENTICATION_REQUIRED:
|
case AUTHENTICATION_REQUIRED:
|
||||||
return GBApplication.getContext().getString(R.string.authentication_required);
|
return GBApplication.getContext().getString(R.string.authentication_required);
|
||||||
case AUTHENTICATING:
|
case AUTHENTICATING:
|
||||||
return GBApplication.getContext().getString(R.string.authenticating);
|
return GBApplication.getContext().getString(R.string.authenticating);
|
||||||
case INITIALIZED:
|
case INITIALIZED:
|
||||||
return GBApplication.getContext().getString(R.string.initialized);
|
return GBApplication.getContext().getString(R.string.connected);
|
||||||
}
|
}
|
||||||
return GBApplication.getContext().getString(R.string.unknown_state);
|
return GBApplication.getContext().getString(R.string.unknown_state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue