mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Limit view of recent cats to 20
This commit is contained in:
parent
308b28dd23
commit
84c2054fb0
1 changed files with 4 additions and 3 deletions
|
|
@ -50,6 +50,8 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
|
||||
private ContentProviderClient client;
|
||||
|
||||
private final int RECENT_CATS_LIMIT = 20;
|
||||
|
||||
public static class CategoryItem implements Parcelable {
|
||||
public String name;
|
||||
public boolean selected;
|
||||
|
|
@ -129,8 +131,6 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
protected ArrayList<String> doInBackground(Void... voids) {
|
||||
if(TextUtils.isEmpty(filter)) {
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
// fixme add a limit?
|
||||
// fixme sort by last_used descending?
|
||||
try {
|
||||
Cursor cursor = client.query(
|
||||
CategoryContentProvider.BASE_URI,
|
||||
|
|
@ -138,7 +138,8 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
null,
|
||||
new String[]{},
|
||||
Category.Table.COLUMN_LAST_USED + " DESC");
|
||||
while (cursor.moveToNext()) {
|
||||
// fixme add a limit on the original query instead of falling out of the loop?
|
||||
while (cursor.moveToNext() && cursor.getPosition() < RECENT_CATS_LIMIT) {
|
||||
Category cat = Category.fromCursor(cursor);
|
||||
items.add(cat.getName());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue