diff options
| author | Bananeweizen <Bananeweizen@gmx.de> | 2013-07-29 09:08:18 +0200 |
|---|---|---|
| committer | Bananeweizen <Bananeweizen@gmx.de> | 2013-07-29 09:08:18 +0200 |
| commit | f07696a4fc105388d970099213954c190409c45f (patch) | |
| tree | f04908bf351190d4ee480243351b23fb6dfa233e | |
| parent | a0566f5c5b53e5bb554a0537eaeb79b2fc0aa211 (diff) | |
| download | cgeo-f07696a4fc105388d970099213954c190409c45f.zip cgeo-f07696a4fc105388d970099213954c190409c45f.tar.gz cgeo-f07696a4fc105388d970099213954c190409c45f.tar.bz2 | |
fix #3067: sort order unstable when coming back from details
* do not reset sort order when loading cache list
* only reset explicitly when switching lists
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CacheListAdapter.java | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 5d7841d..b364573 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -1481,9 +1481,9 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity currentLoader.reset(); ((OfflineGeocacheListLoader) currentLoader).setListId(listId); ((OfflineGeocacheListLoader) currentLoader).setSearchCenter(coords); + adapter.setComparator(null); // delete current sorting currentLoader.startLoading(); - invalidateOptionsMenuCompatible(); } diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 3179857..c6aeaa6 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -6,12 +6,12 @@ import cgeo.geocaching.CacheDetailActivity; import cgeo.geocaching.Geocache; import cgeo.geocaching.IGeoData; import cgeo.geocaching.R; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheListType; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.filter.IFilter; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.settings.Settings; import cgeo.geocaching.sorting.CacheComparator; import cgeo.geocaching.sorting.DistanceComparator; import cgeo.geocaching.sorting.EventDateComparator; @@ -645,6 +645,10 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { } public void setInitialComparator() { + // will be called repeatedly when coming back to the list, therefore check first for an already existing sorting + if (cacheComparator != null) { + return; + } CacheComparator comparator = null; // a null comparator will automatically sort by distance if (cacheListType == CacheListType.HISTORY) { comparator = new VisitComparator(); |
