diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-03 15:45:21 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-03 15:45:21 +0200 |
commit | 270c7ffa1fb3c796449eac832e6d4795b6e40fd3 (patch) | |
tree | aa90aa34fe5d294eaa19954c5222841bae3c06ed /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java | |
parent | 098823bd525bdbf215060dba1ed248af853bbfac (diff) | |
parent | 34fca975d764cfdda61ae30c31fbb0ce81807df6 (diff) | |
download | open-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.tar.gz open-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.tar.bz2 open-keychain-270c7ffa1fb3c796449eac832e6d4795b6e40fd3.zip |
Merge branch 'db-overhaul' of git://github.com/Valodim/openpgp-keychain into Valodim-db-overhaul
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java index f0704bb0f..514951385 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java @@ -40,8 +40,6 @@ import org.sufficientlysecure.keychain.provider.KeychainContract; public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> { - private static final int REQUEST_CODE_SELECT_KEY = 0x00008882; - private TextView mKeyUserId; private TextView mKeyUserIdRest; private TextView mKeyMasterKeyIdHex; @@ -53,12 +51,18 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan private SelectSecretKeyCallback mCallback; - private static final String[] PROJECTION = new String[] { - KeychainContract.UserIds.USER_ID, - KeychainContract.KeyRings.MASTER_KEY_ID, + private static final int REQUEST_CODE_SELECT_KEY = 8882; + + private static final int LOADER_ID = 0; + + //The Projection we will retrieve, Master Key ID is for convenience sake, + //to avoid having to pass the Key Around + final String[] PROJECTION = new String[] { + KeychainContract.Keys.MASTER_KEY_ID, + KeychainContract.UserIds.USER_ID }; - private static final int INDEX_USER_ID = 0; - private static final int INDEX_MASTER_KEY_ID = 1; + final int INDEX_MASTER_KEY_ID = 0; + final int INDEX_USER_ID = 1; public interface SelectSecretKeyCallback { void onKeySelected(long secretKeyId); @@ -80,6 +84,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan } public void setSelectedKeyData(String userName, String email, String masterKeyHex) { + mNoKeySelected.setVisibility(View.GONE); mKeyUserId.setText(userName); @@ -89,6 +94,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan mKeyUserId.setVisibility(View.VISIBLE); mKeyUserIdRest.setVisibility(View.VISIBLE); mKeyMasterKeyIdHex.setVisibility(View.VISIBLE); + } public void setError(String error) { @@ -120,9 +126,11 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan return view; } - public void selectKey(Uri keyUri) { - mReceivedUri = keyUri; - getActivity().getSupportLoaderManager().restartLoader(0, null, this); + //For AppSettingsFragment + public void selectKey(long masterKeyId) { + Uri buildUri = KeychainContract.KeyRings.buildGenericKeyRingUri(String.valueOf(masterKeyId)); + mReceivedUri = buildUri; + getActivity().getSupportLoaderManager().restartLoader(LOADER_ID, null, this); } private void startSelectKeyActivity() { @@ -133,7 +141,9 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { - return new CursorLoader(getActivity(), mReceivedUri, PROJECTION, null, null, null); + Uri uri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mReceivedUri); + //We don't care about the Loader id + return new CursorLoader(getActivity(), uri, PROJECTION, null, null, null); } @Override |