Bugfixes ('Sort by name' does not work) #6286 - fixed
This commit is contained in:
parent
dc6db87d9f
commit
7461d825d6
2 changed files with 6 additions and 7 deletions
|
@ -270,15 +270,14 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sortByDefault(boolean isSortedByDistance) {
|
||||||
public void sortByDefault() {
|
|
||||||
Location loc = app.getLocationProvider().getLastStaleKnownLocation();
|
Location loc = app.getLocationProvider().getLastStaleKnownLocation();
|
||||||
LatLon map = app.getMapViewTrackingUtilities().getMapLocation();
|
LatLon map = app.getMapViewTrackingUtilities().getMapLocation();
|
||||||
if (loc != null) {
|
if (loc != null && isSortedByDistance) {
|
||||||
sortByDistance(new LatLon(loc.getLatitude(), loc.getLongitude()));
|
sortByDistance(new LatLon(loc.getLatitude(), loc.getLongitude()));
|
||||||
} else if(map != null){
|
} else if (map != null && isSortedByDistance){
|
||||||
sortByDistance(map);
|
sortByDistance(map);
|
||||||
} else{
|
} else {
|
||||||
sortByName();
|
sortByName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class FavoriteDialogs {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
favouritesAdapter.sortByDefault();
|
favouritesAdapter.sortByDefault(true);
|
||||||
|
|
||||||
if(points.size() == 0){
|
if(points.size() == 0){
|
||||||
Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
|
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) {
|
final OnDismissListener dismissListener, final Dialog[] dialogHolder, final boolean sortByDist) {
|
||||||
ListView listView = new ListView(uiContext);
|
ListView listView = new ListView(uiContext);
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(uiContext);
|
AlertDialog.Builder bld = new AlertDialog.Builder(uiContext);
|
||||||
favouritesAdapter.sortByDefault();
|
favouritesAdapter.sortByDefault(sortByDist);
|
||||||
listView.setAdapter(favouritesAdapter);
|
listView.setAdapter(favouritesAdapter);
|
||||||
listView.setOnItemClickListener(click);
|
listView.setOnItemClickListener(click);
|
||||||
bld.setPositiveButton(sortByDist ? R.string.sort_by_name :
|
bld.setPositiveButton(sortByDist ? R.string.sort_by_name :
|
||||||
|
|
Loading…
Reference in a new issue