blob: 9ee920c161b3306f631ecc332201ce5f2dcfbfac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package cgeo.geocaching.list;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
import cgeo.geocaching.R;
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) {
@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) {
@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) {
@Override
public int getNumberOfCaches() {
return DataStore.getAllHistoryCachesCount();
}
};
/**
* private constructor to have all instances as constants in the class
*/
private PseudoList(final int id, final int titleResourceId) {
super(id, CgeoApplication.getInstance().getResources().getString(titleResourceId));
}
@Override
public String getTitleAndCount() {
return "<" + title + ">";
}
@Override
public String getTitle() {
return title;
}
@Override
public boolean isConcrete() {
return false;
}
}
|