diff --git a/OsmAnd/res/layout/dash_updates_fragment.xml b/OsmAnd/res/layout/dash_updates_fragment.xml index 6680c3b211..ba3a36149c 100644 --- a/OsmAnd/res/layout/dash_updates_fragment.xml +++ b/OsmAnd/res/layout/dash_updates_fragment.xml @@ -12,6 +12,7 @@ android:layout_width="match_parent" android:layout_height="40dp"> - Use secure connection with server Use HTTPS Advanced - Maps + You have %1$s maps to update Search for SHOW MAP SHOW ALL diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java index 2e3a796a1b..2b3f852b33 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashUpdatesFragment.java @@ -1,6 +1,8 @@ package net.osmand.plus.dashboard; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import android.widget.*; @@ -63,6 +65,13 @@ public class DashUpdatesFragment extends DashBaseFragment { } public void updatedDownloadsList(List list) { + List itemList = new ArrayList(list); + Collections.sort(itemList, new Comparator() { + @Override + public int compare(IndexItem indexItem, IndexItem t1) { + return (int)(t1.getTimestamp() - indexItem.getTimestamp()); + } + }); View mainView = getView(); //it may be null because download index thread is async if (mainView == null) { @@ -72,20 +81,20 @@ public class DashUpdatesFragment extends DashBaseFragment { baseNames.clear(); downloadButtons.clear(); mainView.findViewById(R.id.main_progress).setVisibility(View.GONE); - ((TextView) mainView.findViewById(R.id.update_count)).setText(String.valueOf(list.size())); + ((TextView) mainView.findViewById(R.id.header)).setText(getString(R.string.map_update ,String.valueOf(list.size()))); LinearLayout updates = (LinearLayout) mainView.findViewById(R.id.updates_items); updates.removeAllViews(); - if (list.size() < 1) { + if (itemList.size() < 1) { mainView.findViewById(R.id.maps).setVisibility(View.GONE); return; } else { mainView.findViewById(R.id.maps).setVisibility(View.VISIBLE); } - for (int i = 0; i < list.size(); i++) { - final IndexItem item = list.get(i); + for (int i = 0; i < itemList.size(); i++) { + final IndexItem item = itemList.get(i); if (i > 2) { break; }