Fix duplicate Tile Data, disappear menu items: Edit, Clear all tiles

This commit is contained in:
Dima-1 2020-02-04 10:24:19 +02:00
parent a3ea96d387
commit 3970859278
2 changed files with 4 additions and 7 deletions

View file

@ -75,9 +75,8 @@ public class LocalIndexHelper {
return; return;
} }
String descr = " "; String descr = " ";
descr += app.getString(R.string.local_index_tile_data_name, template.getName());
if (template.getExpirationTimeMinutes() >= 0) { 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.setAttachedObject(template);
info.setDescription(descr); info.setDescription(descr);

View file

@ -1236,8 +1236,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
return true; 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()) {
item = optionsMenu.getMenu().add(R.string.shared_string_edit) item = optionsMenu.getMenu().add(R.string.shared_string_edit)
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark)); .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { 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) && if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource)) {
((ITileSource)info.getAttachedObject()).couldBeDownloadedFromInternet()) {
item = optionsMenu.getMenu().add(R.string.clear_tile_data) item = optionsMenu.getMenu().add(R.string.clear_tile_data)
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark)); .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {