From dbe783826603da1e488e73879fcc107091057878 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Sat, 9 Mar 2019 15:52:36 +0100 Subject: [PATCH] Add UI for "ignoreDelete" folder option (fixes #356) (#357) * Add drawable: ic_delete_forever_black_24 * Update ConfigXml * Update FolderActivity * Update layout: activity_folder * Add strings * Import de translation --- .../activities/FolderActivity.java | 9 +++++ .../syncthingandroid/util/ConfigXml.java | 2 ++ .../ic_delete_forever_black_24.png | Bin 0 -> 238 bytes .../ic_delete_forever_black_24.png | Bin 0 -> 186 bytes .../ic_delete_forever_black_24.png | Bin 0 -> 266 bytes .../ic_delete_forever_black_24.png | Bin 0 -> 382 bytes .../ic_delete_forever_black_24.png | Bin 0 -> 431 bytes app/src/main/res/layout/activity_folder.xml | 33 ++++++++++++++++++ app/src/main/res/values-de/strings.xml | 8 +++++ app/src/main/res/values/strings.xml | 8 +++++ 10 files changed, 60 insertions(+) create mode 100644 app/src/main/res/drawable-hdpi/ic_delete_forever_black_24.png create mode 100644 app/src/main/res/drawable-mdpi/ic_delete_forever_black_24.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_delete_forever_black_24.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_delete_forever_black_24.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_delete_forever_black_24.png 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 a04de648..df09b778 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java @@ -112,6 +112,7 @@ public class FolderActivity extends SyncthingActivity { private TextView mVersioningDescriptionView; private TextView mVersioningTypeView; private SwitchCompat mVariableSizeBlocks; + private SwitchCompat mIgnoreDelete; private TextView mEditIgnoreListTitle; private EditText mEditIgnoreListContent; @@ -177,6 +178,10 @@ public class FolderActivity extends SyncthingActivity { mFolder.useLargeBlocks = isChecked; mFolderNeedsToUpdate = true; break; + case R.id.ignoreDelete: + mFolder.ignoreDelete = isChecked; + mFolderNeedsToUpdate = true; + break; } } }; @@ -208,6 +213,7 @@ public class FolderActivity extends SyncthingActivity { mVersioningDescriptionView = findViewById(R.id.versioningDescription); mVersioningTypeView = findViewById(R.id.versioningType); mVariableSizeBlocks = findViewById(R.id.variableSizeBlocks); + mIgnoreDelete = findViewById(R.id.ignoreDelete); mDevicesContainer = findViewById(R.id.devicesContainer); mEditIgnoreListTitle = findViewById(R.id.edit_ignore_list_title); mEditIgnoreListContent = findViewById(R.id.edit_ignore_list_content); @@ -458,6 +464,7 @@ public class FolderActivity extends SyncthingActivity { mFolderPaused.setOnCheckedChangeListener(null); mCustomSyncConditionsSwitch.setOnCheckedChangeListener(null); mVariableSizeBlocks.setOnCheckedChangeListener(null); + mIgnoreDelete.setOnCheckedChangeListener(null); // Update views mLabelView.setText(mFolder.label); @@ -468,6 +475,7 @@ public class FolderActivity extends SyncthingActivity { mFolderFileWatcher.setChecked(mFolder.fsWatcherEnabled); mFolderPaused.setChecked(mFolder.paused); mVariableSizeBlocks.setChecked(mFolder.useLargeBlocks); + mIgnoreDelete.setChecked(mFolder.ignoreDelete); findViewById(R.id.editIgnoresContainer).setVisibility(mIsCreateMode ? View.GONE : View.VISIBLE); // Update views - custom sync conditions. @@ -503,6 +511,7 @@ public class FolderActivity extends SyncthingActivity { mFolderPaused.setOnCheckedChangeListener(mCheckedListener); mCustomSyncConditionsSwitch.setOnCheckedChangeListener(mCheckedListener); mVariableSizeBlocks.setOnCheckedChangeListener(mCheckedListener); + mIgnoreDelete.setOnCheckedChangeListener(mCheckedListener); } @Override 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 3c8ff890..1829ba58 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -436,6 +436,7 @@ public class ConfigXml { 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), true); + folder.ignoreDelete = getContentOrDefault(r.getElementsByTagName("ignoreDelete").item(0), false); folder.copyOwnershipFromParent = getContentOrDefault(r.getElementsByTagName("copyOwnershipFromParent").item(0), false); // Devices @@ -532,6 +533,7 @@ public class ConfigXml { setConfigElement(r, "order", folder.order); setConfigElement(r, "paused", Boolean.toString(folder.paused)); setConfigElement(r, "useLargeBlocks", Boolean.toString(folder.useLargeBlocks)); + setConfigElement(r, "ignoreDelete", Boolean.toString(folder.ignoreDelete)); // Update devices that share this folder. // Pass 1: Remove all devices below that folder in XML except the local device. diff --git a/app/src/main/res/drawable-hdpi/ic_delete_forever_black_24.png b/app/src/main/res/drawable-hdpi/ic_delete_forever_black_24.png new file mode 100644 index 0000000000000000000000000000000000000000..7a744ce71c7377c66e436057c421fb4f610693fb GIT binary patch literal 238 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8LpR!;8Qy;(dCJW-ISe9aFDRu&*Vmt#vWNY^M!RfVZ&c&sSQ zzxHX$QO>Q|+`3(&8izPjl-lGh&M!B+GAa0x8n30e?+Rt+89}NH(N<^0CEd=2^hmsQ zW3_9od(+rFUDC;^)lB7w>E9dbeTvEV?PcoSwx4Ou`Ty00rRznyv8~dqn*q%ove)O& ll&)@BBJoC?S5r$#-*aKp`3aR84nPkuc)I$ztaD0e0sySsRTTgL literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_delete_forever_black_24.png b/app/src/main/res/drawable-mdpi/ic_delete_forever_black_24.png new file mode 100644 index 0000000000000000000000000000000000000000..71ad6d8659ea55edbe2fc878833b8642fe2778cb GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+iMo$;VkP61D6PbmW9R*zPiylgP z6O(pc?)Ep{Me8(Mv;W9#a}=16cFOnS6chV`-;QPyFB<+y+>^et^F-~EmB$zO&(N|C z6X`Jimv5lP`Q*tNgXq9#-~=R%~dyTy9jg)gQu&X%Q~loCIIZxOE~}l literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_delete_forever_black_24.png b/app/src/main/res/drawable-xhdpi/ic_delete_forever_black_24.png new file mode 100644 index 0000000000000000000000000000000000000000..af6311048981a8a5b500b26887b44134521a074d GIT binary patch literal 266 zcmV+l0rmcgP)~W=y3`NAOVfS5u5GKX_$L1DEuGc#*Y>kcVT*R zF8;iYn7%wdAOiof%|A~BBH#r^&Qz;6HD^W_FpvWYmGbO?oWTQREK6vVpO<-nJ3E%8 zG|IE1@BnLKowooYH04cz2<6Q{u>$UHKzR{HK>3tZgbPr9PfbN4!UJT=&(9(<-&LW! zh@8QB*(pC0&dVOV07*qoM6N<$f@nl*KmY&$ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete_forever_black_24.png b/app/src/main/res/drawable-xxhdpi/ic_delete_forever_black_24.png new file mode 100644 index 0000000000000000000000000000000000000000..1f04702e68d58c47d6b66184df755fd2dafd1e01 GIT binary patch literal 382 zcmV-^0fGLBP)cj!B`&rv8SgjGR+fMEmlodyDwfx!mbptc7n0PQ18Dk`mJaG-6Z)gGr8 z=MNC@aqrDNK_}1iJg>)+y5(8Yi-{v7dyYMcTK{p7gB%opp4m<^206$<4swu#KG`+C z-|=+|&guz|;;T94Tdkyk|p-#643h(5rAH#zLwXBMIr< z2J}ZC4oDRh3H$Xatd^`eB8?ca-+;n$Qx^`R6%ob@d}jO%6+iEwN|LQ0@v zgV!;E5&`*=MYgHSxQ=~s#Cfp)Fh+cJyb;d4TtBRqEGL{CKZ4!(A*2%nT5fvEgp?_a zuqH$PckI7G4sy^+g|kAf9~ICqYCWldo>40>yP7j2pjemrRh&6pl+0gbtqP cdERCH1ID)sU^!HByZ`_I07*qoM6N<$g7VU!7XSbN literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_delete_forever_black_24.png b/app/src/main/res/drawable-xxxhdpi/ic_delete_forever_black_24.png new file mode 100644 index 0000000000000000000000000000000000000000..33c069718e37e98e8acd9f0ebc7df640c9858d71 GIT binary patch literal 431 zcmV;g0Z{&lP)OjK00Rt2oB;+HV1NN4 z1I|AVJVyr9EU4r+Di+jH0W~?02|`5% + + + + + + + + + + +]> + Syncthing-Fork @@ -210,6 +214,10 @@ Bitte melden Sie auftretende Probleme via GitHub. Variable Blockgröße Blöcke variabler Größe (auch \"große Blöcke\") sind effizienter für größere Dateien. Wenn Du dies für einen Ordner aktivierst, musst du es für diesen Ordner auf allen Geräten aktivieren. + + Löschen ignorieren + Expertenoption, die sich auf die Verarbeitung eingehender Indexaktualisierungen auswirkt. Wenn festgelegt, werden eingehende Aktualisierungen mit dem Löschkennzeichen ignoriert. Siehe &folder_ignore_delete_docs_url; + Ordner pausieren diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d4ec8501..2aa1bf9f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,8 @@ + +]> + Syncthing-Fork @@ -213,6 +217,10 @@ Please report any problems you encounter via Github. Variable Size Blocks Variable size blocks (also "large blocks") are more efficient for large files. If you enable this on one folder, you have to enable it for this folder on all devices. + + Ignore Delete + Expert option that affects the handling of incoming index updates. When set, incoming updates with the delete flag set are ignored. See &folder_ignore_delete_docs_url; + Pause Folder