Show used cats in MRU order

This commit is contained in:
Brion Vibber 2013-04-24 07:57:10 -07:00
parent d974630704
commit 29ebce5ab0
2 changed files with 6 additions and 1 deletions

View file

@ -137,7 +137,7 @@ public class CategorizationFragment extends SherlockFragment{
Category.Table.ALL_FIELDS, Category.Table.ALL_FIELDS,
null, null,
new String[]{}, new String[]{},
null); Category.Table.COLUMN_LAST_USED + " DESC");
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
Category cat = Category.fromCursor(cursor); Category cat = Category.fromCursor(cursor);
items.add(cat.getName()); items.add(cat.getName());

View file

@ -47,6 +47,10 @@ public class Category {
lastUsed = (Date)lastUsed_.clone(); lastUsed = (Date)lastUsed_.clone();
} }
public void touch() {
lastUsed = new Date();
}
public int getTimesUsed() { public int getTimesUsed() {
return timesUsed; return timesUsed;
} }
@ -57,6 +61,7 @@ public class Category {
public void incTimesUsed() { public void incTimesUsed() {
timesUsed++; timesUsed++;
touch();
} }
// Database/content-provider stuff // Database/content-provider stuff