mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-30 00:01:19 +00:00
Correct handling of disconnected devices (fixes #473)
This commit is contained in:
parent
13623d5a7e
commit
8443ba179a
2 changed files with 3 additions and 1 deletions
|
@ -119,6 +119,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
|
|||
public String address;
|
||||
public String clientVersion;
|
||||
public int completion;
|
||||
public boolean connected;
|
||||
}
|
||||
|
||||
public static class Model {
|
||||
|
@ -583,6 +584,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
|
|||
c.address = conn.getString("address");
|
||||
c.clientVersion = conn.getString("clientVersion");
|
||||
c.completion = getDeviceCompletion(deviceId);
|
||||
c.connected = conn.getBoolean("connected");
|
||||
|
||||
Connection prev = (mPreviousConnections.containsKey(deviceId))
|
||||
? mPreviousConnections.get(deviceId)
|
||||
|
|
|
@ -55,7 +55,7 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
|
|||
|
||||
name.setText(getItem(position).name);
|
||||
Resources r = getContext().getResources();
|
||||
if (conn != null) {
|
||||
if (conn != null && conn.connected) {
|
||||
if (conn.completion == 100) {
|
||||
status.setText(r.getString(R.string.device_up_to_date));
|
||||
status.setTextColor(r.getColor(R.color.text_green));
|
||||
|
|
Loading…
Reference in a new issue