diff --git a/OsmAnd/res/layout/update_index_frament.xml b/OsmAnd/res/layout/update_index_frament.xml
index 157a8add1b..f975a1d1a3 100644
--- a/OsmAnd/res/layout/update_index_frament.xml
+++ b/OsmAnd/res/layout/update_index_frament.xml
@@ -6,6 +6,18 @@
android:layout_height="match_parent"
android:orientation="vertical">
+
+
{
public IndexItem(String fileName, String description, long timestamp, String size, long contentSize,
- long containerSize, DownloadActivityType tp) {
+ long containerSize, @NonNull DownloadActivityType tp) {
this.fileName = fileName;
this.description = description;
this.timestamp = timestamp;
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
index fb44927809..1297e547ba 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
@@ -31,7 +31,6 @@ import android.widget.Toast;
public class ItemViewHolder {
-
protected final TextView nameTextView;
protected final TextView descrTextView;
protected final ImageView leftImageView;
@@ -206,7 +205,7 @@ public class ItemViewHolder {
rightImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(silentCancelDownload) {
+ if (silentCancelDownload) {
context.getDownloadThread().cancelDownload(indexItem);
} else {
context.makeSureUserCancelDownload(indexItem);
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
index 7cf399235a..a4b78919b5 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
@@ -41,7 +41,13 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.update_index_frament, container, false);
}
-
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ updateErrorMessage();
+ }
+
@Override
public ArrayAdapter> getAdapter() {
return listAdapter;
@@ -67,13 +73,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
public void invalidateListView() {
DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
List indexItems = indexes.getItemsToUpdate();
- if (indexItems.size() == 0) {
- if (indexes.isDownloadedFromInternet) {
- indexItems.add(new IndexItem(getString(R.string.everything_up_to_date), "", 0, "", 0, 0, null));
- } else {
- indexItems.add(new IndexItem(getString(R.string.no_index_file_to_download), "", 0, "", 0, 0, null));
- }
- }
+
final OsmandRegions osmandRegions =
getMyApplication().getResourceManager().getOsmandRegions();
listAdapter = new UpdateIndexAdapter(getMyActivity(), R.layout.download_index_list_item, indexItems);
@@ -85,6 +85,24 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
}
});
setListAdapter(listAdapter);
+ updateErrorMessage();
+
+ }
+
+ private void updateErrorMessage() {
+ final View view = getView();
+ if (view == null) return;
+ TextView listMessageTextView = (TextView) view.findViewById(R.id.listMessageTextView);
+
+ if (getListAdapter() != null && getListAdapter().getCount() == 0) {
+ final DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
+ int messageId = indexes.isDownloadedFromInternet ? R.string.everything_up_to_date
+ : R.string.no_index_file_to_download;
+ listMessageTextView.setText(messageId);
+ listMessageTextView.setVisibility(View.VISIBLE);
+ } else {
+ listMessageTextView.setVisibility(View.GONE);
+ }
}
private void updateUpdateAllButton() {