load data only once in ImportKeysListLoader

Fixes #571
This commit is contained in:
Vincent Breitmoser 2014-04-17 15:50:16 +02:00
parent 2a34d0e0e4
commit f6e7b92ced

View File

@ -51,9 +51,8 @@ public class ImportKeysListLoader
} }
} }
Context mContext; final Context mContext;
final InputData mInputData;
InputData mInputData;
ArrayList<ImportKeysListEntry> mData = new ArrayList<ImportKeysListEntry>(); ArrayList<ImportKeysListEntry> mData = new ArrayList<ImportKeysListEntry>();
AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> mEntryListWrapper; AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> mEntryListWrapper;
@ -67,6 +66,11 @@ public class ImportKeysListLoader
@Override @Override
public AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> loadInBackground() { public AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>> loadInBackground() {
// This has already been loaded! nvm any further, just return
if (mEntryListWrapper != null) {
return mEntryListWrapper;
}
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mData, null); mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mData, null);
if (mInputData == null) { if (mInputData == null) {