Remove unnecessary check "USE_MAP_MARKERS.get()" in some places
This commit is contained in:
parent
f13dacdc7c
commit
cfaf04e3b2
5 changed files with 36 additions and 60 deletions
|
@ -41,7 +41,6 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.base.OsmandExpandableListFragment;
|
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -58,7 +57,6 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -347,13 +345,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
|
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
|
||||||
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
if (getSettings().USE_MAP_MARKERS.get()) {
|
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag_dark,
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag_dark,
|
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
|
||||||
} else {
|
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_destination_and_intermediate_points, R.drawable.ic_action_intermediate,
|
|
||||||
R.drawable.ic_action_intermediate, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
|
||||||
}
|
|
||||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
|
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
|
||||||
R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
// createMenuItem(menu, EXPORT_ID, R.string.shared_string_export, R.drawable.ic_action_gsave_light,
|
// createMenuItem(menu, EXPORT_ID, R.string.shared_string_export, R.drawable.ic_action_gsave_light,
|
||||||
|
@ -383,15 +376,9 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
enableSelectionMode(true);
|
enableSelectionMode(true);
|
||||||
if (getSettings().USE_MAP_MARKERS.get()) {
|
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
|
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark,
|
||||||
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark,
|
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
} else {
|
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_destination_and_intermediate_points,
|
|
||||||
R.drawable.ic_action_intermediate, R.drawable.ic_action_intermediate,
|
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
}
|
|
||||||
favoritesSelected.clear();
|
favoritesSelected.clear();
|
||||||
groupsToDelete.clear();
|
groupsToDelete.clear();
|
||||||
favouritesAdapter.notifyDataSetInvalidated();
|
favouritesAdapter.notifyDataSetInvalidated();
|
||||||
|
|
|
@ -836,23 +836,18 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
RenameMarkerBottomSheetDialogFragment
|
RenameMarkerBottomSheetDialogFragment
|
||||||
.showInstance(mapActivity.getSupportFragmentManager(), marker);
|
.showInstance(mapActivity.getSupportFragmentManager(), marker);
|
||||||
} else if (settings.USE_MAP_MARKERS.get()) {
|
} else if (pointDescription.isMapMarker()) {
|
||||||
if (pointDescription.isMapMarker()) {
|
hide();
|
||||||
hide();
|
MapActivity.clearPrevActivityIntent();
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapMarkersDialogFragment.showInstance(mapActivity);
|
||||||
MapMarkersDialogFragment.showInstance(mapActivity);
|
|
||||||
} else {
|
|
||||||
String mapObjectName = null;
|
|
||||||
if (object instanceof Amenity) {
|
|
||||||
Amenity amenity = (Amenity) object;
|
|
||||||
mapObjectName = amenity.getName() + "_" + amenity.getType().getKeyName();
|
|
||||||
}
|
|
||||||
mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(),
|
|
||||||
getPointDescriptionForMarker(), mapObjectName);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
String mapObjectName = null;
|
||||||
getPointDescriptionForTarget());
|
if (object instanceof Amenity) {
|
||||||
|
Amenity amenity = (Amenity) object;
|
||||||
|
mapObjectName = amenity.getName() + "_" + amenity.getType().getKeyName();
|
||||||
|
}
|
||||||
|
mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(),
|
||||||
|
getPointDescriptionForMarker(), mapObjectName);
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
widgetsFactory.updateInfo(useFingerLocation ? fingerLocation : null, tileBox.getZoom());
|
widgetsFactory.updateInfo(useFingerLocation ? fingerLocation : null, tileBox.getZoom());
|
||||||
OsmandSettings settings = map.getMyApplication().getSettings();
|
OsmandSettings settings = map.getMyApplication().getSettings();
|
||||||
|
|
||||||
if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) {
|
if (tileBox.getZoom() < 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
if (tileBox.getZoom() < 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
amenities.clear();
|
amenities.clear();
|
||||||
|
|
|
@ -185,10 +185,6 @@ public class MapMarkersWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInfo(LatLon customLocation, int zoom) {
|
public void updateInfo(LatLon customLocation, int zoom) {
|
||||||
if (!map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customLocation != null) {
|
if (customLocation != null) {
|
||||||
loc = customLocation;
|
loc = customLocation;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -321,26 +321,24 @@ public class MapWidgetRegistry {
|
||||||
if (mode != ApplicationMode.DEFAULT) {
|
if (mode != ApplicationMode.DEFAULT) {
|
||||||
addControlId(map, cm, R.string.map_widget_top_text, settings.SHOW_STREET_NAME);
|
addControlId(map, cm, R.string.map_widget_top_text, settings.SHOW_STREET_NAME);
|
||||||
}
|
}
|
||||||
if (settings.USE_MAP_MARKERS.get()) {
|
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, map)
|
||||||
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, map)
|
.setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map))
|
||||||
.setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map))
|
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
@Override
|
||||||
@Override
|
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int position, boolean isChecked, int[] viewCoordinates) {
|
||||||
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int position, boolean isChecked, int[] viewCoordinates) {
|
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
|
||||||
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
|
fragment.setListener(new DirectionIndicationDialogFragment.DirectionIndicationFragmentListener() {
|
||||||
fragment.setListener(new DirectionIndicationDialogFragment.DirectionIndicationFragmentListener() {
|
@Override
|
||||||
@Override
|
public void onMapMarkersModeChanged(boolean showDirectionEnabled) {
|
||||||
public void onMapMarkersModeChanged(boolean showDirectionEnabled) {
|
updateMapMarkersMode(map);
|
||||||
updateMapMarkersMode(map);
|
cm.getItem(position).setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map));
|
||||||
cm.getItem(position).setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map));
|
adapter.notifyDataSetChanged();
|
||||||
adapter.notifyDataSetChanged();
|
}
|
||||||
}
|
});
|
||||||
});
|
fragment.show(map.getSupportFragmentManager(), DirectionIndicationDialogFragment.TAG);
|
||||||
fragment.show(map.getSupportFragmentManager(), DirectionIndicationDialogFragment.TAG);
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}).setLayout(R.layout.list_item_text_button).createItem());
|
||||||
}).setLayout(R.layout.list_item_text_button).createItem());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMapMarkersMode(MapActivity mapActivity) {
|
public void updateMapMarkersMode(MapActivity mapActivity) {
|
||||||
|
|
Loading…
Reference in a new issue