diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-06-01 13:49:00 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-06-01 13:49:00 +0200 |
| commit | 3b754f77d4288c7fa274fdf17a3e9be002855e50 (patch) | |
| tree | 9f42f97039d1173752510e6ebc374babd82a3159 /main/src/cgeo/geocaching/list/PseudoList.java | |
| parent | 98a0f91c3be131ffd9c159acf0e8e61a6aeef1e7 (diff) | |
| download | cgeo-3b754f77d4288c7fa274fdf17a3e9be002855e50.zip cgeo-3b754f77d4288c7fa274fdf17a3e9be002855e50.tar.gz cgeo-3b754f77d4288c7fa274fdf17a3e9be002855e50.tar.bz2 | |
show number of caches also for history and all lists
Diffstat (limited to 'main/src/cgeo/geocaching/list/PseudoList.java')
| -rw-r--r-- | main/src/cgeo/geocaching/list/PseudoList.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/main/src/cgeo/geocaching/list/PseudoList.java b/main/src/cgeo/geocaching/list/PseudoList.java index 71f9123..9ee920c 100644 --- a/main/src/cgeo/geocaching/list/PseudoList.java +++ b/main/src/cgeo/geocaching/list/PseudoList.java @@ -1,32 +1,48 @@ package cgeo.geocaching.list; import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.DataStore; import cgeo.geocaching.R; -public class PseudoList extends AbstractList { +public abstract class PseudoList extends AbstractList { private static final int ALL_LIST_ID = 2; /** * list entry to show all caches */ - public static final PseudoList ALL_LIST = new PseudoList(ALL_LIST_ID, R.string.list_all_lists); + public static final PseudoList ALL_LIST = new PseudoList(ALL_LIST_ID, R.string.list_all_lists) { + @Override + public int getNumberOfCaches() { + return DataStore.getAllCachesCount(); + } + }; private static final int NEW_LIST_ID = 3; /** * list entry to create a new list */ - public static final AbstractList NEW_LIST = new PseudoList(NEW_LIST_ID, R.string.list_menu_create); + public static final AbstractList NEW_LIST = new PseudoList(NEW_LIST_ID, R.string.list_menu_create) { + @Override + public int getNumberOfCaches() { + return -1; + } + }; private static final int HISTORY_LIST_ID = 4; /** * list entry to create a new list */ - public static final AbstractList HISTORY_LIST = new PseudoList(HISTORY_LIST_ID, R.string.menu_history); + public static final AbstractList HISTORY_LIST = new PseudoList(HISTORY_LIST_ID, R.string.menu_history) { + @Override + public int getNumberOfCaches() { + return DataStore.getAllHistoryCachesCount(); + } + }; /** * private constructor to have all instances as constants in the class */ - private PseudoList(int id, final int titleResourceId) { + private PseudoList(final int id, final int titleResourceId) { super(id, CgeoApplication.getInstance().getResources().getString(titleResourceId)); } @@ -41,11 +57,6 @@ public class PseudoList extends AbstractList { } @Override - public int getCount() { - return -1; - } - - @Override public boolean isConcrete() { return false; } |
