Bugfixes ('Sort by name' does not work) #6286 - fixed

This commit is contained in:
madwasp79 2019-01-18 17:20:06 +02:00
parent dc6db87d9f
commit 7461d825d6
2 changed files with 6 additions and 7 deletions

View file

@ -270,15 +270,14 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
}
public void sortByDefault() {
public void sortByDefault(boolean isSortedByDistance) {
Location loc = app.getLocationProvider().getLastStaleKnownLocation();
LatLon map = app.getMapViewTrackingUtilities().getMapLocation();
if (loc != null) {
if (loc != null && isSortedByDistance) {
sortByDistance(new LatLon(loc.getLatitude(), loc.getLongitude()));
} else if(map != null){
} else if (map != null && isSortedByDistance){
sortByDistance(map);
} else{
} else {
sortByName();
}
}

View file

@ -55,7 +55,7 @@ public class FavoriteDialogs {
}
};
favouritesAdapter.sortByDefault();
favouritesAdapter.sortByDefault(true);
if(points.size() == 0){
Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
@ -208,7 +208,7 @@ public class FavoriteDialogs {
final OnDismissListener dismissListener, final Dialog[] dialogHolder, final boolean sortByDist) {
ListView listView = new ListView(uiContext);
AlertDialog.Builder bld = new AlertDialog.Builder(uiContext);
favouritesAdapter.sortByDefault();
favouritesAdapter.sortByDefault(sortByDist);
listView.setAdapter(favouritesAdapter);
listView.setOnItemClickListener(click);
bld.setPositiveButton(sortByDist ? R.string.sort_by_name :