1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-29 15:51:17 +00:00

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
This commit is contained in:
Catfriend1 2019-03-09 15:52:36 +01:00 committed by GitHub
parent 33cafa2073
commit dbe7838266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 0 deletions

View file

@ -112,6 +112,7 @@ public class FolderActivity extends SyncthingActivity {
private TextView mVersioningDescriptionView; private TextView mVersioningDescriptionView;
private TextView mVersioningTypeView; private TextView mVersioningTypeView;
private SwitchCompat mVariableSizeBlocks; private SwitchCompat mVariableSizeBlocks;
private SwitchCompat mIgnoreDelete;
private TextView mEditIgnoreListTitle; private TextView mEditIgnoreListTitle;
private EditText mEditIgnoreListContent; private EditText mEditIgnoreListContent;
@ -177,6 +178,10 @@ public class FolderActivity extends SyncthingActivity {
mFolder.useLargeBlocks = isChecked; mFolder.useLargeBlocks = isChecked;
mFolderNeedsToUpdate = true; mFolderNeedsToUpdate = true;
break; 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); mVersioningDescriptionView = findViewById(R.id.versioningDescription);
mVersioningTypeView = findViewById(R.id.versioningType); mVersioningTypeView = findViewById(R.id.versioningType);
mVariableSizeBlocks = findViewById(R.id.variableSizeBlocks); mVariableSizeBlocks = findViewById(R.id.variableSizeBlocks);
mIgnoreDelete = findViewById(R.id.ignoreDelete);
mDevicesContainer = findViewById(R.id.devicesContainer); mDevicesContainer = findViewById(R.id.devicesContainer);
mEditIgnoreListTitle = findViewById(R.id.edit_ignore_list_title); mEditIgnoreListTitle = findViewById(R.id.edit_ignore_list_title);
mEditIgnoreListContent = findViewById(R.id.edit_ignore_list_content); mEditIgnoreListContent = findViewById(R.id.edit_ignore_list_content);
@ -458,6 +464,7 @@ public class FolderActivity extends SyncthingActivity {
mFolderPaused.setOnCheckedChangeListener(null); mFolderPaused.setOnCheckedChangeListener(null);
mCustomSyncConditionsSwitch.setOnCheckedChangeListener(null); mCustomSyncConditionsSwitch.setOnCheckedChangeListener(null);
mVariableSizeBlocks.setOnCheckedChangeListener(null); mVariableSizeBlocks.setOnCheckedChangeListener(null);
mIgnoreDelete.setOnCheckedChangeListener(null);
// Update views // Update views
mLabelView.setText(mFolder.label); mLabelView.setText(mFolder.label);
@ -468,6 +475,7 @@ public class FolderActivity extends SyncthingActivity {
mFolderFileWatcher.setChecked(mFolder.fsWatcherEnabled); mFolderFileWatcher.setChecked(mFolder.fsWatcherEnabled);
mFolderPaused.setChecked(mFolder.paused); mFolderPaused.setChecked(mFolder.paused);
mVariableSizeBlocks.setChecked(mFolder.useLargeBlocks); mVariableSizeBlocks.setChecked(mFolder.useLargeBlocks);
mIgnoreDelete.setChecked(mFolder.ignoreDelete);
findViewById(R.id.editIgnoresContainer).setVisibility(mIsCreateMode ? View.GONE : View.VISIBLE); findViewById(R.id.editIgnoresContainer).setVisibility(mIsCreateMode ? View.GONE : View.VISIBLE);
// Update views - custom sync conditions. // Update views - custom sync conditions.
@ -503,6 +511,7 @@ public class FolderActivity extends SyncthingActivity {
mFolderPaused.setOnCheckedChangeListener(mCheckedListener); mFolderPaused.setOnCheckedChangeListener(mCheckedListener);
mCustomSyncConditionsSwitch.setOnCheckedChangeListener(mCheckedListener); mCustomSyncConditionsSwitch.setOnCheckedChangeListener(mCheckedListener);
mVariableSizeBlocks.setOnCheckedChangeListener(mCheckedListener); mVariableSizeBlocks.setOnCheckedChangeListener(mCheckedListener);
mIgnoreDelete.setOnCheckedChangeListener(mCheckedListener);
} }
@Override @Override

View file

@ -436,6 +436,7 @@ public class ConfigXml {
folder.order = getContentOrDefault(r.getElementsByTagName("order").item(0), "random"); folder.order = getContentOrDefault(r.getElementsByTagName("order").item(0), "random");
folder.paused = getContentOrDefault(r.getElementsByTagName("paused").item(0), false); folder.paused = getContentOrDefault(r.getElementsByTagName("paused").item(0), false);
folder.useLargeBlocks = getContentOrDefault(r.getElementsByTagName("useLargeBlocks").item(0), true); 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); folder.copyOwnershipFromParent = getContentOrDefault(r.getElementsByTagName("copyOwnershipFromParent").item(0), false);
// Devices // Devices
@ -532,6 +533,7 @@ public class ConfigXml {
setConfigElement(r, "order", folder.order); setConfigElement(r, "order", folder.order);
setConfigElement(r, "paused", Boolean.toString(folder.paused)); setConfigElement(r, "paused", Boolean.toString(folder.paused));
setConfigElement(r, "useLargeBlocks", Boolean.toString(folder.useLargeBlocks)); setConfigElement(r, "useLargeBlocks", Boolean.toString(folder.useLargeBlocks));
setConfigElement(r, "ignoreDelete", Boolean.toString(folder.ignoreDelete));
// Update devices that share this folder. // Update devices that share this folder.
// Pass 1: Remove all devices below that folder in XML except the local device. // Pass 1: Remove all devices below that folder in XML except the local device.

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

View file

@ -314,6 +314,39 @@
</LinearLayout> </LinearLayout>
<!-- ignoreDelete -->
<LinearLayout
android:id="@+id/ignoreDeleteContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="vertical"
android:gravity="center_vertical"
android:focusable="true">
<android.support.v7.widget.SwitchCompat
android:id="@+id/ignoreDelete"
style="@style/Widget.Syncthing.TextView.Label.Details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableLeft="@drawable/ic_delete_forever_black_24"
android:drawableStart="@drawable/ic_delete_forever_black_24"
android:text="@string/folder_ignore_delete_caption" />
<TextView
android:id="@+id/ignoreDeleteDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="75dp"
android:layout_marginStart="75dp"
android:layout_marginTop="-20dp"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:text="@string/folder_ignore_delete_description"
android:focusable="false"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/editIgnoresContainer" android:id="@+id/editIgnoresContainer"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE resources [
<!ENTITY folder_ignore_delete_docs_url "https://docs.syncthing.net/advanced/folder-ignoredelete.html">
]>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">Syncthing-Fork</string> <string name="app_name">Syncthing-Fork</string>
@ -210,6 +214,10 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
<string name="folder_variable_size_blocks_caption">Variable Blockgröße</string> <string name="folder_variable_size_blocks_caption">Variable Blockgröße</string>
<string name="folder_variable_size_blocks_description">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.</string> <string name="folder_variable_size_blocks_description">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.</string>
<!-- Setting title and description -->
<string name="folder_ignore_delete_caption">Löschen ignorieren</string>
<string name="folder_ignore_delete_description">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;</string>
<!-- Setting title --> <!-- Setting title -->
<string name="folder_pause">Ordner pausieren</string> <string name="folder_pause">Ordner pausieren</string>

View file

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE resources [
<!ENTITY folder_ignore_delete_docs_url "https://docs.syncthing.net/advanced/folder-ignoredelete.html">
]>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">Syncthing-Fork</string> <string name="app_name">Syncthing-Fork</string>
@ -213,6 +217,10 @@ Please report any problems you encounter via Github.</string>
<string name="folder_variable_size_blocks_caption">Variable Size Blocks</string> <string name="folder_variable_size_blocks_caption">Variable Size Blocks</string>
<string name="folder_variable_size_blocks_description">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.</string> <string name="folder_variable_size_blocks_description">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.</string>
<!-- Setting title and description -->
<string name="folder_ignore_delete_caption">Ignore Delete</string>
<string name="folder_ignore_delete_description">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;</string>
<!-- Setting title --> <!-- Setting title -->
<string name="folder_pause">Pause Folder</string> <string name="folder_pause">Pause Folder</string>