diff options
author | Daniel Haß <daniel.hass@stzedn.de> | 2014-02-26 19:16:28 +0100 |
---|---|---|
committer | Daniel Haß <daniel.hass@stzedn.de> | 2014-02-26 19:16:28 +0100 |
commit | 20470748a971d819a64e842d2847891cbd63f72f (patch) | |
tree | 8f12ee7ec5c9dc59238f53ce1ea0894e3a8422fa /OpenPGP-Keychain/src | |
parent | 5d1f61bff78e4f09eb18e5cc7020906af40655ab (diff) | |
download | open-keychain-20470748a971d819a64e842d2847891cbd63f72f.tar.gz open-keychain-20470748a971d819a64e842d2847891cbd63f72f.tar.bz2 open-keychain-20470748a971d819a64e842d2847891cbd63f72f.zip |
Adapted the ImportKeysLoader to work with the new AsyncWrapper
Diffstat (limited to 'OpenPGP-Keychain/src')
3 files changed, 13 insertions, 9 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index e88df9e43..a11a78dd6 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -186,9 +186,7 @@ public class ImportKeysListFragment extends ListFragment implements switch (id) { case LOADER_ID_BYTES: { InputData inputData = getInputData(mKeyBytes, mDataUri); - - //TODO Rewrite ImportKeysListLoader - //return new ImportKeysListLoader(mActivity, inputData); + return new ImportKeysListLoader(mActivity, inputData); } case LOADER_ID_SERVER_QUERY: { return new ImportKeysListServerLoader(getActivity(), mServerQuery, mKeyServer); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 00ad8c957..29e418db7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -33,12 +33,13 @@ import org.sufficientlysecure.keychain.util.PositionAwareInputStream; import android.content.Context; import android.support.v4.content.AsyncTaskLoader; -public class ImportKeysListLoader extends AsyncTaskLoader<List<ImportKeysListEntry>> { +public class ImportKeysListLoader extends AsyncTaskLoader<AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>> { Context mContext; InputData mInputData; ArrayList<ImportKeysListEntry> data = new ArrayList<ImportKeysListEntry>(); + AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> entryListWrapper; public ImportKeysListLoader(Context context, InputData inputData) { super(context); @@ -47,15 +48,18 @@ public class ImportKeysListLoader extends AsyncTaskLoader<List<ImportKeysListEnt } @Override - public List<ImportKeysListEntry> loadInBackground() { + public AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> loadInBackground() { + + entryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(data, null); + if (mInputData == null) { Log.e(Constants.TAG, "Input data is null!"); - return data; + return entryListWrapper; } generateListOfKeyrings(mInputData); - return data; + return entryListWrapper; } @Override @@ -77,7 +81,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader<List<ImportKeysListEnt } @Override - public void deliverResult(List<ImportKeysListEntry> data) { + public void deliverResult(AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> data) { super.deliverResult(data); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java index c7f6eee32..78e4d23fb 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java @@ -47,9 +47,11 @@ public class ImportKeysListServerLoader extends AsyncTaskLoader<AsyncTaskResultW @Override public AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> loadInBackground() { + + entryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(entryList, null); + if (mServerQuery == null) { Log.e(Constants.TAG, "mServerQuery is null!"); - entryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(entryList, null); return entryListWrapper; } |