Support Variable Size Blocks (VSB) (#1270)

* Support Variable Size Blocks (VSB) (fixes #153) (#156)

* ConfigXml/Folder - Add "useLargeBlocks"

* Update folder model defaults

* UI for Variable Size Blocks (VBS) (fixes #153)

* Prepare model/Folder for Syncthing 1.0.1
This commit is contained in:
Catfriend1 2019-02-12 23:21:39 +01:00 committed by Audrius Butkevicius
parent 94c94b4216
commit a7e6fb9118
9 changed files with 46 additions and 1 deletions

View File

@ -103,6 +103,7 @@ public class FolderActivity extends SyncthingActivity
private TextView mVersioningDescriptionView;
private TextView mVersioningTypeView;
private TextView mEditIgnores;
private SwitchCompat mVariableSizeBlocks;
private boolean mIsCreateMode;
private boolean mFolderNeedsToUpdate = false;
@ -144,6 +145,10 @@ public class FolderActivity extends SyncthingActivity
}
mFolderNeedsToUpdate = true;
break;
case R.id.variableSizeBlocks:
mFolder.useLargeBlocks = isChecked;
mFolderNeedsToUpdate = true;
break;
}
}
};
@ -169,6 +174,7 @@ public class FolderActivity extends SyncthingActivity
mPullOrderDescriptionView = findViewById(R.id.pullOrderDescription);
mVersioningDescriptionView = findViewById(R.id.versioningDescription);
mVersioningTypeView = findViewById(R.id.versioningType);
mVariableSizeBlocks = findViewById(R.id.variableSizeBlocks);
mDevicesContainer = findViewById(R.id.devicesContainer);
mEditIgnores = findViewById(R.id.edit_ignores);
@ -409,6 +415,7 @@ public class FolderActivity extends SyncthingActivity
mIdView.removeTextChangedListener(mTextWatcher);
mFolderFileWatcher.setOnCheckedChangeListener(null);
mFolderPaused.setOnCheckedChangeListener(null);
mVariableSizeBlocks.setOnCheckedChangeListener(null);
// Update views
mLabelView.setText(mFolder.label);
@ -418,6 +425,7 @@ public class FolderActivity extends SyncthingActivity
updateVersioningDescription();
mFolderFileWatcher.setChecked(mFolder.fsWatcherEnabled);
mFolderPaused.setChecked(mFolder.paused);
mVariableSizeBlocks.setChecked(mFolder.useLargeBlocks);
List<Device> devicesList = getApi().getDevices(false);
mDevicesContainer.removeAllViews();
@ -434,6 +442,7 @@ public class FolderActivity extends SyncthingActivity
mIdView.addTextChangedListener(mTextWatcher);
mFolderFileWatcher.setOnCheckedChangeListener(mCheckedListener);
mFolderPaused.setOnCheckedChangeListener(mCheckedListener);
mVariableSizeBlocks.setOnCheckedChangeListener(mCheckedListener);
}
@Override

View File

@ -37,7 +37,7 @@ public class Folder {
public boolean disableSparseFiles;
public boolean disableTempIndexes;
public boolean paused;
public boolean useLargeBlocks;
public boolean useLargeBlocks = true;
public int weakHashThresholdPct = 25;
public String markerName = ".stfolder";
public String invalid;

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

View File

@ -221,6 +221,38 @@
android:layout_marginStart="75dp"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
</LinearLayout>
<!-- variableSizeBlocks -->
<android.support.v7.widget.SwitchCompat
android:id="@+id/variableSizeBlocks"
style="@style/Widget.Syncthing.TextView.Label.Details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:drawableLeft="@drawable/ic_developer_board_black_24dp"
android:drawableStart="@drawable/ic_developer_board_black_24dp"
android:text="@string/folder_variable_size_blocks_caption" />
<TextView
android:id="@+id/variableSizeBlocksDescription"
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_variable_size_blocks_description"
android:focusable="false"/>
<LinearLayout
android:id="@+id/editIgnoresContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="vertical"
android:gravity="center_vertical">
<TextView
android:id="@+id/edit_ignores"
style="@style/Widget.Syncthing.TextView.Label.Details"

View File

@ -184,6 +184,10 @@ Please report any problems you encounter via Github.</string>
<string name="folder_fileWatcher">Watch for changes</string>
<string name="folder_fileWatcherDescription">Asks operating system to notify about changes to files. If disabled falls back to periodic hourly scans.</string>
<!-- Setting title and description -->
<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>
<!-- Setting title -->
<string name="folder_pause">Pause Folder</string>