mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-24 02:45:55 +00:00
* Read ignore list from REST * Add write back of ignore list via REST endpoint call * Disable the edit ignore EditText when a new folder is created to preserve existing ".stignore" contents
This commit is contained in:
parent
bad36c4809
commit
19991abd0d
28 changed files with 106 additions and 164 deletions
|
@ -5,7 +5,6 @@ import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -32,6 +31,7 @@ import com.google.gson.Gson;
|
||||||
import com.nutomic.syncthingandroid.R;
|
import com.nutomic.syncthingandroid.R;
|
||||||
import com.nutomic.syncthingandroid.model.Device;
|
import com.nutomic.syncthingandroid.model.Device;
|
||||||
import com.nutomic.syncthingandroid.model.Folder;
|
import com.nutomic.syncthingandroid.model.Folder;
|
||||||
|
import com.nutomic.syncthingandroid.model.FolderIgnoreList;
|
||||||
import com.nutomic.syncthingandroid.service.Constants;
|
import com.nutomic.syncthingandroid.service.Constants;
|
||||||
import com.nutomic.syncthingandroid.service.RestApi;
|
import com.nutomic.syncthingandroid.service.RestApi;
|
||||||
import com.nutomic.syncthingandroid.service.SyncthingService;
|
import com.nutomic.syncthingandroid.service.SyncthingService;
|
||||||
|
@ -81,7 +81,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
private static final int CHOOSE_FOLDER_REQUEST = 3459;
|
private static final int CHOOSE_FOLDER_REQUEST = 3459;
|
||||||
|
|
||||||
private static final String FOLDER_MARKER_NAME = ".stfolder";
|
private static final String FOLDER_MARKER_NAME = ".stfolder";
|
||||||
private static final String IGNORE_FILE_NAME = ".stignore";
|
// private static final String IGNORE_FILE_NAME = ".stignore";
|
||||||
|
|
||||||
private Folder mFolder;
|
private Folder mFolder;
|
||||||
// Contains SAF readwrite access URI on API level >= Build.VERSION_CODES.LOLLIPOP (21)
|
// Contains SAF readwrite access URI on API level >= Build.VERSION_CODES.LOLLIPOP (21)
|
||||||
|
@ -102,7 +102,8 @@ public class FolderActivity extends SyncthingActivity
|
||||||
private TextView mPullOrderDescriptionView;
|
private TextView mPullOrderDescriptionView;
|
||||||
private TextView mVersioningDescriptionView;
|
private TextView mVersioningDescriptionView;
|
||||||
private TextView mVersioningTypeView;
|
private TextView mVersioningTypeView;
|
||||||
private TextView mEditIgnores;
|
private TextView mEditIgnoreListTitle;
|
||||||
|
private TextView mEditIgnoreListContent;
|
||||||
|
|
||||||
private boolean mIsCreateMode;
|
private boolean mIsCreateMode;
|
||||||
private boolean mFolderNeedsToUpdate = false;
|
private boolean mFolderNeedsToUpdate = false;
|
||||||
|
@ -118,6 +119,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
mFolder.label = mLabelView.getText().toString();
|
mFolder.label = mLabelView.getText().toString();
|
||||||
mFolder.id = mIdView.getText().toString();;
|
mFolder.id = mIdView.getText().toString();;
|
||||||
// mPathView must not be handled here as it's handled by {@link onActivityResult}
|
// 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.
|
||||||
mFolderNeedsToUpdate = true;
|
mFolderNeedsToUpdate = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -170,14 +172,14 @@ 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);
|
||||||
mDevicesContainer = findViewById(R.id.devicesContainer);
|
mDevicesContainer = findViewById(R.id.devicesContainer);
|
||||||
mEditIgnores = findViewById(R.id.edit_ignores);
|
mEditIgnoreListTitle = findViewById(R.id.edit_ignore_list_title);
|
||||||
|
mEditIgnoreListContent = findViewById(R.id.edit_ignore_list_content);
|
||||||
|
|
||||||
mPathView.setOnClickListener(view -> onPathViewClick());
|
mPathView.setOnClickListener(view -> onPathViewClick());
|
||||||
|
|
||||||
findViewById(R.id.folderTypeContainer).setOnClickListener(v -> showFolderTypeDialog());
|
findViewById(R.id.folderTypeContainer).setOnClickListener(v -> showFolderTypeDialog());
|
||||||
findViewById(R.id.pullOrderContainer).setOnClickListener(v -> showPullOrderDialog());
|
findViewById(R.id.pullOrderContainer).setOnClickListener(v -> showPullOrderDialog());
|
||||||
findViewById(R.id.versioningContainer).setOnClickListener(v -> showVersioningDialog());
|
findViewById(R.id.versioningContainer).setOnClickListener(v -> showVersioningDialog());
|
||||||
mEditIgnores.setOnClickListener(v -> editIgnores());
|
|
||||||
|
|
||||||
if (mIsCreateMode) {
|
if (mIsCreateMode) {
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
@ -191,7 +193,8 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
// Open keyboard on label view in edit mode.
|
// Open keyboard on label view in edit mode.
|
||||||
mLabelView.requestFocus();
|
mLabelView.requestFocus();
|
||||||
mEditIgnores.setEnabled(false);
|
mEditIgnoreListTitle.setEnabled(false);
|
||||||
|
mEditIgnoreListContent.setEnabled(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Prepare edit mode.
|
// Prepare edit mode.
|
||||||
|
@ -238,27 +241,6 @@ public class FolderActivity extends SyncthingActivity
|
||||||
startActivityForResult(intent, CHOOSE_FOLDER_REQUEST);
|
startActivityForResult(intent, CHOOSE_FOLDER_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editIgnores() {
|
|
||||||
try {
|
|
||||||
File ignoreFile = new File(mFolder.path, IGNORE_FILE_NAME);
|
|
||||||
if (!ignoreFile.exists() && !ignoreFile.createNewFile()) {
|
|
||||||
Toast.makeText(this, R.string.create_ignore_file_error, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
|
||||||
Uri uri = Uri.fromFile(ignoreFile);
|
|
||||||
intent.setDataAndType(uri, "text/plain");
|
|
||||||
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.w(TAG, e);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Log.w(TAG, e);
|
|
||||||
Toast.makeText(this, R.string.edit_ignore_file_error, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showFolderTypeDialog() {
|
private void showFolderTypeDialog() {
|
||||||
if (TextUtils.isEmpty(mFolder.path)) {
|
if (TextUtils.isEmpty(mFolder.path)) {
|
||||||
Toast.makeText(this, R.string.folder_path_required, Toast.LENGTH_LONG)
|
Toast.makeText(this, R.string.folder_path_required, Toast.LENGTH_LONG)
|
||||||
|
@ -318,15 +300,23 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
mLabelView.removeTextChangedListener(mTextWatcher);
|
mLabelView.removeTextChangedListener(mTextWatcher);
|
||||||
mIdView.removeTextChangedListener(mTextWatcher);
|
mIdView.removeTextChangedListener(mTextWatcher);
|
||||||
|
mEditIgnoreListContent.removeTextChangedListener(mTextWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
try {
|
||||||
|
// This should trigger {@link #mTextWatcher} if the element still has the focus.
|
||||||
|
mEditIgnoreListContent.clearFocus();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "onPause: mEditIgnoreListContent", e);
|
||||||
|
}
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
// We don't want to update every time a TextView's character changes,
|
// We don't want to update every time a TextView's character changes,
|
||||||
// so we hold off until the view stops being visible to the user.
|
// so we hold off until the view stops being visible to the user.
|
||||||
if (mFolderNeedsToUpdate) {
|
if (mFolderNeedsToUpdate) {
|
||||||
|
Log.v(TAG, "onPause: mFolderNeedsToUpdate == true");
|
||||||
updateFolder();
|
updateFolder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,7 +352,8 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsCreateMode) {
|
if (!mIsCreateMode) {
|
||||||
List<Folder> folders = getApi().getFolders();
|
RestApi restApi = getApi(); // restApi != null because of State.ACTIVE
|
||||||
|
List<Folder> folders = restApi.getFolders();
|
||||||
String passedId = getIntent().getStringExtra(EXTRA_FOLDER_ID);
|
String passedId = getIntent().getStringExtra(EXTRA_FOLDER_ID);
|
||||||
mFolder = null;
|
mFolder = null;
|
||||||
for (Folder currentFolder : folders) {
|
for (Folder currentFolder : folders) {
|
||||||
|
@ -376,6 +367,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
restApi.getFolderIgnoreList(mFolder.id, this::onReceiveFolderIgnoreList);
|
||||||
checkWriteAndUpdateUI();
|
checkWriteAndUpdateUI();
|
||||||
}
|
}
|
||||||
if (getIntent().hasExtra(EXTRA_DEVICE_ID)) {
|
if (getIntent().hasExtra(EXTRA_DEVICE_ID)) {
|
||||||
|
@ -388,6 +380,18 @@ public class FolderActivity extends SyncthingActivity
|
||||||
updateViewsAndSetListeners();
|
updateViewsAndSetListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onReceiveFolderIgnoreList(FolderIgnoreList folderIgnoreList) {
|
||||||
|
if (folderIgnoreList.ignore == null) {
|
||||||
|
Log.w(TAG, "onReceiveFolderIgnoreList: folderIgnoreList == null.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String ignoreList = TextUtils.join("\n", folderIgnoreList.ignore);
|
||||||
|
mEditIgnoreListContent.setMaxLines(Integer.MAX_VALUE);
|
||||||
|
mEditIgnoreListContent.removeTextChangedListener(mTextWatcher);
|
||||||
|
mEditIgnoreListContent.setText(ignoreList);
|
||||||
|
mEditIgnoreListContent.addTextChangedListener(mTextWatcher);
|
||||||
|
}
|
||||||
|
|
||||||
// If the FolderActivity gets recreated after the VersioningDialogActivity is closed, then the result from the VersioningDialogActivity will be received before
|
// If the FolderActivity gets recreated after the VersioningDialogActivity is closed, then the result from the VersioningDialogActivity will be received before
|
||||||
// the mFolder variable has been recreated, so the versioning config will be stored in the mVersioning variable until the mFolder variable has been
|
// the mFolder variable has been recreated, so the versioning config will be stored in the mVersioning variable until the mFolder variable has been
|
||||||
// recreated in the onServiceStateChange(). This has been observed to happen after the screen orientation has changed while the VersioningDialogActivity was open.
|
// recreated in the onServiceStateChange(). This has been observed to happen after the screen orientation has changed while the VersioningDialogActivity was open.
|
||||||
|
@ -568,7 +572,6 @@ public class FolderActivity extends SyncthingActivity
|
||||||
if (mCanWriteToPath) {
|
if (mCanWriteToPath) {
|
||||||
mAccessExplanationView.setText(R.string.folder_path_readwrite);
|
mAccessExplanationView.setText(R.string.folder_path_readwrite);
|
||||||
mFolderTypeView.setEnabled(true);
|
mFolderTypeView.setEnabled(true);
|
||||||
mEditIgnores.setEnabled(true);
|
|
||||||
if (mIsCreateMode) {
|
if (mIsCreateMode) {
|
||||||
/**
|
/**
|
||||||
* Suggest folder type FOLDER_TYPE_SEND_RECEIVE for folders to be created
|
* Suggest folder type FOLDER_TYPE_SEND_RECEIVE for folders to be created
|
||||||
|
@ -577,12 +580,16 @@ public class FolderActivity extends SyncthingActivity
|
||||||
* or enabled root mode thus having write access.
|
* or enabled root mode thus having write access.
|
||||||
*/
|
*/
|
||||||
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE;
|
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE;
|
||||||
|
} else {
|
||||||
|
mEditIgnoreListTitle.setEnabled(true);
|
||||||
|
mEditIgnoreListContent.setEnabled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Force "sendonly" folder.
|
// Force "sendonly" folder.
|
||||||
mAccessExplanationView.setText(R.string.folder_path_readonly);
|
mAccessExplanationView.setText(R.string.folder_path_readonly);
|
||||||
mFolderTypeView.setEnabled(false);
|
mFolderTypeView.setEnabled(false);
|
||||||
mEditIgnores.setEnabled(false);
|
mEditIgnoreListTitle.setEnabled(false);
|
||||||
|
mEditIgnoreListContent.setEnabled(false);
|
||||||
mFolder.type = Constants.FOLDER_TYPE_SEND_ONLY;
|
mFolder.type = Constants.FOLDER_TYPE_SEND_ONLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,11 +651,23 @@ public class FolderActivity extends SyncthingActivity
|
||||||
|
|
||||||
private void updateFolder() {
|
private void updateFolder() {
|
||||||
if (!mIsCreateMode) {
|
if (!mIsCreateMode) {
|
||||||
|
RestApi restApi = getApi();
|
||||||
/**
|
/**
|
||||||
* RestApi is guaranteed not to be null as {@link onServiceStateChange}
|
* RestApi is guaranteed not to be null as {@link onServiceStateChange}
|
||||||
* immediately finishes this activity if SyncthingService shuts down.
|
* immediately finishes this activity if SyncthingService shuts down.
|
||||||
*/
|
*/
|
||||||
getApi().updateFolder(mFolder);
|
/*
|
||||||
|
if (restApi == null) {
|
||||||
|
Log.e(TAG, "updateFolder: restApi == null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Update ignore list.
|
||||||
|
String[] ignore = mEditIgnoreListContent.getText().toString().split("\n");
|
||||||
|
restApi.postFolderIgnoreList(mFolder.id, ignore);
|
||||||
|
|
||||||
|
// Update model and send the config to REST endpoint.
|
||||||
|
restApi.updateFolder(mFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class GetRequest extends ApiRequest {
|
||||||
public static final String URI_VERSION = "/rest/system/version";
|
public static final String URI_VERSION = "/rest/system/version";
|
||||||
public static final String URI_SYSTEM_STATUS = "/rest/system/status";
|
public static final String URI_SYSTEM_STATUS = "/rest/system/status";
|
||||||
public static final String URI_CONNECTIONS = "/rest/system/connections";
|
public static final String URI_CONNECTIONS = "/rest/system/connections";
|
||||||
|
public static final String URI_DB_IGNORES = "/rest/db/ignores";
|
||||||
public static final String URI_DB_STATUS = "/rest/db/status";
|
public static final String URI_DB_STATUS = "/rest/db/status";
|
||||||
public static final String URI_DEVICEID = "/rest/svc/deviceid";
|
public static final String URI_DEVICEID = "/rest/svc/deviceid";
|
||||||
public static final String URI_REPORT = "/rest/svc/report";
|
public static final String URI_REPORT = "/rest/svc/report";
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.nutomic.syncthingandroid.http;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import com.android.volley.Request;
|
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class PostConfigRequest extends ApiRequest {
|
|
||||||
|
|
||||||
private static final String URI_CONFIG = "/rest/system/config";
|
|
||||||
|
|
||||||
public PostConfigRequest(Context context, URL url, String apiKey, String config,
|
|
||||||
OnSuccessListener listener) {
|
|
||||||
super(context, url, URI_CONFIG, apiKey);
|
|
||||||
Uri uri = buildUri(Collections.emptyMap());
|
|
||||||
connect(Request.Method.POST, uri, config, listener, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -13,14 +13,17 @@ import java.util.Map;
|
||||||
|
|
||||||
public class PostRequest extends ApiRequest {
|
public class PostRequest extends ApiRequest {
|
||||||
|
|
||||||
|
public static final String URI_DB_IGNORES = "/rest/db/ignores";
|
||||||
public static final String URI_DB_OVERRIDE = "/rest/db/override";
|
public static final String URI_DB_OVERRIDE = "/rest/db/override";
|
||||||
|
public static final String URI_SYSTEM_CONFIG = "/rest/system/config";
|
||||||
|
|
||||||
public PostRequest(Context context, URL url, String path, String apiKey,
|
public PostRequest(Context context, URL url, String path, String apiKey,
|
||||||
@Nullable Map<String, String> params, OnSuccessListener listener) {
|
@Nullable Map<String, String> params, @Nullable String postBody,
|
||||||
|
OnSuccessListener listener) {
|
||||||
super(context, url, path, apiKey);
|
super(context, url, path, apiKey);
|
||||||
Map<String, String> safeParams = Optional.fromNullable(params).or(Collections.emptyMap());
|
Map<String, String> safeParams = Optional.fromNullable(params).or(Collections.emptyMap());
|
||||||
Uri uri = buildUri(safeParams);
|
Uri uri = buildUri(safeParams);
|
||||||
connect(Request.Method.POST, uri, null, listener, null);
|
connect(Request.Method.POST, uri, postBody, listener, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.nutomic.syncthingandroid.model;
|
||||||
|
|
||||||
|
public class FolderIgnoreList {
|
||||||
|
public String[] expanded;
|
||||||
|
public String[] ignore;
|
||||||
|
}
|
|
@ -21,7 +21,6 @@ import com.nutomic.syncthingandroid.SyncthingApp;
|
||||||
import com.nutomic.syncthingandroid.activities.ShareActivity;
|
import com.nutomic.syncthingandroid.activities.ShareActivity;
|
||||||
import com.nutomic.syncthingandroid.http.GetRequest;
|
import com.nutomic.syncthingandroid.http.GetRequest;
|
||||||
import com.nutomic.syncthingandroid.http.PostRequest;
|
import com.nutomic.syncthingandroid.http.PostRequest;
|
||||||
import com.nutomic.syncthingandroid.http.PostConfigRequest;
|
|
||||||
import com.nutomic.syncthingandroid.model.Config;
|
import com.nutomic.syncthingandroid.model.Config;
|
||||||
import com.nutomic.syncthingandroid.model.Completion;
|
import com.nutomic.syncthingandroid.model.Completion;
|
||||||
import com.nutomic.syncthingandroid.model.CompletionInfo;
|
import com.nutomic.syncthingandroid.model.CompletionInfo;
|
||||||
|
@ -29,6 +28,7 @@ import com.nutomic.syncthingandroid.model.Connections;
|
||||||
import com.nutomic.syncthingandroid.model.Device;
|
import com.nutomic.syncthingandroid.model.Device;
|
||||||
import com.nutomic.syncthingandroid.model.Event;
|
import com.nutomic.syncthingandroid.model.Event;
|
||||||
import com.nutomic.syncthingandroid.model.Folder;
|
import com.nutomic.syncthingandroid.model.Folder;
|
||||||
|
import com.nutomic.syncthingandroid.model.FolderIgnoreList;
|
||||||
import com.nutomic.syncthingandroid.model.FolderStatus;
|
import com.nutomic.syncthingandroid.model.FolderStatus;
|
||||||
import com.nutomic.syncthingandroid.model.Options;
|
import com.nutomic.syncthingandroid.model.Options;
|
||||||
import com.nutomic.syncthingandroid.model.SystemStatus;
|
import com.nutomic.syncthingandroid.model.SystemStatus;
|
||||||
|
@ -299,7 +299,7 @@ public class RestApi {
|
||||||
public void overrideChanges(String folderId) {
|
public void overrideChanges(String folderId) {
|
||||||
Log.d(TAG, "overrideChanges '" + folderId + "'");
|
Log.d(TAG, "overrideChanges '" + folderId + "'");
|
||||||
new PostRequest(mContext, mUrl, PostRequest.URI_DB_OVERRIDE, mApiKey,
|
new PostRequest(mContext, mUrl, PostRequest.URI_DB_OVERRIDE, mApiKey,
|
||||||
ImmutableMap.of("folder", folderId), null);
|
ImmutableMap.of("folder", folderId), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,7 +312,8 @@ public class RestApi {
|
||||||
synchronized (mConfigLock) {
|
synchronized (mConfigLock) {
|
||||||
jsonConfig = new Gson().toJson(mConfig);
|
jsonConfig = new Gson().toJson(mConfig);
|
||||||
}
|
}
|
||||||
new PostConfigRequest(mContext, mUrl, mApiKey, jsonConfig, null);
|
new PostRequest(mContext, mUrl, PostRequest.URI_SYSTEM_CONFIG, mApiKey,
|
||||||
|
null, jsonConfig, null);
|
||||||
mOnConfigChangedListener.onConfigChanged();
|
mOnConfigChangedListener.onConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +325,8 @@ public class RestApi {
|
||||||
synchronized (mConfigLock) {
|
synchronized (mConfigLock) {
|
||||||
jsonConfig = new Gson().toJson(mConfig);
|
jsonConfig = new Gson().toJson(mConfig);
|
||||||
}
|
}
|
||||||
new PostConfigRequest(mContext, mUrl, mApiKey, jsonConfig, result -> {
|
new PostRequest(mContext, mUrl, PostRequest.URI_SYSTEM_CONFIG, mApiKey,
|
||||||
|
null, jsonConfig, result -> {
|
||||||
Intent intent = new Intent(mContext, SyncthingService.class)
|
Intent intent = new Intent(mContext, SyncthingService.class)
|
||||||
.setAction(SyncthingService.ACTION_RESTART);
|
.setAction(SyncthingService.ACTION_RESTART);
|
||||||
mContext.startService(intent);
|
mContext.startService(intent);
|
||||||
|
@ -513,6 +515,27 @@ public class RestApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests ignore list for given folder.
|
||||||
|
*/
|
||||||
|
public void getFolderIgnoreList(String folderId, OnResultListener1<FolderIgnoreList> listener) {
|
||||||
|
new GetRequest(mContext, mUrl, GetRequest.URI_DB_IGNORES, mApiKey,
|
||||||
|
ImmutableMap.of("folder", folderId), result -> {
|
||||||
|
FolderIgnoreList folderIgnoreList = new Gson().fromJson(result, FolderIgnoreList.class);
|
||||||
|
listener.onResult(folderIgnoreList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Posts ignore list for given folder.
|
||||||
|
*/
|
||||||
|
public void postFolderIgnoreList(String folderId, String[] ignore) {
|
||||||
|
FolderIgnoreList folderIgnoreList = new FolderIgnoreList();
|
||||||
|
folderIgnoreList.ignore = ignore;
|
||||||
|
new PostRequest(mContext, mUrl, PostRequest.URI_DB_IGNORES, mApiKey,
|
||||||
|
ImmutableMap.of("folder", folderId), new Gson().toJson(folderIgnoreList), null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests and parses system version information.
|
* Requests and parses system version information.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -222,7 +222,7 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/edit_ignores"
|
android:id="@+id/edit_ignore_list_title"
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
@ -232,6 +232,21 @@
|
||||||
android:drawableStart="@drawable/ic_visibility_off_black_24dp"
|
android:drawableStart="@drawable/ic_visibility_off_black_24dp"
|
||||||
android:text="@string/ignore_patterns"/>
|
android:text="@string/ignore_patterns"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_ignore_list_content"
|
||||||
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:gravity="top|start"
|
||||||
|
android:hint="@string/ignore_patterns"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="55dp"
|
||||||
|
android:layout_marginStart="55dp"
|
||||||
|
android:layout_marginTop="-20dp"
|
||||||
|
android:minLines="5"
|
||||||
|
android:maxLines="100"
|
||||||
|
android:scrollbars="none"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -172,11 +172,6 @@ Ens podeu informar dels problemes que trobeu a través de Github.</string>
|
||||||
<string name="dialog_discard_changes">Voleu descartar els canvis?</string>
|
<string name="dialog_discard_changes">Voleu descartar els canvis?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Patrons a ignorar</string>
|
<string name="ignore_patterns">Patrons a ignorar</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">No s\'ha pogut crear el fitxer d\'ignorats. Es pot escriure al directori?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">No hi ha cap editor de text</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,6 @@ Všechny zaznamenané chyby prosím hlašte přes Github.</string>
|
||||||
<string name="dialog_discard_changes">Zrušit změny?</string>
|
<string name="dialog_discard_changes">Zrušit změny?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignorované vzory</string>
|
<string name="ignore_patterns">Ignorované vzory</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Vytvoření souboru s ignorovanými vzory selhalo. Umožňuje složka zápis?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nenalezen žádný textový editor</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -159,11 +159,6 @@ Vær venlig at rapportere ethvert problem, du støder på, via Github. </string>
|
||||||
<string name="dialog_discard_changes">Slet dine ændringer?</string>
|
<string name="dialog_discard_changes">Slet dine ændringer?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignorer-mønstre</string>
|
<string name="ignore_patterns">Ignorer-mønstre</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Kunne ikke danne ignorer-filen. Er mappen skrivebeskyttet?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Intet tekstbehandlingsprogram blev fundet</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -223,11 +223,6 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
|
||||||
<string name="toast_invalid_folder_selected">Entschuldigung. Der ausgewählte Ordner kann nicht verwendet werden. Bitte wähle einen Ordner auf dem internen oder externen Speicher aus.</string>
|
<string name="toast_invalid_folder_selected">Entschuldigung. Der ausgewählte Ordner kann nicht verwendet werden. Bitte wähle einen Ordner auf dem internen oder externen Speicher aus.</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ausschluss Muster</string>
|
<string name="ignore_patterns">Ausschluss Muster</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Erstellen der ignore Datei fehlgeschlagen. Kann ins Verzeichnis geschrieben werden?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Texteditor nicht gefunden</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -159,11 +159,6 @@
|
||||||
<string name="dialog_discard_changes">Να απορριφθούν οι αλλαγές που κάνατε;</string>
|
<string name="dialog_discard_changes">Να απορριφθούν οι αλλαγές που κάνατε;</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Πρότυπα για αγνόηση</string>
|
<string name="ignore_patterns">Πρότυπα για αγνόηση</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Αδυναμία δημιουργίας αρχείου προτύπων αγνόησης. Υπάρχει δικαίωμα εγγραφής στον κατάλογο;</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Δεν βρέθηκε επεξεργαστής κειμένου</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,11 +174,6 @@ S\'il vous plaît, soumettez les problèmes que vous rencontrez via Github.</str
|
||||||
<string name="dialog_discard_changes">Annuler vos modifications ?</string>
|
<string name="dialog_discard_changes">Annuler vos modifications ?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignorer les exclusions</string>
|
<string name="ignore_patterns">Ignorer les exclusions</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Création de fichier échoué, fichier ignoré. Le répertoire est-il accessible en écriture ?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Editeur de texte non trouvé</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,11 +178,6 @@ Néhány eszközön extra alkalmazás-leállító alkalmazást telepített fel a
|
||||||
<string name="dialog_discard_changes">Elveted a módosításaidat?</string>
|
<string name="dialog_discard_changes">Elveted a módosításaidat?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Kihagyási minták</string>
|
<string name="ignore_patterns">Kihagyási minták</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Nem sikerült létrehozni a kihagyási fájlt. Írható a könyvtár?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nem található szövegszerkesztő</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,11 +153,6 @@ Jika ada masalah silakan laporkan lewat Github.</string>
|
||||||
<string name="dialog_discard_changes">Abaikan perubahan anda?</string>
|
<string name="dialog_discard_changes">Abaikan perubahan anda?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Pola pengabaian</string>
|
<string name="ignore_patterns">Pola pengabaian</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Gagal membuat berkas ignore. Apakah direktori bisa ditulisi?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Tidak ada editor teks yang ditemukan</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,11 +174,6 @@ Si prega di segnalare eventuali problemi che si incontrano via Github.</string>
|
||||||
<string name="dialog_discard_changes">Annullare le modifiche?</string>
|
<string name="dialog_discard_changes">Annullare le modifiche?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Schemi Esclusione File</string>
|
<string name="ignore_patterns">Schemi Esclusione File</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Impossibile creare il file delle esclusioni. La directory è scrivibile?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nessun editor di testo trovato</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,11 +160,6 @@
|
||||||
<string name="dialog_discard_changes">変更を破棄しますか?</string>
|
<string name="dialog_discard_changes">変更を破棄しますか?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">無視するパターン</string>
|
<string name="ignore_patterns">無視するパターン</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">無視ファイルの作成に失敗しました。ディレクトリは書き込み可能ですか?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">テキストエディタが見つかりません</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -158,11 +158,6 @@
|
||||||
<string name="dialog_discard_changes">설정 변경을 취소합니까?</string>
|
<string name="dialog_discard_changes">설정 변경을 취소합니까?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">패턴 무시하기</string>
|
<string name="ignore_patterns">패턴 무시하기</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">무시 파일을 만들지 못했습니다. 디렉토리가 쓰기 가능합니까?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">텍스트 편집기를 찾을 수 없습니다</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,11 +174,6 @@ Als je problemen tegenkomt, meld ze dan via GitHub.</string>
|
||||||
<string name="dialog_discard_changes">Wijzigingen verwerpen?</string>
|
<string name="dialog_discard_changes">Wijzigingen verwerpen?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Patronen negeren</string>
|
<string name="ignore_patterns">Patronen negeren</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Aanmaken van ignore-bestand mislukt. Is de map schrijfbaar?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Geen tekstverwerker gevonden</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,6 @@ Proszę zgłaszać napotkane błędy programu za pośrednictwem serwisu Github.<
|
||||||
<string name="dialog_discard_changes">Porzucić zmiany?</string>
|
<string name="dialog_discard_changes">Porzucić zmiany?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Wzorce ignorowania</string>
|
<string name="ignore_patterns">Wzorce ignorowania</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Nie powiodło się tworzenie pliku ze wzorcami ignorowania. Czy do folderu można zapisywać?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nie znaleziono edytora tekstu</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,11 +174,6 @@ Por favor, nos avise sobre quaisquer problemas que você encontrar via Github.</
|
||||||
<string name="dialog_discard_changes">Descartar as alterações?</string>
|
<string name="dialog_discard_changes">Descartar as alterações?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Filtros</string>
|
<string name="ignore_patterns">Filtros</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Não foi possível criar o arquivo de filtros. Este diretório tem permissões de escrita?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nenhum editor de texto foi encontrado</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,11 +192,6 @@ Vă rugăm să raportați orice problemă întâlniți, prin intermediul GitHub.
|
||||||
<string name="toast_invalid_folder_selected">Ne pare rău. Directorul selectat nu poate fi folosit. Vă rugăm să alegeți un director localizat pe stocarea internă sau externă.</string>
|
<string name="toast_invalid_folder_selected">Ne pare rău. Directorul selectat nu poate fi folosit. Vă rugăm să alegeți un director localizat pe stocarea internă sau externă.</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignoră șabloane</string>
|
<string name="ignore_patterns">Ignoră șabloane</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Nu s-a putut crea fișierul de ignorare. Se poate scrie în director?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Nu s-a găsit nici un editor de text</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -176,11 +176,6 @@
|
||||||
<string name="dialog_discard_changes">Отменить внесённые изменения?</string>
|
<string name="dialog_discard_changes">Отменить внесённые изменения?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Шаблоны игнорирования</string>
|
<string name="ignore_patterns">Шаблоны игнорирования</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Ошибка при попытке создания файла с шаблонами игнорирования. У папки есть право на запись?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Текстовый редактор не найден</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,11 +191,6 @@ Vänligen rapportera eventuella problem du stöter på via Github.</string>
|
||||||
<string name="toast_invalid_folder_selected">Tyvärr. Den valda mappen kan inte användas. Välj en mapp som finns på intern eller extern lagring.</string>
|
<string name="toast_invalid_folder_selected">Tyvärr. Den valda mappen kan inte användas. Välj en mapp som finns på intern eller extern lagring.</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignorera mönster</string>
|
<string name="ignore_patterns">Ignorera mönster</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Misslyckades med att skapa ignorera-fil. Är katalogen skrivbar?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Ingen textredigerare hittades</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,6 @@
|
||||||
<string name="dialog_discard_changes">Скасувати зміни?</string>
|
<string name="dialog_discard_changes">Скасувати зміни?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ігнорувати паттерни</string>
|
<string name="ignore_patterns">Ігнорувати паттерни</string>
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">Текстові редактори не знайдено</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -162,11 +162,6 @@
|
||||||
<string name="dialog_discard_changes">放弃所做的更改?</string>
|
<string name="dialog_discard_changes">放弃所做的更改?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">忽略列表</string>
|
<string name="ignore_patterns">忽略列表</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">创建忽略文件失败。文件夹可写吗?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">未找到文本编辑器</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -158,11 +158,6 @@
|
||||||
<string name="dialog_discard_changes">放棄變更?</string>
|
<string name="dialog_discard_changes">放棄變更?</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">忽略樣式</string>
|
<string name="ignore_patterns">忽略樣式</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">無法建立忽略檔案。資料夾是可寫入的?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">找不到文字編輯器</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -223,11 +223,6 @@ Please report any problems you encounter via Github.</string>
|
||||||
<string name="toast_invalid_folder_selected">Sorry. The selected folder cannot be used. Please select a folder located on the internal or external storage.</string>
|
<string name="toast_invalid_folder_selected">Sorry. The selected folder cannot be used. Please select a folder located on the internal or external storage.</string>
|
||||||
|
|
||||||
<string name="ignore_patterns">Ignore Patterns</string>
|
<string name="ignore_patterns">Ignore Patterns</string>
|
||||||
|
|
||||||
<string name="create_ignore_file_error">Failed to create ignore file. Is the directory writable?</string>
|
|
||||||
|
|
||||||
<string name="edit_ignore_file_error">No text editor found</string>
|
|
||||||
|
|
||||||
<!-- DeviceActivity -->
|
<!-- DeviceActivity -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue