diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-01-22 14:56:43 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-01-22 14:56:43 +0100 |
| commit | 3ff67da2dc59529bc7b11cb9570a5e56fa4ec60a (patch) | |
| tree | 334e6d8d814d44824cd6e58d98626bfae519c706 | |
| parent | 9587cf1963a1b104388b6a5d6b0f6acd46f88d76 (diff) | |
| download | cgeo-3ff67da2dc59529bc7b11cb9570a5e56fa4ec60a.zip cgeo-3ff67da2dc59529bc7b11cb9570a5e56fa4ec60a.tar.gz cgeo-3ff67da2dc59529bc7b11cb9570a5e56fa4ec60a.tar.bz2 | |
refactoring: #1023, remove all method arguments from setMoreCaches
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 22629ad..0181f96 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -189,11 +189,8 @@ public class cgeocaches extends AbstractListActivity { if (cacheList == null) { showToast(res.getString(R.string.err_list_load_fail)); - setMoreCaches(false); - } else { - final int count = SearchResult.getTotal(search); - setMoreCaches(type != CacheListType.OFFLINE && count > 0 && cacheList != null && cacheList.size() < count && cacheList.size() < MAX_LIST_ITEMS); } + setMoreCaches(); if (cacheList != null && SearchResult.getError(search) == StatusCode.UNAPPROVED_LICENSE) { AlertDialog.Builder dialog = new AlertDialog.Builder(cgeocaches.this); @@ -280,11 +277,8 @@ public class cgeocaches extends AbstractListActivity { if (cacheList == null) { showToast(res.getString(R.string.err_list_load_fail)); - setMoreCaches(false); - } else { - final int count = SearchResult.getTotal(search); - setMoreCaches(type != CacheListType.OFFLINE && count > 0 && cacheList != null && cacheList.size() < count && cacheList.size() < MAX_LIST_ITEMS); } + setMoreCaches(); if (SearchResult.getError(search) != null) { showToast(res.getString(R.string.err_download_fail) + " " + SearchResult.getError(search).getErrorString(res) + "."); @@ -1355,7 +1349,7 @@ public class cgeocaches extends AbstractListActivity { listFooter.setOnClickListener(null); } - private void setMoreCaches(boolean more) { + private void setMoreCaches() { if (listFooter == null) { return; } @@ -1363,7 +1357,13 @@ public class cgeocaches extends AbstractListActivity { return; } - if (more) { + boolean enableMore = type != CacheListType.OFFLINE && cacheList != null && cacheList.size() < MAX_LIST_ITEMS; + if (enableMore) { + final int count = SearchResult.getTotal(search); + enableMore = enableMore && count > 0 && cacheList.size() < count; + } + + if (enableMore) { listFooterText.setText(res.getString(R.string.caches_more_caches) + " (" + res.getString(R.string.caches_more_caches_currently) + ": " + cacheList.size() + ")"); listFooter.setOnClickListener(new MoreCachesListener()); } else { @@ -1374,7 +1374,7 @@ public class cgeocaches extends AbstractListActivity { } listFooter.setOnClickListener(null); } - listFooter.setClickable(more); + listFooter.setClickable(enableMore); } private void init() { @@ -1387,8 +1387,7 @@ public class cgeocaches extends AbstractListActivity { } if (CollectionUtils.isNotEmpty(cacheList)) { - final int count = SearchResult.getTotal(search); - setMoreCaches(type != CacheListType.OFFLINE && count > 0 && cacheList.size() < count && cacheList.size() < MAX_LIST_ITEMS); + setMoreCaches(); } setTitle(title); |
