From 3bd522d523adfa425bd578f3273a8464d3ecb56a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 17 Apr 2015 01:31:52 +0200 Subject: [PATCH] Fix small issues --- .../osmand/plus/download/DownloadIndexesThread.java | 7 ++++++- .../net/osmand/plus/download/UpdatesIndexFragment.java | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 17ed5a8fdf..7d9d957b99 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -14,6 +14,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; + import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.access.AccessibleToast; @@ -26,7 +27,9 @@ import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning; import net.osmand.plus.helpers.DatabaseHelper; import net.osmand.plus.resources.ResourceManager; import net.osmand.util.Algorithms; + import org.apache.commons.logging.Log; + import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.ActivityNotFoundException; @@ -125,7 +128,9 @@ public class DownloadIndexesThread { return indexFiles != null && indexFiles.isDownloadedFromInternet(); } - public List getItemsToUpdate() { return itemsToUpdate;} + public List getItemsToUpdate() { + return itemsToUpdate; + } public class DownloadIndexesAsyncTask extends BasicProgressAsyncTask implements DownloadFileShowWarning { diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index 57a2fa15e5..dbee5f8348 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -17,7 +17,6 @@ import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; - import net.osmand.access.AccessibleToast; import net.osmand.map.OsmandRegions; import net.osmand.plus.OsmandApplication; @@ -105,7 +104,11 @@ public class UpdatesIndexFragment extends ListFragment { updateHeader(); if (indexItems.size() == 0) { indexItems.clear(); - indexItems.add(new IndexItem(getString(R.string.everything_up_to_date), "", 0, "", 0, 0, null)); + if (DownloadActivity.downloadListIndexThread.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)); + } } listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, indexItems); listAdapter.sort(new Comparator() { @@ -267,7 +270,8 @@ public class UpdatesIndexFragment extends ListFragment { TextView updateDescr = (TextView) v.findViewById(R.id.update_descr); final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item); IndexItem e = items.get(position); - if (e.getFileName().equals(getString(R.string.everything_up_to_date))) { + if (e.getFileName().equals(getString(R.string.everything_up_to_date)) || + e.getFileName().equals(getString(R.string.no_index_file_to_download))) { name.setText(e.getFileName()); description.setText(""); ch.setVisibility(View.INVISIBLE);