aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2015-11-22 14:30:37 +0100
committerzeapo <mohamed@zenadi.com>2015-11-22 14:30:37 +0100
commit5d6d349e6242f49aa5bf71aef96da8dfe92a65db (patch)
tree85481aba2f4f55710d93bbd87d97d8ade962ea90
parent5b3cc540e413395dc4771d810058fcd467efab4c (diff)
warn if the directory is not empty
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
index 6ffc7abc..dd743b64 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
@@ -401,7 +401,23 @@ public class UserPreference extends AppCompatActivity {
new AlertDialog.Builder(this).
setTitle("SD-Card root selected").
setMessage("You have selected the root of your sdcard for the store. " +
- "This is extremly dangerous and you will lose your data " +
+ "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").
setPositiveButton("Remove everything", new DialogInterface.OnClickListener() {
@Override