From 9187280687c293e5f6013faecc3f990e9be461b6 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Tue, 5 Mar 2019 23:46:11 +0100 Subject: [PATCH] Enable largeBlocks for new folders by default (fixes #300) (#301) * Enable largeBlocks for new folders by default (fixes #300) * Remove duplicate code to set folder defaults on creation --- .../syncthingandroid/activities/FolderActivity.java | 7 ------- .../java/com/nutomic/syncthingandroid/model/Folder.java | 6 +++++- .../java/com/nutomic/syncthingandroid/util/ConfigXml.java | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java index ca61f9e4..a04de648 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java @@ -663,13 +663,6 @@ public class FolderActivity extends SyncthingActivity { ? getIntent().getStringExtra(EXTRA_FOLDER_ID) : generateRandomFolderId(); mFolder.label = getIntent().getStringExtra(EXTRA_FOLDER_LABEL); - mFolder.fsWatcherEnabled = true; - mFolder.fsWatcherDelayS = 10; - /** - * Folder rescan interval defaults to 3600s as it is the default in - * syncthing when the file watcher is enabled and a new folder is created. - */ - mFolder.rescanIntervalS = 3600; mFolder.paused = false; mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE; // Default for {@link #checkWriteAndUpdateUI}. mFolder.minDiskFree = new Folder.MinDiskFree(); diff --git a/app/src/main/java/com/nutomic/syncthingandroid/model/Folder.java b/app/src/main/java/com/nutomic/syncthingandroid/model/Folder.java index d586c641..24fd01ed 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/model/Folder.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/model/Folder.java @@ -27,6 +27,10 @@ public class Folder { public boolean fsWatcherEnabled = true; public int fsWatcherDelayS = 10; private List devices = new ArrayList<>(); + /** + * Folder rescan interval defaults to 3600s as it is the default in + * syncthing when the file watcher is enabled and a new folder is created. + */ public int rescanIntervalS = 3600; public boolean ignorePerms = true; public boolean autoNormalize = true; @@ -43,7 +47,7 @@ public class Folder { public boolean disableSparseFiles = false; public boolean disableTempIndexes = false; public boolean paused = false; - public boolean useLargeBlocks = false; + public boolean useLargeBlocks = true; public int weakHashThresholdPct = 25; public String markerName = ".stfolder"; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java b/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java index 50cd8928..e781e055 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -435,7 +435,7 @@ public class ConfigXml { folder.hashers = getContentOrDefault(r.getElementsByTagName("hashers").item(0), 0); folder.order = getContentOrDefault(r.getElementsByTagName("order").item(0), "random"); folder.paused = getContentOrDefault(r.getElementsByTagName("paused").item(0), false); - folder.useLargeBlocks = getContentOrDefault(r.getElementsByTagName("useLargeBlocks").item(0), false); + folder.useLargeBlocks = getContentOrDefault(r.getElementsByTagName("useLargeBlocks").item(0), true); folder.copyOwnershipFromParent = getContentOrDefault(r.getElementsByTagName("copyOwnershipFromParent").item(0), false); // Devices