From 1f10bf88bc8e26e90a00989188bc334f2db07a4b Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 17 Sep 2014 15:05:54 +0300 Subject: [PATCH] Sorted items in updateindexfragment --- .../plus/download/UpdatesIndexFragment.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index 2b6d466e06..f0813a0cf9 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -20,6 +20,7 @@ import net.osmand.plus.activities.OsmandExpandableListFragment; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; @@ -39,6 +40,12 @@ public class UpdatesIndexFragment extends SherlockListFragment { format = getMyApplication().getResourceManager().getDateFormat(); osmandRegions = getMyApplication().getResourceManager().getOsmandRegions(); listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, DownloadActivity.downloadListIndexThread.getItemsToUpdate()); + listAdapter.sort(new Comparator() { + @Override + public int compare(IndexItem indexItem, IndexItem indexItem2) { + return indexItem.getVisibleName(getMyApplication(), osmandRegions).compareTo(indexItem2.getVisibleName(getMyApplication(), osmandRegions)); + } + }); setListAdapter(listAdapter); setHasOptionsMenu(true); getDownloadActivity().setUpdatesIndexFragment(this); @@ -47,9 +54,6 @@ public class UpdatesIndexFragment extends SherlockListFragment { @Override public void onResume() { super.onResume(); - - Map> map = getDownloadActivity().getEntriesToDownload(); - } public void updateItemsList(List items) { @@ -211,6 +215,12 @@ public class UpdatesIndexFragment extends SherlockListFragment { for (IndexItem item : filtered){ add(item); } + sort(new Comparator() { + @Override + public int compare(IndexItem indexItem, IndexItem indexItem2) { + return indexItem.getVisibleName(getMyApplication(), osmandRegions).compareTo(indexItem2.getVisibleName(getMyApplication(), osmandRegions)); + } + }); } }