From 1085e1e675d858c630dd173fe65b68665f8cff9f Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 15 Jan 2012 13:16:49 +0100 Subject: [PATCH] Complete fav sorting after edits and deletes --- .../plus/activities/FavouritesActivity.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java index 9ac63dcb3c..a07bb446c1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java @@ -157,6 +157,13 @@ public class FavouritesActivity extends ExpandableListActivity { protected void onPostExecute(String result) { hideProgressBar(); favouritesAdapter.synchronizeGroups(); + favouritesAdapter.sort(new Comparator(){ + + @Override + public int compare(FavouritePoint object1, FavouritePoint object2) { + return object1.getName().compareTo(object2.getName()); + } + }); }; @Override @@ -261,6 +268,13 @@ public class FavouritesActivity extends ExpandableListActivity { boolean editied = helper.editFavouriteName(point, editText.getText().toString(), cat.getText().toString()); if (editied) { favouritesAdapter.synchronizeGroups(); + favouritesAdapter.sort(new Comparator(){ + + @Override + public int compare(FavouritePoint object1, FavouritePoint object2) { + return object1.getName().compareTo(object2.getName()); + } + }); } } @@ -282,6 +296,13 @@ public class FavouritesActivity extends ExpandableListActivity { MessageFormat.format(resources.getString(R.string.favourites_remove_dialog_success), point.getName()), Toast.LENGTH_SHORT).show(); favouritesAdapter.synchronizeGroups(); + favouritesAdapter.sort(new Comparator(){ + + @Override + public int compare(FavouritePoint object1, FavouritePoint object2) { + return object1.getName().compareTo(object2.getName()); + } + }); } } @@ -422,6 +443,13 @@ public class FavouritesActivity extends ExpandableListActivity { Toast.makeText(FavouritesActivity.this, warning, Toast.LENGTH_LONG).show(); } favouritesAdapter.synchronizeGroups(); + favouritesAdapter.sort(new Comparator(){ + + @Override + public int compare(FavouritePoint object1, FavouritePoint object2) { + return object1.getName().compareTo(object2.getName()); + } + }); }; }.execute();