Fix review

This commit is contained in:
Dima-1 2020-10-28 21:11:06 +02:00
parent 6112b20a6d
commit 890d41a56f
20 changed files with 81 additions and 59 deletions

View file

@ -58,7 +58,7 @@ import java.util.List;
import java.util.Map;
import static net.osmand.plus.osmedit.AdvancedEditPoiFragment.addPoiToStringSet;
import static net.osmand.plus.osmedit.EditPoiData.POI_TYPE_TAG;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class AddPOIAction extends QuickAction {
public static final QuickActionType TYPE = new QuickActionType(13,
@ -140,7 +140,7 @@ public class AddPOIAction extends QuickAction {
Node newNode = new Node(node.getLatitude(), node.getLongitude(), node.getId());
OsmPoint.Action action = newNode.getId() < 0 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
for (Map.Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)) {
if (tag.getKey().equals(POI_TYPE_TAG)) {
final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(tag.getValue().trim().toLowerCase());
if (poiType != null) {
newNode.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue());

View file

@ -28,6 +28,7 @@ import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Entity;
import net.osmand.osm.edit.OSMSettings;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -112,7 +113,7 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
if (Algorithms.objectEquals(anyTag, OSMSettings.OSMTagKey.NAME.getValue())) {
updateName();
}
if (Algorithms.objectEquals(anyTag, EditPoiData.POI_TYPE_TAG)) {
if (Algorithms.objectEquals(anyTag, Entity.POI_TYPE_TAG)) {
updatePoiType();
}
}
@ -197,9 +198,9 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
currentPoiTypeKey = pt.getEditOsmTag();
}
for (Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)
if (tag.getKey().equals(Entity.POI_TYPE_TAG)
|| tag.getKey().equals(OSMSettings.OSMTagKey.NAME.getValue())
|| tag.getKey().startsWith(EditPoiData.REMOVE_TAG_PREFIX)
|| tag.getKey().startsWith(Entity.REMOVE_TAG_PREFIX)
|| tag.getKey().equals(currentPoiTypeKey))
continue;
addTagView(tag.getKey(), tag.getValue());

View file

@ -5,6 +5,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Entity;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
@ -12,6 +13,8 @@ import net.osmand.plus.render.RenderingIcons;
import java.util.Map;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class EditPOIMenuBuilder extends MenuBuilder {
private final OsmPoint osmPoint;
@ -38,7 +41,7 @@ public class EditPOIMenuBuilder extends MenuBuilder {
OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint;
for (Map.Entry<String, String> e : point.getEntity().getTags().entrySet()) {
if (EditPoiData.POI_TYPE_TAG.equals(e.getKey())) {
if (POI_TYPE_TAG.equals(e.getKey())) {
String poiTranslation = e.getValue();
Map<String, PoiType> poiTypeMap = app.getPoiTypes().getAllTranslatedNames(false);
PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());
@ -63,8 +66,8 @@ public class EditPOIMenuBuilder extends MenuBuilder {
}
for (Map.Entry<String, String> e : point.getEntity().getTags().entrySet()) {
if (EditPoiData.POI_TYPE_TAG.equals(e.getKey()) ||
e.getKey().startsWith(EditPoiData.REMOVE_TAG_PREFIX)) {
if (POI_TYPE_TAG.equals(e.getKey()) ||
e.getKey().startsWith(Entity.REMOVE_TAG_PREFIX)) {
continue;
}
String text = e.getKey() + "=" + e.getValue();

View file

@ -18,6 +18,8 @@ import net.osmand.util.Algorithms;
import java.util.Map;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class EditPOIMenuController extends MenuController {
private OsmPoint osmPoint;
@ -166,7 +168,7 @@ public class EditPOIMenuController extends MenuController {
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
int iconResId = 0;
String poiTranslation = osmP.getEntity().getTag(EditPoiData.POI_TYPE_TAG);
String poiTranslation = osmP.getEntity().getTag(POI_TYPE_TAG);
MapActivity mapActivity = getMapActivity();
if (poiTranslation != null && mapActivity != null) {
Map<String, PoiType> poiTypeMap = mapActivity.getMyApplication().getPoiTypes().getAllTranslatedNames(false);

View file

@ -17,15 +17,15 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class EditPoiData {
private static final Log LOG = PlatformUtil.getLog(EditPoiData.class);
private Set<TagsChangedListener> mListeners = new HashSet<>();
private LinkedHashMap<String, String > tagValues = new LinkedHashMap<String, String>();
private final LinkedHashMap<String, String> tagValues = new LinkedHashMap<String, String>();
private boolean isInEdit = false;
private Entity entity;
public static final String POI_TYPE_TAG = "poi_type_tag";
public static final String REMOVE_TAG_PREFIX = "----";
public static final String REMOVE_TAG_VALUE = "DELETE";
private boolean hasChangesBeenMade = false;
private Map<String, PoiType> allTranslatedSubTypes;
@ -123,7 +123,7 @@ public class EditPoiData {
checkNotInEdit();
try {
isInEdit = true;
tagValues.remove(REMOVE_TAG_PREFIX+tag);
tagValues.remove(Entity.REMOVE_TAG_PREFIX + tag);
String oldValue = tagValues.get(tag);
if (oldValue == null || !oldValue.equals(value)) {
changedTags.add(tag);
@ -154,9 +154,9 @@ public class EditPoiData {
public void removeTag(String tag) {
checkNotInEdit();
try {
try {
isInEdit = true;
tagValues.put(REMOVE_TAG_PREFIX+tag, REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + tag, REMOVE_TAG_VALUE);
tagValues.remove(tag);
changedTags.remove(tag);
notifyDatasetChanged(tag);
@ -216,7 +216,7 @@ public class EditPoiData {
PoiType pt = getPoiTypeDefined();
String editOsmTag = pt != null ? pt.getEditOsmTag() : null;
if (editOsmTag != null) {
removeTypeTagWithPrefix(!tagValues.containsKey(REMOVE_TAG_PREFIX + editOsmTag));
removeTypeTagWithPrefix(!tagValues.containsKey(Entity.REMOVE_TAG_PREFIX + editOsmTag));
currentPoiType = pt;
String tagVal = pt.getEditOsmValue() != null ? pt.getEditOsmValue() : "";
tagValues.put(editOsmTag, tagVal);
@ -237,11 +237,11 @@ public class EditPoiData {
private void removeTypeTagWithPrefix(boolean needRemovePrefix) {
if (currentPoiType != null) {
if (needRemovePrefix) {
tagValues.put(REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2(), REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2(), REMOVE_TAG_VALUE);
} else {
tagValues.remove(REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag());
tagValues.remove(REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2());
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag());
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2());
}
removeCurrentTypeTag();
}

View file

@ -90,6 +90,8 @@ import java.util.Set;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = EditPoiDialogFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class);
@ -499,21 +501,21 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
Action action = entity.getId() < 0 ? Action.CREATE : Action.MODIFY;
for (Map.Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue()) &&
!tag.getKey().equals(EditPoiData.POI_TYPE_TAG)) {
if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue()) &&
!tag.getKey().equals(POI_TYPE_TAG)) {
entity.putTagNoLC(tag.getKey(), tag.getValue());
}
}
String poiTypeTag = editPoiData.getTagValues().get(EditPoiData.POI_TYPE_TAG);
String poiTypeTag = editPoiData.getTagValues().get(POI_TYPE_TAG);
String comment = "";
if (poiTypeTag != null) {
final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(poiTypeTag.trim().toLowerCase());
if (poiType != null) {
entity.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue());
entity.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getEditOsmTag());
entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getEditOsmTag());
if (poiType.getOsmTag2() != null) {
entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
entity.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
}
} else if (!Algorithms.isEmpty(poiTypeTag)) {
PoiCategory category = editPoiData.getPoiCategory();
@ -522,7 +524,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}
}
if (offlineEdit && !Algorithms.isEmpty(poiTypeTag)) {
entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiTypeTag);
entity.putTagNoLC(POI_TYPE_TAG, poiTypeTag);
}
String actionString = action == Action.CREATE ? getString(R.string.default_changeset_add) : getString(R.string.default_changeset_edit);
comment = actionString + " " + poiTypeTag;

View file

@ -24,6 +24,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
@ -122,7 +124,7 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
entity = new Node(loc.getLatitude(), loc.getLongitude(), entityId);
}
if (poiType != null) {
entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
entity.putTagNoLC(POI_TYPE_TAG, poiType.getTranslation());
if (poiType.getOsmTag2() != null) {
entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
}

View file

@ -28,7 +28,7 @@ public class OpenstreetmapPoint extends OsmPoint {
String type = "amenity";
for (String k : entity.getTagKeySet()) {
if (!OSMTagKey.NAME.getValue().equals(k) && !OSMTagKey.OPENING_HOURS.getValue().equals(k) &&
!k.startsWith(EditPoiData.REMOVE_TAG_PREFIX)) {
!k.startsWith(Entity.REMOVE_TAG_PREFIX)) {
type = k;
break;
}

View file

@ -39,7 +39,8 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
@ -273,8 +274,8 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
throws IllegalArgumentException, IllegalStateException, IOException {
for (String k : entity.getTagKeySet()) {
String val = entity.getTag(k);
if (val.length() == 0 || k.length() == 0 || EditPoiData.POI_TYPE_TAG.equals(k) ||
k.startsWith(EditPoiData.REMOVE_TAG_PREFIX) || k.contains(EditPoiData.REMOVE_TAG_PREFIX))
if (val.length() == 0 || k.length() == 0 || POI_TYPE_TAG.equals(k) ||
k.startsWith(Entity.REMOVE_TAG_PREFIX) || k.contains(Entity.REMOVE_TAG_PREFIX))
continue;
ser.startTag(null, "tag"); //$NON-NLS-1$
ser.attribute(null, "k", k); //$NON-NLS-1$
@ -455,7 +456,7 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
}
private boolean deletedTag(Entity entity, String tag) {
return entity.getTagKeySet().contains(EditPoiData.REMOVE_TAG_PREFIX + tag);
return entity.getTagKeySet().contains(Entity.REMOVE_TAG_PREFIX + tag);
}
@Override
@ -542,12 +543,12 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
PoiType poiType = type.getPoiTypeByKeyName(subType);
if (poiType != null && poiType.getEditOsmValue().equals(entity.getTag(poiType.getEditOsmTag()))) {
entity.removeTag(poiType.getEditOsmTag());
entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
entity.putTagNoLC(POI_TYPE_TAG, poiType.getTranslation());
} else {
for (PoiType pt : type.getPoiTypes()) {
if (pt.getEditOsmValue().equals(entity.getTag(pt.getEditOsmTag()))) {
entity.removeTag(pt.getEditOsmTag());
entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, pt.getTranslation());
entity.putTagNoLC(POI_TYPE_TAG, pt.getTranslation());
}
}
}

View file

@ -61,6 +61,7 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_C
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_EDITS;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_NOTES;
import static net.osmand.osm.edit.Entity.POI_TYPE_TAG;
import static net.osmand.plus.ContextMenuAdapter.makeDeleteAction;
@ -554,7 +555,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
public static String getCategory(OsmPoint osmPoint, Context context) {
String category = "";
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(POI_TYPE_TAG);
if (Algorithms.isEmpty(category)) {
category = context.getString(R.string.shared_string_without_name);
}

View file

@ -17,6 +17,7 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Entity;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -244,7 +245,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
if (point.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint osmPoint = (OpenstreetmapPoint) point;
int iconResId = 0;
String poiTranslation = osmPoint.getEntity().getTag(EditPoiData.POI_TYPE_TAG);
String poiTranslation = osmPoint.getEntity().getTag(Entity.POI_TYPE_TAG);
if (poiTranslation != null) {
Map<String, PoiType> poiTypeMap = app.getPoiTypes().getAllTranslatedNames(false);
PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());

View file

@ -101,7 +101,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
int iconResId = 0;
String poiTranslation = osmP.getEntity().getTag(EditPoiData.POI_TYPE_TAG);
String poiTranslation = osmP.getEntity().getTag(Entity.POI_TYPE_TAG);
if (poiTranslation != null && activity != null) {
Map<String, PoiType> poiTypeMap = activity.getMyApplication().getPoiTypes().getAllTranslatedNames(false);
PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());

View file

@ -16,13 +16,13 @@ import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.DialogFragment;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Entity;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ProgressDialogFragment;
import net.osmand.plus.osmedit.EditPoiData;
import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmBugsLayer;
import net.osmand.plus.osmedit.OsmEditingPlugin;
@ -152,7 +152,7 @@ public class SendPoiDialogFragment extends DialogFragment {
for (OsmPoint p : poi) {
if (p.getGroup() == OsmPoint.Group.POI) {
OsmPoint.Action action = p.getAction();
String type = ((OpenstreetmapPoint) p).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
String type = ((OpenstreetmapPoint) p).getEntity().getTag(Entity.POI_TYPE_TAG);
if (type == null) {
continue;
}

View file

@ -45,6 +45,10 @@ public class FileSettingsItem extends StreamSettingsItem {
this.subtypeFolder = subtypeFolder;
}
public boolean isMap() {
return this == OBF_MAP || this == WIKI_MAP || this == SRTM_MAP;
}
public String getSubtypeName() {
return subtypeName;
}

View file

@ -10,6 +10,7 @@ import com.google.gson.reflect.TypeToken;
import net.osmand.osm.edit.Entity;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.Way;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
@ -78,9 +79,8 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem<OpenstreetmapPo
}
}
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
OpenstreetmapsDbHelper db;
if (osmEditingPlugin != null) {
db = osmEditingPlugin.getDBPOI();
OpenstreetmapsDbHelper db = osmEditingPlugin.getDBPOI();
for (OpenstreetmapPoint point : appliedItems) {
db.addOpenstreetmap(point);
}
@ -137,7 +137,13 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem<OpenstreetmapPo
);
String action = entityJson.getString(ACTION_KEY);
Entity entity;
entity = new Node(lat, lon, id);
if (entityJson.get(TYPE_KEY).equals(Entity.EntityType.NODE.name())) {
entity = new Node(lat, lon, id);
} else {
entity = new Way(id);
entity.setLatitude(lat);
entity.setLongitude(lon);
}
entity.replaceTags(tagMap);
OpenstreetmapPoint point = new OpenstreetmapPoint();
point.setComment(comment);

View file

@ -67,9 +67,8 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
}
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
OsmBugsDbHelper db;
if (osmEditingPlugin != null) {
db = osmEditingPlugin.getDBBug();
OsmBugsDbHelper db = osmEditingPlugin.getDBBug();
for (OsmNotesPoint point : appliedItems) {
db.addOsmbugs(point);
}

View file

@ -86,7 +86,7 @@ class SettingsImporter {
Enumeration<? extends ZipEntry> zipEnum = zipfile.entries();
while (zipEnum.hasMoreElements()) {
ZipEntry zipEntry = zipEnum.nextElement();
int size = (int) zipEntry.getSize();
long size = zipEntry.getSize();
for (SettingsItem settingsItem : settingsItemList) {
if (settingsItem instanceof FileSettingsItem
&& zipEntry.getName().equals(settingsItem.getFileName())) {

View file

@ -13,11 +13,6 @@ public enum SettingsItemType {
AVOID_ROADS,
SUGGESTED_DOWNLOADS,
DOWNLOADS,
MARKERS,
FAVORITES,
TRACKS,
AUDIO_VIDEO_NOTES,
OSM_NOTES,
OSM_EDITS,
OFFLINE_MAPS
}

View file

@ -269,12 +269,20 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
setupIcon(icon, R.drawable.ic_action_info_dark, itemSelected);
break;
case OFFLINE_MAPS:
FileSettingsItem currentFileItem = (FileSettingsItem) currentItem;
file = currentFileItem.getFile();
long size;
if (currentItem instanceof FileSettingsItem) {
FileSettingsItem currentFileItem = (FileSettingsItem) currentItem;
file = currentFileItem.getFile();
size = currentFileItem.getSize();
} else {
file = (File) currentItem;
size = file.length();
}
title.setText(FileNameTranslationHelper.getFileName(app,
app.getResourceManager().getOsmandRegions(),
file.getName()));
FileSubtype subtype = FileSubtype.getSubtypeByFileName(file.getPath().replace(app.getAppPath(null).getPath(), ""));
FileSubtype subtype = FileSubtype.getSubtypeByFileName(file.getPath().replace(
app.getAppPath(null).getPath(), ""));
switch (subtype) {
case SRTM_MAP:
iconId = R.drawable.ic_plugin_srtm;
@ -286,7 +294,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
iconId = R.drawable.ic_map;
}
setupIcon(icon, iconId, itemSelected);
subText.setText(AndroidUtils.formatSize(app, currentFileItem.getSize()));
subText.setText(AndroidUtils.formatSize(app, size));
subText.setVisibility(View.VISIBLE);
break;
default:

View file

@ -71,9 +71,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.settings.backend.backup.FileSettingsItem.FileSubtype.*;
public class ImportSettingsFragment extends BaseOsmAndFragment
implements View.OnClickListener {
@ -287,7 +284,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
private void reloadIndexes(@NonNull List<SettingsItem> items) {
for (SettingsItem item : items) {
if (item instanceof FileSettingsItem && ((FileSettingsItem) item).getSubtype() == OBF_MAP) {
if (item instanceof FileSettingsItem && ((FileSettingsItem) item).getSubtype().isMap()) {
Activity activity = getActivity();
if (activity instanceof MapActivity) {
new ReloadIndexesTack((MapActivity) activity).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);