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;
|
File dir = null;
|
||||||
|
|
||||||
if (settings.getBoolean("git_external", false)) {
|
if (settings.getBoolean("git_external", false)) {
|
||||||
if (settings.getString("git_external_repo", null) == null)
|
if (settings.getString("git_external_repo", null) != null) {
|
||||||
{
|
|
||||||
// todo: show the main screen
|
|
||||||
} else {
|
|
||||||
dir = new File(settings.getString("git_external_repo", null));
|
dir = new File(settings.getString("git_external_repo", null));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dir = new File(getFilesDir() + "/store");
|
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
|
// uninitialize the repo if the dir does not exist or is absolutely empty
|
||||||
if (!dir.exists() || !dir.isDirectory()) {
|
if (!dir.exists() || !dir.isDirectory()) {
|
||||||
|
|
|
@ -111,11 +111,7 @@ public class UserPreference extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
findPreference("pref_select_external").setOnPreferenceClickListener((Preference pref) -> {
|
findPreference("pref_select_external").setOnPreferenceClickListener((Preference pref) -> {
|
||||||
Intent intent = new Intent(callingActivity, DirectoryChooserActivity.class);
|
callingActivity.selectExternalGitRepository();
|
||||||
intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME,
|
|
||||||
"passwordstore");
|
|
||||||
|
|
||||||
startActivityForResult(intent, SELECT_GIT_DIRECTORY);
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -125,8 +121,15 @@ public class UserPreference extends AppCompatActivity {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getIntent() != null) {
|
if (getIntent() != null) {
|
||||||
if ((getIntent().getStringExtra("operation") != null) && (getIntent().getStringExtra("operation").equals("get_ssh_key"))) {
|
if (getIntent().getStringExtra("operation") != null) {
|
||||||
getSshKey();
|
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);
|
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
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue