mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Attempt at adding new category list to adapter
Doesn't seem to show up. Might be adding in wrong place
This commit is contained in:
parent
9756513a89
commit
7034f628de
3 changed files with 18 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ import org.mediawiki.api.ApiResult;
|
||||||
import org.mediawiki.api.MWApi;
|
import org.mediawiki.api.MWApi;
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
import fr.free.nrw.commons.upload.MwVolleyApi;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -117,6 +118,7 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
//TODO: Remove this later
|
//TODO: Remove this later
|
||||||
Log.d("Cat", "I am still called when upload is commented out");
|
Log.d("Cat", "I am still called when upload is commented out");
|
||||||
|
|
||||||
|
|
||||||
categoriesAdapter.setItems(items);
|
categoriesAdapter.setItems(items);
|
||||||
categoriesAdapter.notifyDataSetInvalidated();
|
categoriesAdapter.notifyDataSetInvalidated();
|
||||||
categoriesSearchInProgress.setVisibility(View.GONE);
|
categoriesSearchInProgress.setVisibility(View.GONE);
|
||||||
|
|
@ -137,6 +139,8 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
protected ArrayList<String> doInBackground(Void... voids) {
|
protected ArrayList<String> doInBackground(Void... voids) {
|
||||||
if(TextUtils.isEmpty(filter)) {
|
if(TextUtils.isEmpty(filter)) {
|
||||||
ArrayList<String> items = new ArrayList<String>();
|
ArrayList<String> items = new ArrayList<String>();
|
||||||
|
ArrayList<String> mergedItems= new ArrayList<String>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Cursor cursor = client.query(
|
Cursor cursor = client.query(
|
||||||
CategoryContentProvider.BASE_URI,
|
CategoryContentProvider.BASE_URI,
|
||||||
|
|
@ -149,11 +153,21 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
Category cat = Category.fromCursor(cursor);
|
Category cat = Category.fromCursor(cursor);
|
||||||
items.add(cat.getName());
|
items.add(cat.getName());
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
|
||||||
|
if (MwVolleyApi.gpsCatExists){
|
||||||
|
Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString());
|
||||||
|
ArrayList<String> gpsItems = new ArrayList<String>();
|
||||||
|
|
||||||
|
mergedItems.addAll(items);
|
||||||
|
mergedItems.addAll(gpsItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (RemoteException e) {
|
||||||
// faaaail
|
// faaaail
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return items;
|
return mergedItems;
|
||||||
}
|
}
|
||||||
if(categoriesCache.containsKey(filter)) {
|
if(categoriesCache.containsKey(filter)) {
|
||||||
return categoriesCache.get(filter);
|
return categoriesCache.get(filter);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class MwVolleyApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
//To get the list of categories for display
|
//To get the list of categories for display
|
||||||
public ArrayList<String> getGpsCat() {
|
public static ArrayList<String> getGpsCat() {
|
||||||
ArrayList<String> list = new ArrayList<String>(categorySet);
|
ArrayList<String> list = new ArrayList<String>(categorySet);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public class UploadController {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Contribution contribution) {
|
protected void onPostExecute(Contribution contribution) {
|
||||||
super.onPostExecute(contribution);
|
super.onPostExecute(contribution);
|
||||||
//uploadService.queue(UploadService.ACTION_UPLOAD_FILE, contribution);
|
uploadService.queue(UploadService.ACTION_UPLOAD_FILE, contribution);
|
||||||
onComplete.onUploadStarted(contribution);
|
onComplete.onUploadStarted(contribution);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue