Sorted updated in dashboard by date and updated description
This commit is contained in:
parent
654d3889b9
commit
6a3469cce1
3 changed files with 15 additions and 10 deletions
|
@ -12,6 +12,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp">
|
android:layout_height="40dp">
|
||||||
<TextView android:text="@string/map_update"
|
<TextView android:text="@string/map_update"
|
||||||
|
android:id="@+id/header"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
|
@ -19,11 +20,6 @@
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/dashboard_black"/>
|
android:textColor="@color/dashboard_black"/>
|
||||||
<TextView android:id="@+id/update_count"
|
|
||||||
android:layout_marginLeft="2dp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:textColor="@color/dashboard_blue"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
<ProgressBar android:id="@+id/main_progress"
|
<ProgressBar android:id="@+id/main_progress"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_marginLeft="2dp"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
||||||
<string name="osmo_use_https">Use HTTPS</string>
|
<string name="osmo_use_https">Use HTTPS</string>
|
||||||
<string name="advanced_settings">Advanced</string>
|
<string name="advanced_settings">Advanced</string>
|
||||||
<string name="map_update">Maps</string>
|
<string name="map_update">You have %1$s maps to update</string>
|
||||||
<string name="search_for">Search for</string>
|
<string name="search_for">Search for</string>
|
||||||
<string name="show_map">SHOW MAP</string>
|
<string name="show_map">SHOW MAP</string>
|
||||||
<string name="show_all">SHOW ALL</string>
|
<string name="show_all">SHOW ALL</string>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
|
@ -63,6 +65,13 @@ public class DashUpdatesFragment extends DashBaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatedDownloadsList(List<IndexItem> list) {
|
public void updatedDownloadsList(List<IndexItem> list) {
|
||||||
|
List<IndexItem> itemList = new ArrayList<IndexItem>(list);
|
||||||
|
Collections.sort(itemList, new Comparator<IndexItem>() {
|
||||||
|
@Override
|
||||||
|
public int compare(IndexItem indexItem, IndexItem t1) {
|
||||||
|
return (int)(t1.getTimestamp() - indexItem.getTimestamp());
|
||||||
|
}
|
||||||
|
});
|
||||||
View mainView = getView();
|
View mainView = getView();
|
||||||
//it may be null because download index thread is async
|
//it may be null because download index thread is async
|
||||||
if (mainView == null) {
|
if (mainView == null) {
|
||||||
|
@ -72,20 +81,20 @@ public class DashUpdatesFragment extends DashBaseFragment {
|
||||||
baseNames.clear();
|
baseNames.clear();
|
||||||
downloadButtons.clear();
|
downloadButtons.clear();
|
||||||
mainView.findViewById(R.id.main_progress).setVisibility(View.GONE);
|
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);
|
LinearLayout updates = (LinearLayout) mainView.findViewById(R.id.updates_items);
|
||||||
updates.removeAllViews();
|
updates.removeAllViews();
|
||||||
|
|
||||||
if (list.size() < 1) {
|
if (itemList.size() < 1) {
|
||||||
mainView.findViewById(R.id.maps).setVisibility(View.GONE);
|
mainView.findViewById(R.id.maps).setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mainView.findViewById(R.id.maps).setVisibility(View.VISIBLE);
|
mainView.findViewById(R.id.maps).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < itemList.size(); i++) {
|
||||||
final IndexItem item = list.get(i);
|
final IndexItem item = itemList.get(i);
|
||||||
if (i > 2) {
|
if (i > 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue