mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Move mergeLatch.await() to a more sensible location
This commit is contained in:
parent
b9f6bd55ca
commit
9ea223e32f
1 changed files with 10 additions and 10 deletions
|
|
@ -160,14 +160,7 @@ public class CategorizationFragment extends Fragment {
|
||||||
*/
|
*/
|
||||||
protected ArrayList<String> recentCatQuery() {
|
protected ArrayList<String> recentCatQuery() {
|
||||||
ArrayList<String> items = new ArrayList<String>();
|
ArrayList<String> items = new ArrayList<String>();
|
||||||
|
|
||||||
try {
|
|
||||||
mergeLatch.await();
|
|
||||||
Log.d(TAG, "Waited for merge");
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Log.e(TAG, "Interrupted Exception: ", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Cursor cursor = client.query(
|
Cursor cursor = client.query(
|
||||||
CategoryContentProvider.BASE_URI,
|
CategoryContentProvider.BASE_URI,
|
||||||
|
|
@ -195,17 +188,24 @@ public class CategorizationFragment extends Fragment {
|
||||||
protected ArrayList<String> mergeItems() {
|
protected ArrayList<String> mergeItems() {
|
||||||
|
|
||||||
Set<String> mergedItems = new LinkedHashSet<String>();
|
Set<String> mergedItems = new LinkedHashSet<String>();
|
||||||
List<String> gpsItems = new ArrayList<String>();
|
|
||||||
|
|
||||||
Log.d(TAG, "Calling APIs for GPS cats, title cats and recent cats...");
|
Log.d(TAG, "Calling APIs for GPS cats, title cats and recent cats...");
|
||||||
|
|
||||||
|
List<String> gpsItems = new ArrayList<String>();
|
||||||
if (MwVolleyApi.GpsCatExists.getGpsCatExists()) {
|
if (MwVolleyApi.GpsCatExists.getGpsCatExists()) {
|
||||||
gpsItems.addAll(MwVolleyApi.getGpsCat());
|
gpsItems.addAll(MwVolleyApi.getGpsCat());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> titleItems = new ArrayList<String>(titleCatQuery());
|
List<String> titleItems = new ArrayList<String>(titleCatQuery());
|
||||||
List<String> recentItems = new ArrayList<String>(recentCatQuery());
|
List<String> recentItems = new ArrayList<String>(recentCatQuery());
|
||||||
|
|
||||||
|
//Await results of titleItems, which is likely to come in last
|
||||||
|
try {
|
||||||
|
mergeLatch.await();
|
||||||
|
Log.d(TAG, "Waited for merge");
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Log.e(TAG, "Interrupted Exception: ", e);
|
||||||
|
}
|
||||||
|
|
||||||
mergedItems.addAll(gpsItems);
|
mergedItems.addAll(gpsItems);
|
||||||
Log.d(TAG, "Adding GPS items: " + gpsItems);
|
Log.d(TAG, "Adding GPS items: " + gpsItems);
|
||||||
mergedItems.addAll(titleItems);
|
mergedItems.addAll(titleItems);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue