Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 committed Jan 24, 2019
1 parent 5c95fd2 commit 98b34c4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import com.nutomic.syncthingandroid.model.Device;
import com.nutomic.syncthingandroid.model.Folder;
import com.nutomic.syncthingandroid.model.FolderIgnoreList;
import com.nutomic.syncthingandroid.model.MinDiskFree;
import com.nutomic.syncthingandroid.model.Versioning;
import com.nutomic.syncthingandroid.service.Constants;
import com.nutomic.syncthingandroid.service.RestApi;
import com.nutomic.syncthingandroid.service.SyncthingService;
Expand Down Expand Up @@ -251,6 +253,11 @@ public void onCreate(Bundle savedInstanceState) {
}
mConfig.getFolderIgnoreList(restApi, mFolder, this::onReceiveFolderIgnoreList);
mFolderNeedsToUpdate = false;

if (mFolder.minDiskFree != null) {
Log.d(TAG, "minDiskFree: unit= " + mFolder.minDiskFree.unit);
Log.d(TAG, "minDiskFree: value= " + mFolder.minDiskFree.value);
}
}

// If the extra is set, we should automatically share the current folder with the given device.
Expand Down Expand Up @@ -655,7 +662,7 @@ private void initFolder() {
mFolder.rescanIntervalS = 3600;
mFolder.paused = false;
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE; // Default for {@link #checkWriteAndUpdateUI}.
mFolder.versioning = new Folder.Versioning();
mFolder.versioning = new Versioning();
}

private void addEmptyDeviceListView() {
Expand Down Expand Up @@ -771,14 +778,14 @@ private void updateVersioning(Bundle arguments) {
return;
}
if (mFolder.versioning == null) {
mFolder.versioning = new Folder.Versioning();
mFolder.versioning = new Versioning();
}

String type = arguments.getString("type");
arguments.remove("type");

if (type.equals("none")) {
mFolder.versioning = new Folder.Versioning();
mFolder.versioning = new Versioning();
} else {
for (String key : arguments.keySet()) {
mFolder.versioning.params.put(key, arguments.getString(key));
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/com/nutomic/syncthingandroid/model/Folder.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

import com.nutomic.syncthingandroid.service.Constants;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class Folder {

Expand Down Expand Up @@ -45,16 +42,6 @@ public class Folder {
// Folder Status
public String invalid;

public static class Versioning implements Serializable {
public String type;
public Map<String, String> params = new HashMap<>();
}

public static class MinDiskFree {
public float value;
public String unit;
}

public void addDevice(final Device device) {
Device d = new Device();
d.deviceID = device.deviceID;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.nutomic.syncthingandroid.model;

import java.io.Serializable;

public class MinDiskFree implements Serializable {
public float value;
public String unit;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.nutomic.syncthingandroid.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Versioning implements Serializable {
public String type;
public Map<String, String> params = new HashMap<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.nutomic.syncthingandroid.model.Folder;
import com.nutomic.syncthingandroid.model.FolderIgnoreList;
import com.nutomic.syncthingandroid.model.Gui;
import com.nutomic.syncthingandroid.model.Versioning;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.service.Constants;
import com.nutomic.syncthingandroid.service.SyncthingRunnable;
Expand Down Expand Up @@ -437,7 +438,7 @@ public List<Folder> getFolders() {
<param key="cleanoutDays" val="90"></param>
</versioning>
*/
folder.versioning = new Folder.Versioning();
folder.versioning = new Versioning();
Element elementVersioning = (Element) r.getElementsByTagName("versioning").item(0);
folder.versioning.type = getAttributeOrDefault(elementVersioning, "type", "");
NodeList nodeVersioningParam = elementVersioning.getElementsByTagName("param");
Expand Down

0 comments on commit 98b34c4

Please sign in to comment.