1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-02-09 18:44:43 +00:00

Add pref to enable expert mode (fixes #256) (#328)

* Add prefs: verbose_log, expert_mode

* Update prefs in Constants

* Add service.AppPrefs

* Update fragments to read verbose log pref

* Update classes with context or inject to read verbose log pref

* Inherit ENABLE_VERBOSE_LOG from RestApi to Completion

* Restart whole app if verbose log pref was changed

* A line too much

* Revert expert mode pref (DELTA REVERT)

* Add expert mode pref (ref #256)

* Make ignoreDelete an expert option

* Make pullOrder and ignoreDelete expert options

* Make deviceCompression an expert option

* Import de translation
This commit is contained in:
Catfriend1 2019-03-09 16:15:37 +01:00 committed by GitHub
parent dbe7838266
commit def8773dbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 1 deletions

View file

@ -276,6 +276,10 @@ public class DeviceActivity extends SyncthingActivity {
getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN);
mNameView.requestFocus();
}
// Show expert options conditionally.
Boolean prefExpertMode = mPreferences.getBoolean(Constants.PREF_EXPERT_MODE, false);
mCompressionContainer.setVisibility(prefExpertMode ? View.VISIBLE : View.GONE);
}
private void restoreDialogStates(Bundle savedInstanceState) {

View file

@ -107,11 +107,13 @@ public class FolderActivity extends SyncthingActivity {
private SwitchCompat mCustomSyncConditionsSwitch;
private TextView mCustomSyncConditionsDescription;
private TextView mCustomSyncConditionsDialog;
private ViewGroup mPullOrderContainer;
private TextView mPullOrderTypeView;
private TextView mPullOrderDescriptionView;
private TextView mVersioningDescriptionView;
private TextView mVersioningTypeView;
private SwitchCompat mVariableSizeBlocks;
private ViewGroup mIgnoreDeleteContainer;
private SwitchCompat mIgnoreDelete;
private TextView mEditIgnoreListTitle;
private EditText mEditIgnoreListContent;
@ -208,11 +210,13 @@ public class FolderActivity extends SyncthingActivity {
mCustomSyncConditionsSwitch = findViewById(R.id.customSyncConditionsSwitch);
mCustomSyncConditionsDescription = findViewById(R.id.customSyncConditionsDescription);
mCustomSyncConditionsDialog = findViewById(R.id.customSyncConditionsDialog);
mPullOrderContainer = findViewById(R.id.pullOrderContainer);
mPullOrderTypeView = findViewById(R.id.pullOrderType);
mPullOrderDescriptionView = findViewById(R.id.pullOrderDescription);
mVersioningDescriptionView = findViewById(R.id.versioningDescription);
mVersioningTypeView = findViewById(R.id.versioningType);
mVariableSizeBlocks = findViewById(R.id.variableSizeBlocks);
mIgnoreDeleteContainer = findViewById(R.id.ignoreDeleteContainer);
mIgnoreDelete = findViewById(R.id.ignoreDelete);
mDevicesContainer = findViewById(R.id.devicesContainer);
mEditIgnoreListTitle = findViewById(R.id.edit_ignore_list_title);
@ -222,7 +226,7 @@ public class FolderActivity extends SyncthingActivity {
mCustomSyncConditionsDialog.setOnClickListener(view -> onCustomSyncConditionsDialogClick());
findViewById(R.id.folderTypeContainer).setOnClickListener(v -> showFolderTypeDialog());
findViewById(R.id.pullOrderContainer).setOnClickListener(v -> showPullOrderDialog());
mPullOrderContainer.setOnClickListener(v -> showPullOrderDialog());
findViewById(R.id.versioningContainer).setOnClickListener(v -> showVersioningDialog());
if (savedInstanceState != null) {
@ -282,6 +286,11 @@ public class FolderActivity extends SyncthingActivity {
checkWriteAndUpdateUI();
updateViewsAndSetListeners();
// Show expert options conditionally.
Boolean prefExpertMode = mPreferences.getBoolean(Constants.PREF_EXPERT_MODE, false);
mPullOrderContainer.setVisibility(prefExpertMode ? View.VISIBLE : View.GONE);
mIgnoreDeleteContainer.setVisibility(prefExpertMode ? View.VISIBLE : View.GONE);
// Open keyboard on label view in edit mode.
mLabelView.requestFocus();
}

View file

@ -33,6 +33,8 @@ public class Constants {
public static final String PREF_SUGGEST_NEW_FOLDER_ROOT_DATA = "external_android_data";
public static final String PREF_SUGGEST_NEW_FOLDER_ROOT_MEDIA = "external_android_media";
public static final String PREF_EXPERT_MODE = "expert_mode";
// Preferences - Troubleshooting
public static final String PREF_VERBOSE_LOG = "verbose_log";
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";

View file

@ -465,6 +465,10 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
<item>[Ext_Speicher]/Android/media</item>
</string-array>
<string name="expert_mode_title">Expertenmodus</string>
<string name="expert_mode_summary">Durch Aktivieren dieser Option werden erweiterte Konfigurationsoptionen angezeigt. Du solltest Dir zuerst die Syncthing-Dokumentation ansehen, um sicherzustellen, dass Du weißt, wie sie richtig verwendet werden. Falsche Einstellungen können zu hohem Batterieverbrauch, Erschöpfung der Systemressourcen oder unvollständiger Synchronisation führen.</string>
<string name="preference_language_title">Sprache</string>
<string name="preference_language_summary">Anwendungssprache ändern</string>

View file

@ -468,6 +468,10 @@ Please report any problems you encounter via Github.</string>
<item>[external_storage]/Android/media</item>
</string-array>
<string name="expert_mode_title">Expert mode</string>
<string name="expert_mode_summary">Enabling this option will show advanced configuration options. You should have a look at the Syncthing Docs first to make sure you know how to use them correctly. Incorrect settings may cause battery drain, system resource exhaust or incomplete synchronization.</string>
<string name="preference_language_title">Language</string>
<string name="preference_language_summary">Change the app language</string>

View file

@ -100,6 +100,13 @@
android:summary="@null"
android:defaultValue="external_android_data" />
<!-- Expert mode -->
<CheckBoxPreference
android:key="expert_mode"
android:title="@string/expert_mode_title"
android:summary="@string/expert_mode_summary"
android:defaultValue="false" />
<ListPreference
android:key="pref_current_language"
android:title="@string/preference_language_title"