Remove unused setting "USE_MAP_MARKERS"

This commit is contained in:
Alexander Sytnyk 2018-03-26 12:38:41 +03:00
parent 11c62326b7
commit 034a7ef41c
11 changed files with 31 additions and 69 deletions

View file

@ -157,8 +157,7 @@ public class OsmandApplication extends MultiDexApplication {
externalStorageDirectoryReadOnly = true; externalStorageDirectoryReadOnly = true;
externalStorageDirectory = osmandSettings.getInternalAppPath(); externalStorageDirectory = osmandSettings.getInternalAppPath();
} }
osmandSettings.USE_MAP_MARKERS.set(true);
checkPreferredLocale(); checkPreferredLocale();
appInitializer.onCreateApplication(); appInitializer.onCreateApplication();
// if(!osmandSettings.FOLLOW_THE_ROUTE.get()) { // if(!osmandSettings.FOLLOW_THE_ROUTE.get()) {
@ -478,9 +477,7 @@ public class OsmandApplication extends MultiDexApplication {
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);
osmandSettings.LAST_ROUTING_APPLICATION_MODE = osmandSettings.APPLICATION_MODE.get(); osmandSettings.LAST_ROUTING_APPLICATION_MODE = osmandSettings.APPLICATION_MODE.get();
osmandSettings.APPLICATION_MODE.set(osmandSettings.DEFAULT_APPLICATION_MODE.get()); osmandSettings.APPLICATION_MODE.set(osmandSettings.DEFAULT_APPLICATION_MODE.get());
if (osmandSettings.USE_MAP_MARKERS.get()) { targetPointsHelper.removeAllWayPoints(false, false);
targetPointsHelper.removeAllWayPoints(false, false);
}
} }
private void fullExit() { private void fullExit() {

View file

@ -1312,8 +1312,6 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SHOULD_SHOW_FREE_VERSION_BANNER = new BooleanPreference("should_show_free_version_banner", false).makeGlobal().cache(); public final OsmandPreference<Boolean> SHOULD_SHOW_FREE_VERSION_BANNER = new BooleanPreference("should_show_free_version_banner", false).makeGlobal().cache();
public final OsmandPreference<Boolean> USE_MAP_MARKERS = new BooleanPreference("use_map_markers", true).makeGlobal().cache();
public final OsmandPreference<Boolean> MARKERS_DISTANCE_INDICATION_ENABLED = new BooleanPreference("markers_distance_indication_enabled", true).makeProfile(); public final OsmandPreference<Boolean> MARKERS_DISTANCE_INDICATION_ENABLED = new BooleanPreference("markers_distance_indication_enabled", true).makeProfile();
public final OsmandPreference<Integer> DISPLAYED_MARKERS_WIDGETS_COUNT = new IntPreference("displayed_markers_widgets_count", 1).makeProfile(); public final OsmandPreference<Integer> DISPLAYED_MARKERS_WIDGETS_COUNT = new IntPreference("displayed_markers_widgets_count", 1).makeProfile();

View file

@ -291,8 +291,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated() if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()
&& !app.getRoutingHelper().isRouteBeingCalculated()) { && !app.getRoutingHelper().isRouteBeingCalculated()) {
FailSafeFuntions.restoreRoutingMode(this); FailSafeFuntions.restoreRoutingMode(this);
} else if (app.getSettings().USE_MAP_MARKERS.get() } else if (!app.getRoutingHelper().isRoutePlanningMode()
&& !app.getRoutingHelper().isRoutePlanningMode()
&& !settings.FOLLOW_THE_ROUTE.get() && !settings.FOLLOW_THE_ROUTE.get()
&& app.getTargetPointsHelper().getAllPoints().size() > 0) { && app.getTargetPointsHelper().getAllPoints().size() > 0) {
app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>()); app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>());

View file

@ -340,8 +340,7 @@ public class MapActivityActions implements DialogProvider {
mapActivity.showQuickSearch(latitude, longitude); mapActivity.showQuickSearch(latitude, longitude);
} else if (standardId == R.string.context_menu_item_directions_from) { } else if (standardId == R.string.context_menu_item_directions_from) {
mapActivity.getContextMenu().hide(); mapActivity.getContextMenu().hide();
if (settings.USE_MAP_MARKERS.get() if (getMyApplication().getTargetPointsHelper().getPointToNavigate() == null) {
&& getMyApplication().getTargetPointsHelper().getPointToNavigate() == null) {
setFirstMapMarkerAsTarget(); setFirstMapMarkerAsTarget();
} }
if (!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) { if (!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
@ -630,31 +629,18 @@ public class MapActivityActions implements DialogProvider {
return true; return true;
} }
}).createItem()); }).createItem());
if (settings.USE_MAP_MARKERS.get()) {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity) optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity)
.setIcon(R.drawable.ic_action_flag_dark) .setIcon(R.drawable.ic_action_flag_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() { .setListener(new ContextMenuAdapter.ItemClickListener() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_markers_open"); app.logEvent(mapActivity, "drawer_markers_open");
MapActivity.clearPrevActivityIntent(); MapActivity.clearPrevActivityIntent();
MapMarkersDialogFragment.showInstance(mapActivity); MapMarkersDialogFragment.showInstance(mapActivity);
return true; return true;
} }
}).createItem()); }).createItem());
} else {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.waypoints, mapActivity)
.setIcon(R.drawable.ic_action_intermediate)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_waypoints_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, viewCoordinates);
return false;
}
}).createItem());
}
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity) optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity)
.setIcon(R.drawable.ic_action_fav_dark) .setIcon(R.drawable.ic_action_fav_dark)

View file

@ -182,9 +182,7 @@ public class FailSafeFuntions {
private static void notRestoreRoutingMode(MapActivity ma, OsmandApplication app){ private static void notRestoreRoutingMode(MapActivity ma, OsmandApplication app){
ma.updateApplicationModeSettings(); ma.updateApplicationModeSettings();
app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>()); app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>());
if (app.getSettings().USE_MAP_MARKERS.get()) { app.getTargetPointsHelper().removeAllWayPoints(false, false);
app.getTargetPointsHelper().removeAllWayPoints(false, false);
}
ma.refreshMap(); ma.refreshMap();
} }

View file

@ -326,9 +326,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
hideDashboard(); hideDashboard();
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) { if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
mapActivity.getMapActions().stopNavigationWithoutConfirm(); mapActivity.getMapActions().stopNavigationWithoutConfirm();
if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) { getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
}
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide(); mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
} }
} }

View file

@ -753,8 +753,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (menuController != null) { if (menuController != null) {
return menuController.getWaypointActionStringId(); return menuController.getWaypointActionStringId();
} }
return settings.USE_MAP_MARKERS.get() return R.string.shared_string_add_to_map_markers;
? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point;
} }
public boolean isButtonWaypointEnabled() { public boolean isButtonWaypointEnabled() {
@ -771,8 +770,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
waypointActionIconId = menuController.getWaypointActionIconId(); waypointActionIconId = menuController.getWaypointActionIconId();
} else { } else {
favActionIconId = R.drawable.map_action_fav_dark; favActionIconId = R.drawable.map_action_fav_dark;
waypointActionIconId = settings.USE_MAP_MARKERS.get() waypointActionIconId = R.drawable.map_action_flag_dark;
? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint;
} }
} }

View file

@ -434,13 +434,11 @@ public abstract class MenuController extends BaseMenuController implements Colla
} }
public int getWaypointActionIconId() { public int getWaypointActionIconId() {
return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get() return R.drawable.map_action_flag_dark;
? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint;
} }
public int getWaypointActionStringId() { public int getWaypointActionStringId() {
return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get() return R.string.shared_string_add_to_map_markers;
? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point;
} }
public boolean isWaypointButtonEnabled() { public boolean isWaypointButtonEnabled() {

View file

@ -438,13 +438,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
if (!MenuItemCompat.isActionViewExpanded(mi)) { if (!MenuItemCompat.isActionViewExpanded(mi)) {
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_NEVER); R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
if (getSettings().USE_MAP_MARKERS.get()) { createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
} 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_NEVER);
}
createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark, createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark,
R.drawable.ic_action_fav_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER); R.drawable.ic_action_fav_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
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,

View file

@ -456,7 +456,7 @@ public class MapControlsLayer extends OsmandMapLayer {
MapActivity.clearPrevActivityIntent(); MapActivity.clearPrevActivityIntent();
RoutingHelper routingHelper = mapActivity.getRoutingHelper(); RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
if (settings.USE_MAP_MARKERS.get() && !hasTargets) { if (!hasTargets) {
getTargets().restoreTargetPoints(false); getTargets().restoreTargetPoints(false);
if (getTargets().getPointToNavigate() == null) { if (getTargets().getPointToNavigate() == null) {
mapActivity.getMapActions().setFirstMapMarkerAsTarget(); mapActivity.getMapActions().setFirstMapMarkerAsTarget();

View file

@ -168,17 +168,12 @@ public class MapInfoLayer extends OsmandMapLayer {
TextInfoWidget time = ric.createTimeControl(map); TextInfoWidget time = ric.createTimeControl(map);
registerSideWidget(time, new TimeControlWidgetState(app), "time", false, 15); registerSideWidget(time, new TimeControlWidgetState(app), "time", false, 15);
if (settings.USE_MAP_MARKERS.get()) { TextInfoWidget marker = mwf.createMapMarkerControl(map, true);
TextInfoWidget marker = mwf.createMapMarkerControl(map, true); registerSideWidget(marker, R.drawable.ic_action_flag_dark, R.string.map_marker_1st, "map_marker_1st", false, 16);
registerSideWidget(marker, R.drawable.ic_action_flag_dark, R.string.map_marker_1st, "map_marker_1st", false, 16); TextInfoWidget bearing = ric.createBearingControl(map);
TextInfoWidget bearing = ric.createBearingControl(map); registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 17);
registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 17); TextInfoWidget marker2nd = mwf.createMapMarkerControl(map, false);
TextInfoWidget marker2nd = mwf.createMapMarkerControl(map, false); registerSideWidget(marker2nd, R.drawable.ic_action_flag_dark, R.string.map_marker_2nd, "map_marker_2nd", false, 18);
registerSideWidget(marker2nd, R.drawable.ic_action_flag_dark, R.string.map_marker_2nd, "map_marker_2nd", false, 18);
} else {
TextInfoWidget bearing = ric.createBearingControl(map);
registerSideWidget(bearing, new BearingWidgetState(app), "bearing", false, 17);
}
TextInfoWidget speed = ric.createSpeedControl(map); TextInfoWidget speed = ric.createSpeedControl(map);
registerSideWidget(speed, R.drawable.ic_action_speed, R.string.map_widget_speed, "speed", false, 20); registerSideWidget(speed, R.drawable.ic_action_speed, R.string.map_widget_speed, "speed", false, 20);