aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohamed Zenadi <mohamed@zenadi.com>2015-04-20 22:27:39 +0200
committerMohamed Zenadi <mohamed@zenadi.com>2015-05-17 18:51:28 +0200
commit994cb0272b104d5288c0d3e8c59bbb7e162044e8 (patch)
tree345a56357c7729a77e1ed76cd49bbe0ccf378119
parent6cafdcfdc03eb526b9c7016f79971a34145c8022 (diff)
directory chooser is enough
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
index e22ef382..ba322c28 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
@@ -5,7 +5,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Environment;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
@@ -112,18 +111,11 @@ public class UserPreference extends AppCompatActivity {
});
findPreference("pref_select_external").setOnPreferenceClickListener((Preference pref) -> {
- Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath());
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(selectedUri);
+ Intent intent = new Intent(callingActivity, DirectoryChooserActivity.class);
+ intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME,
+ "passwordstore");
- if (intent.resolveActivity(callingActivity.getPackageManager()) != null) {
- startActivityForResult(Intent.createChooser(intent, "Open folder"), SELECT_GIT_DIRECTORY);
- } else {
- intent = new Intent(callingActivity, DirectoryChooserActivity.class);
- intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME, "DirChooserSample");
-
- startActivityForResult(intent, SELECT_GIT_DIRECTORY);
- }
+ startActivityForResult(intent, SELECT_GIT_DIRECTORY);
return true;
});
}