Add various customization options

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-06-06 11:32:29 +02:00
parent 962c5bee7e
commit b530d38b07
6 changed files with 59 additions and 33 deletions

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

View file

@ -758,8 +758,10 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
* Toggle between standard menu and account list including saving the state.
*/
private void toggleAccountList() {
mIsAccountChooserActive = !mIsAccountChooserActive;
showMenu();
if (getResources().getBoolean(R.bool.allow_profile_click)) {
mIsAccountChooserActive = !mIsAccountChooserActive;
showMenu();
}
}
/**

View file

@ -43,6 +43,7 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
@ -100,9 +101,9 @@ public class Preferences extends PreferenceActivity
*/
private Uri mUri;
private CheckBoxPreference pCode;
private CheckBoxPreference fPrint;
private CheckBoxPreference mShowHiddenFiles;
private SwitchPreference pCode;
private SwitchPreference fPrint;
private SwitchPreference mShowHiddenFiles;
private Preference pAboutApp;
private AppCompatDelegate mDelegate;
@ -167,16 +168,16 @@ public class Preferences extends PreferenceActivity
// Synced folders
PreferenceCategory preferenceCategoryFolderSync = (PreferenceCategory) findPreference("folder_sync");
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
if (!getResources().getBoolean(R.bool.syncedFolder_light)) {
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
preferenceScreen.removePreference(preferenceCategoryFolderSync);
} else {
// Upload on WiFi
final ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
final Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
final CheckBoxPreference pUploadOnWifiCheckbox = (CheckBoxPreference) findPreference("synced_folder_on_wifi");
final SwitchPreference pUploadOnWifiCheckbox = (SwitchPreference) findPreference("synced_folder_on_wifi");
pUploadOnWifiCheckbox.setChecked(
arbitraryDataProvider.getBooleanValue(account, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI));
@ -211,9 +212,9 @@ public class Preferences extends PreferenceActivity
PreferenceCategory preferenceCategoryDetails = (PreferenceCategory) findPreference("details");
pCode = (CheckBoxPreference) findPreference(PassCodeActivity.PREFERENCE_SET_PASSCODE);
if (pCode != null) {
boolean fPassCodeEnabled = getResources().getBoolean(R.bool.passcode_enabled);
pCode = (SwitchPreference) findPreference(PassCodeActivity.PREFERENCE_SET_PASSCODE);
if (pCode != null && fPassCodeEnabled) {
pCode.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -232,10 +233,12 @@ public class Preferences extends PreferenceActivity
return false;
}
});
} else {
preferenceCategoryDetails.removePreference(pCode);
}
boolean fPrintEnabled = getResources().getBoolean(R.bool.fingerprint_enabled);
fPrint = (CheckBoxPreference) findPreference(FingerprintActivity.PREFERENCE_USE_FINGERPRINT);
fPrint = (SwitchPreference) findPreference(FingerprintActivity.PREFERENCE_USE_FINGERPRINT);
if (fPrint != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (FingerprintActivity.isFingerprintCapable(MainApp.getAppContext()) && fPrintEnabled) {
@ -285,18 +288,25 @@ public class Preferences extends PreferenceActivity
}
}
mShowHiddenFiles = (CheckBoxPreference) findPreference("show_hidden_files");
mShowHiddenFiles.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SharedPreferences appPrefs =
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = appPrefs.edit();
editor.putBoolean("show_hidden_files_pref", mShowHiddenFiles.isChecked());
editor.apply();
return true;
}
});
boolean fShowHiddenFilesEnabled = getResources().getBoolean(R.bool.passcode_enabled);
mShowHiddenFiles = (SwitchPreference) findPreference("show_hidden_files");
if (fShowHiddenFilesEnabled) {
mShowHiddenFiles.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SharedPreferences appPrefs =
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = appPrefs.edit();
editor.putBoolean("show_hidden_files_pref", mShowHiddenFiles.isChecked());
editor.apply();
return true;
}
});
} else {
preferenceCategoryDetails.removePreference(mShowHiddenFiles);
}
PreferenceCategory preferenceCategoryMore = (PreferenceCategory) findPreference("more");
@ -325,6 +335,10 @@ public class Preferences extends PreferenceActivity
}
}
if (!fShowHiddenFilesEnabled && !fPrintEnabled && !fPassCodeEnabled) {
preferenceScreen.removePreference(preferenceCategoryDetails);
}
boolean helpEnabled = getResources().getBoolean(R.bool.help_enabled);
Preference pHelp = findPreference("help");
if (pHelp != null) {
@ -502,7 +516,7 @@ public class Preferences extends PreferenceActivity
mPrefInstantPictureUploadOnlyOnCharging = findPreference("instant_upload_on_charging");
mPrefInstantUpload = findPreference("instant_uploading");
toggleInstantPictureOptions(((CheckBoxPreference) mPrefInstantUpload).isChecked());
toggleInstantPictureOptions(((SwitchPreference) mPrefInstantUpload).isChecked());
mPrefInstantUpload.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@ -510,7 +524,7 @@ public class Preferences extends PreferenceActivity
public boolean onPreferenceChange(Preference preference, Object newValue) {
toggleInstantPictureOptions((Boolean) newValue);
toggleInstantUploadBehaviour(
((CheckBoxPreference) mPrefInstantVideoUpload).isChecked(),
((SwitchPreference) mPrefInstantVideoUpload).isChecked(),
(Boolean) newValue);
return true;
}

View file

@ -5,7 +5,7 @@
<!-- App name and other strings-->
<string name="app_name">Nextcloud</string>
<string name="account_type">nextcloud</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
<string name="account_type">nextcloud</string> <!-- better if was a domain name; but changing it now would requ`ire migrate accounts when the app is updated -->
<string name="authority">org.nextcloud</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">com.nextcloud.android.providers.UsersAndGroupsSearchProvider</string>
<string name="users_and_groups_share_with">com.nextcloud.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
@ -84,11 +84,16 @@
<bool name="videos_enabled">false</bool>
<bool name="show_drawer_logout">false</bool>
<!-- Various other options -->
<bool name="allow_profile_click">true</bool>
<!-- Bottom toolbar -->
<bool name="bottom_toolbar_enabled">false</bool>
<!-- Help, imprint and feedback, and other things -->
<bool name="fingerprint_enabled">true</bool>
<bool name="passcode_enabled">true</bool>
<bool name="show_hidden_files_enabled">true</bool>
<bool name="davdroid_integration_enabled">true</bool>
<bool name="help_enabled">true</bool>
<string name="url_help">https://help.nextcloud.com/c/feature</string>

View file

@ -29,7 +29,7 @@
<PreferenceCategory
android:title="@string/drawer_folder_sync"
android:key="folder_sync">
<android.preference.CheckBoxPreference
<android.preference.SwitchPreference
android:title="@string/auto_upload_on_wifi"
android:key="synced_folder_on_wifi"/>
<Preference
@ -93,9 +93,9 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefs_category_details" android:key="details">
<android.preference.CheckBoxPreference android:title="@string/prefs_passcode" android:key="set_pincode" />
<android.preference.CheckBoxPreference android:title="@string/prefs_fingerprint" android:key="use_fingerprint" />
<android.preference.CheckBoxPreference android:title="@string/prefs_show_hidden_files" android:key="show_hidden_files" />
<android.preference.SwitchPreference android:title="@string/prefs_passcode" android:key="set_pincode" />
<android.preference.SwitchPreference android:title="@string/prefs_fingerprint" android:key="use_fingerprint" />
<android.preference.SwitchPreference android:title="@string/prefs_show_hidden_files" android:key="show_hidden_files" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefs_category_more" android:key="more">

View file

@ -84,12 +84,17 @@
<bool name="videos_enabled">true</bool>
<bool name="show_drawer_logout">true</bool>
<!-- Various other options -->
<bool name="allow_profile_click">false</bool>
<!-- Bottom toolbar -->
<bool name="bottom_toolbar_enabled">true</bool>
<!-- Help, imprint and feedback, and other things -->
<bool name="fingerprint_enabled">true</bool>
<bool name="davdroid_integration_enabled">true</bool>
<bool name="fingerprint_enabled">false</bool>
<bool name="passcode_enabled">false</bool>
<bool name="show_hidden_files_enabled">false</bool>
<bool name="davdroid_integration_enabled">false</bool>
<bool name="help_enabled">true</bool>
<string name="url_help">https://help.nextcloud.com/c/feature</string>
<bool name="privacy_enabled">true</bool>