diff options
author | Alex Fong <alexfongg@gmail.com> | 2016-05-19 16:48:56 +0800 |
---|---|---|
committer | Alex Fong <alexfongg@gmail.com> | 2016-05-19 16:48:56 +0800 |
commit | c97d74b3706ca2ffdb54725d1c03f47d2bc2aec9 (patch) | |
tree | 6a08a4b19a2149ddeb35a0269cc5ab67c2683f0f /OpenKeychain/src | |
parent | 21430c0b49ed9bd573a3c8d2182e4e63494bcf44 (diff) | |
download | open-keychain-c97d74b3706ca2ffdb54725d1c03f47d2bc2aec9.tar.gz open-keychain-c97d74b3706ca2ffdb54725d1c03f47d2bc2aec9.tar.bz2 open-keychain-c97d74b3706ca2ffdb54725d1c03f47d2bc2aec9.zip |
Changed HashMap to ArrayList<Pair>
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java index 81198fdb3..e8c4196f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java @@ -17,9 +17,8 @@ package org.sufficientlysecure.keychain.ui; -import java.util.HashMap; +import java.util.ArrayList; import java.util.Iterator; -import java.util.Map; import android.app.Activity; import android.content.ContentResolver; @@ -31,6 +30,7 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; +import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -47,7 +47,7 @@ import org.sufficientlysecure.keychain.util.FileHelper; public class BackupRestoreFragment extends Fragment { // masterKeyId & subKeyId for multi-key export - private Iterator<Map.Entry<Long, Long>> mIdsForRepeatAskPassphrase; + private Iterator<Pair<Long, Long>> mIdsForRepeatAskPassphrase; private static final int REQUEST_REPEAT_PASSPHRASE = 0x00007002; private static final int REQUEST_CODE_INPUT = 0x00007003; @@ -95,10 +95,10 @@ public class BackupRestoreFragment extends Fragment { return; } - new AsyncTask<ContentResolver, Void, HashMap<Long, Long>>() { + new AsyncTask<ContentResolver, Void, ArrayList<Pair<Long, Long>>>() { @Override - protected HashMap<Long, Long> doInBackground(ContentResolver... resolver) { - HashMap<Long, Long> askPassphraseIds = new HashMap<>(); + protected ArrayList<Pair<Long,Long>> doInBackground(ContentResolver... resolver) { + ArrayList<Pair<Long, Long>> askPassphraseIds = new ArrayList<>(); Cursor cursor = resolver[0].query( KeyRings.buildUnifiedKeyRingsUri(), new String[]{ KeyRings.MASTER_KEY_ID, @@ -118,13 +118,13 @@ public class BackupRestoreFragment extends Fragment { Long masterKeyId = cursor.getLong(0); Long subKeyId = getFirstSubKeyWithPassphrase(masterKeyId, resolver[0]); if(subKeyId != null) { - askPassphraseIds.put(masterKeyId, subKeyId); + askPassphraseIds.add(new Pair<>(masterKeyId, subKeyId)); } continue; } default: { long masterKeyId = cursor.getLong(0); - askPassphraseIds.put(masterKeyId, masterKeyId); + askPassphraseIds.add(new Pair<>(masterKeyId, masterKeyId)); } } } @@ -169,14 +169,14 @@ public class BackupRestoreFragment extends Fragment { } @Override - protected void onPostExecute(HashMap<Long, Long> askPassphraseIds) { + protected void onPostExecute(ArrayList<Pair<Long, Long>> askPassphraseIds) { super.onPostExecute(askPassphraseIds); FragmentActivity activity = getActivity(); if (activity == null) { return; } - mIdsForRepeatAskPassphrase = askPassphraseIds.entrySet().iterator(); + mIdsForRepeatAskPassphrase = askPassphraseIds.iterator(); if (mIdsForRepeatAskPassphrase.hasNext()) { startPassphraseActivity(); @@ -196,9 +196,9 @@ public class BackupRestoreFragment extends Fragment { } Intent intent = new Intent(activity, PassphraseDialogActivity.class); - Map.Entry<Long, Long> keyPair = mIdsForRepeatAskPassphrase.next(); - long masterKeyId = keyPair.getKey(); - long subKeyId = keyPair.getValue(); + Pair<Long, Long> keyPair = mIdsForRepeatAskPassphrase.next(); + long masterKeyId = keyPair.first; + long subKeyId = keyPair.second; RequiredInputParcel requiredInput = RequiredInputParcel.createRequiredDecryptPassphrase(masterKeyId, subKeyId); requiredInput.mSkipCaching = true; |