Fix sorting poi and favorite groups
This commit is contained in:
parent
dc36ac7e9e
commit
aaacbc9166
2 changed files with 12 additions and 2 deletions
|
@ -1,8 +1,10 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
@ -141,10 +143,17 @@ public class PoiFiltersHelper {
|
|||
public List<PoiFilter> getOsmDefinedPoiFilters(){
|
||||
if(cacheOsmDefinedFilters == null){
|
||||
cacheOsmDefinedFilters = new ArrayList<PoiFilter>();
|
||||
cacheOsmDefinedFilters.add(new PoiFilter(null, application));
|
||||
for(AmenityType t : AmenityType.values()){
|
||||
cacheOsmDefinedFilters.add(new PoiFilter(t, application));
|
||||
}
|
||||
final Collator instance = Collator.getInstance();
|
||||
Collections.sort(cacheOsmDefinedFilters, new Comparator<PoiFilter>() {
|
||||
@Override
|
||||
public int compare(PoiFilter object1, PoiFilter object2) {
|
||||
return instance.compare(object1.getName(), object2.getName());
|
||||
}
|
||||
});
|
||||
cacheOsmDefinedFilters.add(0, new PoiFilter(null, application));
|
||||
}
|
||||
return Collections.unmodifiableList(cacheOsmDefinedFilters);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.FavouritePoint;
|
||||
import net.osmand.GPXUtilities;
|
||||
|
@ -462,7 +463,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
|||
List<String> groups = new ArrayList<String>();
|
||||
|
||||
public void setFavoriteGroups(Map<String, List<FavouritePoint>> favoriteGroups) {
|
||||
this.sourceFavoriteGroups = favoriteGroups;
|
||||
this.sourceFavoriteGroups = new TreeMap<String, List<FavouritePoint>>(favoriteGroups);
|
||||
synchronizeGroups();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue