diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 20 |
1 files changed, 3 insertions, 17 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) { |