aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java20
-rw-r--r--app/src/main/res/xml/preference.xml7
2 files changed, 4 insertions, 23 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
index 5fb710cf..57919624 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
@@ -183,6 +183,7 @@ public class UserPreference extends AppCompatActivity {
Preference.OnPreferenceChangeListener resetRepo = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
+ findPreference("git_delete_repo").setEnabled(!(Boolean) o);
PasswordRepository.closeRepository();
getPreferenceManager().getSharedPreferences().edit().putBoolean("repo_changed", true).apply();
return true;
@@ -233,6 +234,7 @@ public class UserPreference extends AppCompatActivity {
final SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences();
findPreference("pref_select_external").setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", "No external repository selected"));
findPreference("ssh_see_key").setEnabled(sharedPreferences.getBoolean("use_generated_key", false));
+ findPreference("git_delete_repo").setEnabled(!sharedPreferences.getBoolean("git_external", false));
// see if the autofill service is enabled and check the preference accordingly
((CheckBoxPreference) findPreference("autofill_enable"))
@@ -408,23 +410,7 @@ public class UserPreference extends AppCompatActivity {
setTitle("SD-Card root selected").
setMessage("You have selected the root of your sdcard for the store. " +
"This is extremely dangerous and you will lose your data " +
- "as its content will be deleted").
- setPositiveButton("Remove everything", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
- .edit()
- .putString("git_external_repo", uri.getPath())
- .apply();
- }
- }).
- setNegativeButton(R.string.dialog_cancel, null).show();
- } else if (new File(uri.getPath()).listFiles().length != 0) {
- new AlertDialog.Builder(this).
- setTitle("Directory not empty").
- setMessage("You have selected a non-empty directory for the store. " +
- "This is extremely dangerous and you will lose your data " +
- "as its content will be deleted").
+ "as its content will, eventually, be deleted").
setPositiveButton("Remove everything", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index f8397bc3..ae07b296 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -15,7 +15,7 @@
android:title="@string/pref_ssh_see_key_title" />
<Preference
android:key="git_delete_repo"
- android:summary="Deletes local repository"
+ android:summary="Deletes local (hidden) repository"
android:title="@string/pref_git_delete_repo" />
<CheckBoxPreference
android:key="git_external"
@@ -25,11 +25,6 @@
android:dependency="git_external"
android:key="pref_select_external"
android:title="Select external repository" />
- <CheckBoxPreference
- android:enabled="false"
- android:key="git_enabled"
- android:summary="Enable Git"
- android:title="Enable git" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_crypto_title">