From 39708592784cc506da92bc36e5ea1b5320052c1a Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 4 Feb 2020 10:24:19 +0200 Subject: [PATCH 1/3] Fix duplicate Tile Data, disappear menu items: Edit, Clear all tiles --- OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java | 5 ++--- .../net/osmand/plus/download/ui/LocalIndexesFragment.java | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index 240d3492d3..8f432fdd0b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -74,10 +74,9 @@ public class LocalIndexHelper { } else { return; } - String descr = ""; - descr += app.getString(R.string.local_index_tile_data_name, template.getName()); + String descr = " "; if (template.getExpirationTimeMinutes() >= 0) { - descr += "\n" + app.getString(R.string.local_index_tile_data_expire, template.getExpirationTimeMinutes()); + descr += app.getString(R.string.local_index_tile_data_expire, String.valueOf(template.getExpirationTimeMinutes())); } info.setAttachedObject(template); info.setDescription(descr); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 72d55890dd..8a92c96fa2 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -1236,8 +1236,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement return true; } }); - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) && - ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) { + if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)) { item = optionsMenu.getMenu().add(R.string.shared_string_edit) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @@ -1248,8 +1247,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement } }); } - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) && - ((ITileSource)info.getAttachedObject()).couldBeDownloadedFromInternet()) { + if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)) { item = optionsMenu.getMenu().add(R.string.clear_tile_data) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { From e7e209431bab8162406950ce9f17ce81bca6ab20 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 4 Feb 2020 12:47:51 +0200 Subject: [PATCH 2/3] Fix duplicate Tile Data, disappear menu items: Edit, Clear all tiles --- .../src/net/osmand/plus/activities/LocalIndexHelper.java | 3 +-- .../net/osmand/plus/download/ui/LocalIndexesFragment.java | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index 8f432fdd0b..c59dab87fe 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -2,7 +2,6 @@ package net.osmand.plus.activities; import android.content.Context; -import android.os.Build; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; @@ -74,7 +73,7 @@ public class LocalIndexHelper { } else { return; } - String descr = " "; + String descr = ""; if (template.getExpirationTimeMinutes() >= 0) { descr += app.getString(R.string.local_index_tile_data_expire, String.valueOf(template.getExpirationTimeMinutes())); } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 8a92c96fa2..790753c723 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -1236,7 +1236,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement return true; } }); - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)) { + if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) + && ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet() + || info.getAttachedObject() instanceof TileSourceManager.TileSourceTemplate) { item = optionsMenu.getMenu().add(R.string.shared_string_edit) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @@ -1247,7 +1249,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement } }); } - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)) { + if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) + && ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) { item = optionsMenu.getMenu().add(R.string.clear_tile_data) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { From ad6a2bf4133f943251f64aa60c3e0cf7b7c23ed4 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 4 Feb 2020 13:28:12 +0200 Subject: [PATCH 3/3] Fix condition --- .../net/osmand/plus/download/ui/LocalIndexesFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 790753c723..3d59779e6b 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -1236,9 +1236,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement return true; } }); - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) - && ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet() - || info.getAttachedObject() instanceof TileSourceManager.TileSourceTemplate) { + if (info.getType() == LocalIndexType.TILES_DATA + && (info.getAttachedObject() instanceof TileSourceManager.TileSourceTemplate)) { item = optionsMenu.getMenu().add(R.string.shared_string_edit) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {