mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
In GBDevice.toString(), return the correct state instead of the simplified one
This commit is contained in:
parent
154b7d28bb
commit
20d8732d10
@ -214,25 +214,41 @@ public class GBDevice implements Parcelable {
|
||||
}
|
||||
|
||||
public String getStateString() {
|
||||
/*
|
||||
* for simplicity the user wont see all internal states, just connecting -> connected
|
||||
* instead of connecting->connected->initializing->initialized
|
||||
*/
|
||||
return getStateString(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* for simplicity the user wont see all internal states, just connecting -> connected
|
||||
* instead of connecting->connected->initializing->initialized
|
||||
* Set simple to true to get this behavior.
|
||||
*/
|
||||
private String getStateString(boolean simple) {
|
||||
switch (mState) {
|
||||
case NOT_CONNECTED:
|
||||
return GBApplication.getContext().getString(R.string.not_connected);
|
||||
case WAITING_FOR_RECONNECT:
|
||||
return GBApplication.getContext().getString(R.string.waiting_for_reconnect);
|
||||
case CONNECTING:
|
||||
case CONNECTED:
|
||||
case INITIALIZING:
|
||||
return GBApplication.getContext().getString(R.string.connecting);
|
||||
case CONNECTED:
|
||||
if (simple) {
|
||||
return GBApplication.getContext().getString(R.string.connecting);
|
||||
}
|
||||
return GBApplication.getContext().getString(R.string.connected);
|
||||
case INITIALIZING:
|
||||
if (simple) {
|
||||
return GBApplication.getContext().getString(R.string.connecting);
|
||||
}
|
||||
return GBApplication.getContext().getString(R.string.initializing);
|
||||
case AUTHENTICATION_REQUIRED:
|
||||
return GBApplication.getContext().getString(R.string.authentication_required);
|
||||
case AUTHENTICATING:
|
||||
return GBApplication.getContext().getString(R.string.authenticating);
|
||||
case INITIALIZED:
|
||||
return GBApplication.getContext().getString(R.string.connected);
|
||||
if (simple) {
|
||||
return GBApplication.getContext().getString(R.string.connected);
|
||||
}
|
||||
return GBApplication.getContext().getString(R.string.initialized);
|
||||
}
|
||||
return GBApplication.getContext().getString(R.string.unknown_state);
|
||||
}
|
||||
@ -323,7 +339,7 @@ public class GBDevice implements Parcelable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Device " + getName() + ", " + getAddress() + ", " + getStateString();
|
||||
return "Device " + getName() + ", " + getAddress() + ", " + getStateString(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user