force the selection of directory until the welcome screen is implemented
This commit is contained in:
parent
4e5c64913d
commit
4975dfdcfa
2 changed files with 26 additions and 12 deletions
|
@ -50,16 +50,19 @@ public class PasswordStore extends ActionBarActivity {
|
|||
File dir = null;
|
||||
|
||||
if (settings.getBoolean("git_external", false)) {
|
||||
if (settings.getString("git_external_repo", null) == null)
|
||||
{
|
||||
// todo: show the main screen
|
||||
} else {
|
||||
if (settings.getString("git_external_repo", null) != null) {
|
||||
dir = new File(settings.getString("git_external_repo", null));
|
||||
}
|
||||
} else {
|
||||
dir = new File(getFilesDir() + "/store");
|
||||
}
|
||||
assert dir != null;
|
||||
// temp for debug
|
||||
if (dir == null) {
|
||||
Intent intent = new Intent(this, UserPreference.class);
|
||||
intent.putExtra("operation", "git_external");
|
||||
startActivity(intent);
|
||||
return;
|
||||
}
|
||||
|
||||
// uninitialize the repo if the dir does not exist or is absolutely empty
|
||||
if (!dir.exists() || !dir.isDirectory()) {
|
||||
|
|
|
@ -111,11 +111,7 @@ public class UserPreference extends AppCompatActivity {
|
|||
});
|
||||
|
||||
findPreference("pref_select_external").setOnPreferenceClickListener((Preference pref) -> {
|
||||
Intent intent = new Intent(callingActivity, DirectoryChooserActivity.class);
|
||||
intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME,
|
||||
"passwordstore");
|
||||
|
||||
startActivityForResult(intent, SELECT_GIT_DIRECTORY);
|
||||
callingActivity.selectExternalGitRepository();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -125,8 +121,15 @@ public class UserPreference extends AppCompatActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getIntent() != null) {
|
||||
if ((getIntent().getStringExtra("operation") != null) && (getIntent().getStringExtra("operation").equals("get_ssh_key"))) {
|
||||
getSshKey();
|
||||
if (getIntent().getStringExtra("operation") != null) {
|
||||
switch (getIntent().getStringExtra("operation")) {
|
||||
case "get_ssh_key":
|
||||
getSshKey();
|
||||
break;
|
||||
case "git_external":
|
||||
selectExternalGitRepository();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,6 +139,14 @@ public class UserPreference extends AppCompatActivity {
|
|||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
public void selectExternalGitRepository() {
|
||||
Intent intent = new Intent(this, DirectoryChooserActivity.class);
|
||||
intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME,
|
||||
"passwordstore");
|
||||
|
||||
startActivityForResult(intent, SELECT_GIT_DIRECTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
|
|
Loading…
Reference in a new issue