mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add comments
This commit is contained in:
parent
9ea223e32f
commit
519afe3f47
2 changed files with 14 additions and 6 deletions
|
|
@ -121,8 +121,10 @@ public class CategorizationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Probably add 'suggest from filename' cats here. We want it to be displayed at start, not upon typing
|
/**
|
||||||
//TODO: Search using MethodA query, but can't use MethodAUpdater because we don't want it updating when user types
|
* Retrieves category suggestions from title input
|
||||||
|
* @return a list containing title-related categories
|
||||||
|
*/
|
||||||
protected ArrayList<String> titleCatQuery() {
|
protected ArrayList<String> titleCatQuery() {
|
||||||
|
|
||||||
TitleCategories titleCategoriesSub;
|
TitleCategories titleCategoriesSub;
|
||||||
|
|
@ -132,6 +134,7 @@ public class CategorizationFragment extends Fragment {
|
||||||
String title = titleDesc.getString("Title", "");
|
String title = titleDesc.getString("Title", "");
|
||||||
Log.d(TAG, "Title: " + title);
|
Log.d(TAG, "Title: " + title);
|
||||||
|
|
||||||
|
//Override onPostExecute to access the results of async API call
|
||||||
titleCategoriesSub = new TitleCategories(title) {
|
titleCategoriesSub = new TitleCategories(title) {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(ArrayList<String> result) {
|
protected void onPostExecute(ArrayList<String> result) {
|
||||||
|
|
@ -142,8 +145,11 @@ public class CategorizationFragment extends Fragment {
|
||||||
mergeLatch.countDown();
|
mergeLatch.countDown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
titleCategoriesSub.execute();
|
titleCategoriesSub.execute();
|
||||||
Log.d(TAG, "TitleCatItems in titleCatQuery: " + titleCatItems);
|
Log.d(TAG, "TitleCatItems in titleCatQuery: " + titleCatItems);
|
||||||
|
|
||||||
|
//Only return titleCatItems after API call has finished
|
||||||
try {
|
try {
|
||||||
mergeLatch.await();
|
mergeLatch.await();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
@ -152,8 +158,6 @@ public class CategorizationFragment extends Fragment {
|
||||||
return titleCatItems;
|
return titleCatItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves recently-used categories
|
* Retrieves recently-used categories
|
||||||
* @return a list containing recent categories
|
* @return a list containing recent categories
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends asynchronous queries to the Commons MediaWiki API to retrieve categories that are related to
|
||||||
|
* the title entered in previous screen. The 'srsearch' action-specific parameter is used for this
|
||||||
|
* purpose. This class should be subclassed in CategorizationFragment.java to add the results to recent and GPS cats.
|
||||||
|
*/
|
||||||
public class TitleCategories extends AsyncTask<Void, Void, ArrayList<String>> {
|
public class TitleCategories extends AsyncTask<Void, Void, ArrayList<String>> {
|
||||||
|
|
||||||
private final static int SEARCH_CATS_LIMIT = 25;
|
private final static int SEARCH_CATS_LIMIT = 25;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue