diff options
author | zeapo <mohamed@zenadi.com> | 2014-10-19 22:42:07 +0200 |
---|---|---|
committer | zeapo <mohamed@zenadi.com> | 2014-10-19 22:42:07 +0200 |
commit | 7469b865b64e8e7f91a749188fc3647cdbd72322 (patch) | |
tree | 1b04c26d39b7f493885113ef72f1d4511c37f683 /app/src/main/java/com/zeapo | |
parent | 01a1522194d4b6803d88e9ac1c50e5cddd70fa05 (diff) |
users get directly onto the ssh-key selection screen rather than having to do it manually
Diffstat (limited to 'app/src/main/java/com/zeapo')
4 files changed, 15 insertions, 4 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java index c0bbfd79..8dd56364 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java @@ -651,6 +651,7 @@ public class GitHandler extends ActionBarActivity { public void onClick(DialogInterface dialog, int id) { try { Intent intent = new Intent(getApplicationContext(), UserPreference.class); + intent.putExtra("operation", "get_ssh_key"); startActivityForResult(intent, GET_SSH_KEY_FROM_CLONE); } catch (Exception e) { System.out.println("Exception caught :("); diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java index 615087c8..2c898cb4 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java @@ -82,7 +82,6 @@ public class PasswordFragment extends Fragment{ if (item.getType() == PasswordItem.TYPE_CATEGORY) { passListStack.push((ArrayList<PasswordItem>) recyclerAdapter.getValues().clone()); scrollPosition.push(recyclerView.getVerticalScrollbarPosition()); - Log.d("FRAG", scrollPosition.peek() + ""); recyclerView.scrollToPosition(0); recyclerAdapter.clear(); recyclerAdapter.addAll(PasswordRepository.getPasswords(item.getFile())); diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index fa4ee9c9..f811efea 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -41,6 +41,11 @@ public class UserPreference extends ActionBarActivity implements Preference.OnPr @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (getIntent() != null) { + if (getIntent().getStringExtra("operation").equals("get_ssh_key")) { + getSshKey(); + } + } getFragmentManager().beginTransaction() .replace(android.R.id.content, new PrefsFragment()).commit(); @@ -63,6 +68,12 @@ public class UserPreference extends ActionBarActivity implements Preference.OnPr return super.onOptionsItemSelected(item); } + public void getSshKey() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("*/*"); + startActivityForResult(intent, 1); + } + @Override public boolean onPreferenceClick(Preference pref) { if (pref.getKey().equals("openpgp_key_id")) { @@ -70,9 +81,7 @@ public class UserPreference extends ActionBarActivity implements Preference.OnPr intent.putExtra("Operation", "GET_KEY_ID"); startActivityForResult(intent, 0); } else if (pref.getKey().equals("ssh_key")) { - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.setType("*/*"); - startActivityForResult(intent, 1); + getSshKey(); } return true; } diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java index eb611995..7a6d1320 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -89,6 +89,8 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl listener.onFragmentInteraction(pass); } }); + + } // Return the size of your dataset (invoked by the layout manager) |