aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorMohamed Zenadi <mohamed@zenadi.com>2016-04-27 23:59:34 +0200
committerMohamed Zenadi <mohamed@zenadi.com>2016-04-27 23:59:34 +0200
commitc866596d135937f768b060c24c6e7b17e49d03ee (patch)
treea5a1fb2a019fde32d2adabf83dc8dd58f854ecd7 /app/src/main/java
parent5a532cbc11b6c282c40d4b8d4307246442a710f3 (diff)
no confirmation/no deletion when using sd-card directory
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java20
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) {