mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-08 11:11:34 +00:00
* WIP * Revert "WIP" This reverts commit 98b34c47c6b844bd7c5a332360cd5965708e69d7. * WIP * Revert "WIP" This reverts commit 3b9fc96d90708e4d4c0eef08f8372c5c4a2f2314. * Add de/serializer for MinDiskFree * Move MinDiskFree out of Folder * Move MinDiskFree out of Folder (2) * Revert "Move MinDiskFree out of Folder (2)" This reverts commit 65f87db9a59c67d5a59eb713904976c78a5dcb9a. * Revert "Move MinDiskFree out of Folder" This reverts commit b71350bd105731d2763d95db7f3f1d1524328cfa. * Revert "Add de/serializer for MinDiskFree" This reverts commit 582742662942ece78658ebc3f7fa5c3ec91a5262. * RestApi: Add MinDiskFreeSerializer, MinDiskFreeDeserializer * Revert "RestApi: Add MinDiskFreeSerializer, MinDiskFreeDeserializer" This reverts commit 3922f2451c48850c92e9403607bfb4edab8c591d. * Test * Revert "Test" This reverts commit 355009565aaaf50efcf06c72bdff5b3466547a63. * FolderActivity/DeviceActivity: Fix restApi unavailable in onCreate() * Model/Folder#MinDiskFree: Initialize members (fixes #277) * ConfigXml#getFolders: Add MinDiskFree (fixes #277) * ConfigXml: Write back minDiskFree (fixes #277) * Ignore notices about updating gradle dependencies * ConfigXml: Make number parsing more safe * FolderActivity#initFolder: Add new Folder.MinDiskFree * Handle minDiskFree.value as String instead of float * Revert "Handle minDiskFree.value as String instead of float" This reverts commit 0552cfcbe139e99e575237a9b47ee4e888721c6f. * WIP * Revert "WIP" This reverts commit 0a3df9144a86a396318c57a089d41da449d284dc. * RestApi: Avoid creating duplicate Gson() instances * Model/Folder: Use Integer instead of Float See gson glitch: https://github.com/google/gson/pull/1290 https://github.com/google/gson/issues/968 * Try MinDiskFree.value as Long instead of Integer * Revert "Try MinDiskFree.value as Long instead of Integer" This reverts commit d3588629818b3f75d30a2486a7c4583b0d4c99c7. * Revert "Model/Folder: Use Integer instead of Float" This reverts commit ca3931bd0d06cf500cff2443e4205f7c3211e777. * Update model/Options: MinHomeDiskFree (fixes #277)
This commit is contained in:
parent
fb07486404
commit
5911914fbf
4 changed files with 40 additions and 5 deletions
|
@ -655,6 +655,7 @@ public class FolderActivity extends SyncthingActivity {
|
||||||
mFolder.rescanIntervalS = 3600;
|
mFolder.rescanIntervalS = 3600;
|
||||||
mFolder.paused = false;
|
mFolder.paused = false;
|
||||||
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE; // Default for {@link #checkWriteAndUpdateUI}.
|
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE; // Default for {@link #checkWriteAndUpdateUI}.
|
||||||
|
mFolder.minDiskFree = new Folder.MinDiskFree();
|
||||||
mFolder.versioning = new Folder.Versioning();
|
mFolder.versioning = new Folder.Versioning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MinDiskFree {
|
public static class MinDiskFree {
|
||||||
public float value;
|
public float value = 1;
|
||||||
public String unit;
|
public String unit = "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDevice(final Device device) {
|
public void addDevice(final Device device) {
|
||||||
|
|
|
@ -29,16 +29,23 @@ public class Options {
|
||||||
public int progressUpdateIntervalS;
|
public int progressUpdateIntervalS;
|
||||||
public boolean symlinksEnabled;
|
public boolean symlinksEnabled;
|
||||||
public boolean limitBandwidthInLan;
|
public boolean limitBandwidthInLan;
|
||||||
public int minHomeDiskFreePct;
|
|
||||||
public String releasesURL;
|
public String releasesURL;
|
||||||
public String[] alwaysLocalNets;
|
public String[] alwaysLocalNets;
|
||||||
public boolean overwriteRemoteDeviceNamesOnConnect;
|
public boolean overwriteRemoteDeviceNamesOnConnect;
|
||||||
public int tempIndexMinBlocks;
|
public int tempIndexMinBlocks;
|
||||||
public String defaultFolderPath;
|
public String defaultFolderPath;
|
||||||
|
|
||||||
|
// Since v0.14.28, Issue #3307, PR #4087
|
||||||
|
public MinHomeDiskFree minHomeDiskFree;
|
||||||
|
|
||||||
// Since v1.0.0, see https://github.com/syncthing/syncthing/pull/4888
|
// Since v1.0.0, see https://github.com/syncthing/syncthing/pull/4888
|
||||||
public int maxConcurrentScans;
|
public int maxConcurrentScans;
|
||||||
|
|
||||||
|
public static class MinHomeDiskFree {
|
||||||
|
public float value = 1;
|
||||||
|
public String unit = "%";
|
||||||
|
}
|
||||||
|
|
||||||
public static final int USAGE_REPORTING_UNDECIDED = 0;
|
public static final int USAGE_REPORTING_UNDECIDED = 0;
|
||||||
public static final int USAGE_REPORTING_DENIED = -1;
|
public static final int USAGE_REPORTING_DENIED = -1;
|
||||||
|
|
||||||
|
|
|
@ -446,6 +446,16 @@ public class ConfigXml {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MinDiskFree
|
||||||
|
/*
|
||||||
|
<minDiskFree unit="MB">5</minDiskFree>
|
||||||
|
*/
|
||||||
|
folder.minDiskFree = new Folder.MinDiskFree();
|
||||||
|
Element elementMinDiskFree = (Element) r.getElementsByTagName("minDiskFree").item(0);
|
||||||
|
folder.minDiskFree.unit = getAttributeOrDefault(elementMinDiskFree, "unit", "%");
|
||||||
|
folder.minDiskFree.value = getContentOrDefault(elementMinDiskFree, 1f);
|
||||||
|
// Log.v(TAG, "folder.minDiskFree.unit=" + folder.minDiskFree.unit + ", folder.minDiskFree.value=" + folder.minDiskFree.value);
|
||||||
|
|
||||||
// Versioning
|
// Versioning
|
||||||
/*
|
/*
|
||||||
<versioning></versioning>
|
<versioning></versioning>
|
||||||
|
@ -533,8 +543,25 @@ public class ConfigXml {
|
||||||
elementDevice.setAttribute("introducedBy", device.introducedBy);
|
elementDevice.setAttribute("introducedBy", device.introducedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// minDiskFree
|
||||||
|
if (folder.minDiskFree != null) {
|
||||||
|
// Pass 1: Remove all minDiskFree nodes from XML (usually one)
|
||||||
|
Element elementMinDiskFree = (Element) r.getElementsByTagName("minDiskFree").item(0);
|
||||||
|
if (elementMinDiskFree != null) {
|
||||||
|
Log.v(TAG, "updateFolder: nodeMinDiskFree: Removing minDiskFree node");
|
||||||
|
removeChildElementFromTextNode(r, elementMinDiskFree);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass 2: Add minDiskFree node from the POJO model to XML.
|
||||||
|
Node nodeMinDiskFree = mConfig.createElement("minDiskFree");
|
||||||
|
r.appendChild(nodeMinDiskFree);
|
||||||
|
elementMinDiskFree = (Element) nodeMinDiskFree;
|
||||||
|
elementMinDiskFree.setAttribute("unit", folder.minDiskFree.unit);
|
||||||
|
setConfigElement(r, "minDiskFree", Float.toString(folder.minDiskFree.value));
|
||||||
|
}
|
||||||
|
|
||||||
// Versioning
|
// Versioning
|
||||||
// Pass 1: Remove all versioning nodes in XML (usually one)
|
// Pass 1: Remove all versioning nodes from XML (usually one)
|
||||||
/*
|
/*
|
||||||
NodeList nlVersioning = r.getElementsByTagName("versioning");
|
NodeList nlVersioning = r.getElementsByTagName("versioning");
|
||||||
for (int j = nlVersioning.getLength() - 1; j >= 0; j--) {
|
for (int j = nlVersioning.getLength() - 1; j >= 0; j--) {
|
||||||
|
@ -548,7 +575,7 @@ public class ConfigXml {
|
||||||
removeChildElementFromTextNode(r, elementVersioning);
|
removeChildElementFromTextNode(r, elementVersioning);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass 2: Add versioning node from the POJO model.
|
// Pass 2: Add versioning node from the POJO model to XML.
|
||||||
Node nodeVersioning = mConfig.createElement("versioning");
|
Node nodeVersioning = mConfig.createElement("versioning");
|
||||||
r.appendChild(nodeVersioning);
|
r.appendChild(nodeVersioning);
|
||||||
elementVersioning = (Element) nodeVersioning;
|
elementVersioning = (Element) nodeVersioning;
|
||||||
|
|
Loading…
Reference in a new issue