Merge pull request #8383 from osmandapp/Fix_7752

Fix duplicate Tile Data, disappear menu items: Edit, Clear all tiles
This commit is contained in:
max-klaus 2020-02-04 14:33:02 +03:00 committed by GitHub
commit d951a26b7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

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

View file

@ -1236,8 +1236,8 @@ 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 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() {
@ -1248,8 +1248,8 @@ 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)
&& ((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() {