1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-09 11:41:29 +00:00

Create folder dialog - trim folder label (fixes #367) (#368)

* FolderActivity: Trim folder label (fixes #367)

* Only trim if EXTRA_FOLDER_LABEL extra was set
This commit is contained in:
Catfriend1 2019-03-11 18:30:44 +01:00 committed by GitHub
parent 7a12674a88
commit b28394bc8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,7 +130,7 @@ public class FolderActivity extends SyncthingActivity {
private final TextWatcher mTextWatcher = new TextWatcherAdapter() {
@Override
public void afterTextChanged(Editable s) {
mFolder.label = mLabelView.getText().toString();
mFolder.label = mLabelView.getText().toString().trim();
mFolder.id = mIdView.getText().toString();
// mPathView must not be handled here as it's handled by {@link onActivityResult}
// mEditIgnoreListContent must not be handled here as it's written back when the dialog ends.
@ -680,6 +680,9 @@ public class FolderActivity extends SyncthingActivity {
? getIntent().getStringExtra(EXTRA_FOLDER_ID)
: generateRandomFolderId();
mFolder.label = getIntent().getStringExtra(EXTRA_FOLDER_LABEL);
if (!TextUtils.isEmpty(mFolder.label)) {
mFolder.label = mFolder.label.trim();
}
mFolder.paused = false;
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE; // Default for {@link #checkWriteAndUpdateUI}.
mFolder.minDiskFree = new Folder.MinDiskFree();