diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2012-07-08 10:02:35 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2012-07-08 10:02:35 +0200 |
commit | 231737105d912e2e020baa8e78c659f6e8b43342 (patch) | |
tree | 35af7bb2fbe599ad4265bda1dae3ecc813ad69e5 /main/src | |
parent | d1d1cb75b4e51d86e6bb0df910864b0687e1b1b5 (diff) | |
download | cgeo-231737105d912e2e020baa8e78c659f6e8b43342.zip cgeo-231737105d912e2e020baa8e78c659f6e8b43342.tar.gz cgeo-231737105d912e2e020baa8e78c659f6e8b43342.tar.bz2 |
fix #1606: Cache count in title bar doesn't update when filtering list
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 340122a..580e4b7 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -161,14 +161,10 @@ public class cgeocaches extends AbstractListActivity { @Override public void handleMessage(Message msg) { try { - if (search != null) { - setTitle(title + " [" + search.getCount() + ']'); - } else { - setTitle(title); - } - setAdapter(); + updateTitle(); + setDateComparatorForEventList(); showFooterMoreCaches(); @@ -237,17 +233,15 @@ public class cgeocaches extends AbstractListActivity { public void handleMessage(Message msg) { try { if (search != null) { - setTitle(title + " [" + search.getCount() + "]"); replaceCacheListFromSearch(); if (adapter != null) { adapter.reFilter(); } - } else { - setTitle(title); } - setAdapter(); + updateTitle(); + showFooterMoreCaches(); if (search != null && search.getError() != null) { @@ -281,6 +275,22 @@ public class cgeocaches extends AbstractListActivity { cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); } + protected void updateTitle() { + ArrayList<Integer> numbers = new ArrayList<Integer>(); + if (adapter.isFiltered()) { + numbers.add(adapter.getCount()); + } + if (search != null) { + numbers.add(search.getCount()); + } + if (numbers.isEmpty()) { + setTitle(title); + } + else { + setTitle(title + " [" + StringUtils.join(numbers, '/') + ']'); + } + } + private Handler loadDetailsHandler = new Handler() { @Override @@ -425,7 +435,6 @@ public class cgeocaches extends AbstractListActivity { setTheme(); setContentView(R.layout.caches); - setTitle("caches"); // get parameters Bundle extras = getIntent().getExtras(); @@ -524,15 +533,12 @@ public class cgeocaches extends AbstractListActivity { final String address = extras.getString(EXTRAS_ADDRESS); if (StringUtils.isNotBlank(address)) { title = address; - setTitle(title); - showProgress(true); - showFooterLoadingCaches(); } else { title = coords.toString(); - setTitle(title); - showProgress(true); - showFooterLoadingCaches(); } + setTitle(title); + showProgress(true); + showFooterLoadingCaches(); thread = new LoadByCoordsThread(coords); thread.setRecaptchaHandler(new SearchHandler(this, res, thread)); @@ -1050,6 +1056,7 @@ public class cgeocaches extends AbstractListActivity { if (adapter != null) { adapter.setFilter(filter); prepareFilterBar(); + updateTitle(); invalidateOptionsMenuCompatible(); return true; } |