mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-27 06:41:15 +00:00
Merge pull request #584 from DevFactory/release/general-code-quality-fix-1
General code quality fix-1
This commit is contained in:
commit
1a7f24411e
1 changed files with 6 additions and 5 deletions
|
@ -568,9 +568,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Connection> connections = new HashMap<>();
|
Map<String, Connection> connections = new HashMap<>();
|
||||||
for (String deviceId : jsonConnections.keySet()) {
|
for (Map.Entry<String, JSONObject> jsonConnection : jsonConnections.entrySet()) {
|
||||||
|
String deviceId = jsonConnection.getKey();
|
||||||
Connection c = new Connection();
|
Connection c = new Connection();
|
||||||
JSONObject conn = jsonConnections.get(deviceId);
|
JSONObject conn = jsonConnection.getValue();
|
||||||
c.address = deviceId;
|
c.address = deviceId;
|
||||||
c.at = conn.getString("at");
|
c.at = conn.getString("at");
|
||||||
c.inBytesTotal = conn.getLong("inBytesTotal");
|
c.inBytesTotal = conn.getLong("inBytesTotal");
|
||||||
|
@ -607,7 +608,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
|
||||||
private int getDeviceCompletion(String deviceId) {
|
private int getDeviceCompletion(String deviceId) {
|
||||||
int folderCount = 0;
|
int folderCount = 0;
|
||||||
float percentageSum = 0;
|
float percentageSum = 0;
|
||||||
for (String id : mCachedModelInfo.keySet()) {
|
for (Map.Entry<String, Model> modelInfo : mCachedModelInfo.entrySet()) {
|
||||||
boolean isShared = false;
|
boolean isShared = false;
|
||||||
outerloop:
|
outerloop:
|
||||||
for (Folder r : getFolders()) {
|
for (Folder r : getFolders()) {
|
||||||
|
@ -620,8 +621,8 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isShared) {
|
if (isShared) {
|
||||||
long global = mCachedModelInfo.get(id).globalBytes;
|
long global = modelInfo.getValue().globalBytes;
|
||||||
long local = mCachedModelInfo.get(id).inSyncBytes;
|
long local = modelInfo.getValue().inSyncBytes;
|
||||||
percentageSum += (global != 0)
|
percentageSum += (global != 0)
|
||||||
? (local * 100f) / global
|
? (local * 100f) / global
|
||||||
: 100f;
|
: 100f;
|
||||||
|
|
Loading…
Reference in a new issue