From acb464e8ccbb161c3353e13cbc06b6cb29dee6e7 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 20 Mar 2020 17:18:12 +0100 Subject: [PATCH] Refactorign continue --- .../plus/quickaction/QuickActionFactory.java | 273 +----------------- .../plus/quickaction/QuickActionType.java | 25 +- .../quickaction/actions/AddPOIAction.java | 6 +- .../quickaction/actions/FavoriteAction.java | 6 +- .../plus/quickaction/actions/GPXAction.java | 6 +- .../quickaction/actions/MarkerAction.java | 7 +- .../actions/NavAddDestinationAction.java | 7 +- .../NavAddFirstIntermediateAction.java | 6 +- .../actions/NavAutoZoomMapAction.java | 7 +- .../actions/NavDirectionsFromAction.java | 6 +- .../actions/NavReplaceDestinationAction.java | 6 +- .../actions/NavResumePauseAction.java | 7 +- .../actions/NavStartStopAction.java | 8 +- .../quickaction/actions/NavVoiceAction.java | 6 +- .../plus/quickaction/actions/NewAction.java | 7 +- 15 files changed, 102 insertions(+), 281 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java index 342d2b80a1..8dbda6ae80 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java @@ -71,6 +71,7 @@ public class QuickActionFactory { public static List getActionTypes() { List quickActionsTypes = new ArrayList<>(); + quickActionsTypes.add(NewAction.TYPE); quickActionsTypes.add(FavoriteAction.TYPE); quickActionsTypes.add(GPXAction.TYPE); quickActionsTypes.add(MarkerAction.TYPE); @@ -160,213 +161,28 @@ public class QuickActionFactory { } public static QuickAction newActionByType(int type) { - // FIXME - switch (type) { - - case NewAction.TYPE: - return new NewAction(); - - case MarkerAction.TYPE: - return new MarkerAction(); - - case FavoriteAction.TYPE: - return new FavoriteAction(); - - case ShowHideFavoritesAction.TYPE: - return new ShowHideFavoritesAction(); - - case ShowHidePoiAction.TYPE: - return new ShowHidePoiAction(); - - case GPXAction.TYPE: - return new GPXAction(); - - case ParkingAction.TYPE: - return new ParkingAction(); - - case TakeAudioNoteAction.TYPE: - return new TakeAudioNoteAction(); - - case TakePhotoNoteAction.TYPE: - return new TakePhotoNoteAction(); - - case TakeVideoNoteAction.TYPE: - return new TakeVideoNoteAction(); - - case NavVoiceAction.TYPE: - return new NavVoiceAction(); - - case ShowHideOSMBugAction.TYPE: - return new ShowHideOSMBugAction(); - - case AddPOIAction.TYPE: - return new AddPOIAction(); - - case MapStyleAction.TYPE: - return new MapStyleAction(); - - case MapSourceAction.TYPE: - return new MapSourceAction(); - - case MapOverlayAction.TYPE: - return new MapOverlayAction(); - - case MapUnderlayAction.TYPE: - return new MapUnderlayAction(); - - case NavDirectionsFromAction.TYPE: - return new NavDirectionsFromAction(); - - case NavAddDestinationAction.TYPE: - return new NavAddDestinationAction(); - - case NavAddFirstIntermediateAction.TYPE: - return new NavAddFirstIntermediateAction(); - - case NavReplaceDestinationAction.TYPE: - return new NavReplaceDestinationAction(); - - case NavAutoZoomMapAction.TYPE: - return new NavAutoZoomMapAction(); - - case NavStartStopAction.TYPE: - return new NavStartStopAction(); - - case NavResumePauseAction.TYPE: - return new NavResumePauseAction(); - - case DayNightModeAction.TYPE: - return new DayNightModeAction(); - - case ShowHideGpxTracksAction.TYPE: - return new ShowHideGpxTracksAction(); - - case ContourLinesAction.TYPE: - return new ContourLinesAction(); - - case HillshadeAction.TYPE: - return new HillshadeAction(); - - default: - return new QuickAction(); + for(QuickActionType t : getActionTypes()) { + if(t.getId() == type) { + return t.createNew(); + } } + return new QuickAction(); } public static QuickAction produceAction(QuickAction quickAction) { - // FIXME - switch (quickAction.type) { - - case NewAction.TYPE: - return new NewAction(quickAction); - - case MarkerAction.TYPE: - return new MarkerAction(quickAction); - - case FavoriteAction.TYPE: - return new FavoriteAction(quickAction); - - case ShowHideFavoritesAction.TYPE: - return new ShowHideFavoritesAction(quickAction); - - case ShowHidePoiAction.TYPE: - return new ShowHidePoiAction(quickAction); - - case GPXAction.TYPE: - return new GPXAction(quickAction); - - case ParkingAction.TYPE: - return new ParkingAction(quickAction); - - case TakeAudioNoteAction.TYPE: - return new TakeAudioNoteAction(quickAction); - - case TakePhotoNoteAction.TYPE: - return new TakePhotoNoteAction(quickAction); - - case TakeVideoNoteAction.TYPE: - return new TakeVideoNoteAction(quickAction); - - case NavVoiceAction.TYPE: - return new NavVoiceAction(quickAction); - - case ShowHideOSMBugAction.TYPE: - return new ShowHideOSMBugAction(quickAction); - - case AddPOIAction.TYPE: - return new AddPOIAction(quickAction); - - case MapStyleAction.TYPE: - return new MapStyleAction(quickAction); - - case MapSourceAction.TYPE: - return new MapSourceAction(quickAction); - - case MapOverlayAction.TYPE: - return new MapOverlayAction(quickAction); - - case MapUnderlayAction.TYPE: - return new MapUnderlayAction(quickAction); - - case NavDirectionsFromAction.TYPE: - return new NavDirectionsFromAction(quickAction); - - case NavAddDestinationAction.TYPE: - return new NavAddDestinationAction(quickAction); - - case NavAddFirstIntermediateAction.TYPE: - return new NavAddFirstIntermediateAction(quickAction); - - case NavReplaceDestinationAction.TYPE: - return new NavReplaceDestinationAction(quickAction); - - case NavAutoZoomMapAction.TYPE: - return new NavAutoZoomMapAction(quickAction); - - case NavStartStopAction.TYPE: - return new NavStartStopAction(quickAction); - - case NavResumePauseAction.TYPE: - return new NavResumePauseAction(quickAction); - - case DayNightModeAction.TYPE: - return new DayNightModeAction(quickAction); - - case ShowHideGpxTracksAction.TYPE: - return new ShowHideGpxTracksAction(quickAction); - - case ContourLinesAction.TYPE: - return new ContourLinesAction(quickAction); - - case HillshadeAction.TYPE: - return new HillshadeAction(quickAction); - - default: - return quickAction; - } + return quickAction.getActionType().createNew(quickAction); } public static @DrawableRes int getActionIcon(int type) { switch (type) { - case NewAction.TYPE: - return R.drawable.ic_action_plus; - - case MarkerAction.TYPE: - return R.drawable.ic_action_flag_dark; - - case FavoriteAction.TYPE: - return R.drawable.ic_action_fav_dark; - case ShowHideFavoritesAction.TYPE: return R.drawable.ic_action_fav_dark; case ShowHidePoiAction.TYPE: return R.drawable.ic_action_gabout_dark; - case GPXAction.TYPE: - return R.drawable.ic_action_flag_dark; - case ParkingAction.TYPE: return R.drawable.ic_action_parking_dark; @@ -379,14 +195,9 @@ public class QuickActionFactory { case TakeVideoNoteAction.TYPE: return R.drawable.ic_action_video_dark; - case NavVoiceAction.TYPE: - return R.drawable.ic_action_volume_up; - case ShowHideOSMBugAction.TYPE: return R.drawable.ic_action_bug_dark; - case AddPOIAction.TYPE: - return R.drawable.ic_action_gabout_dark; case MapStyleAction.TYPE: return R.drawable.ic_map; @@ -400,27 +211,6 @@ public class QuickActionFactory { case MapUnderlayAction.TYPE: return R.drawable.ic_layer_bottom; - case NavDirectionsFromAction.TYPE: - return R.drawable.ic_action_route_direction_from_here; - - case NavAddDestinationAction.TYPE: - return R.drawable.ic_action_point_add_destination; - - case NavAddFirstIntermediateAction.TYPE: - return R.drawable.ic_action_intermediate; - - case NavReplaceDestinationAction.TYPE: - return R.drawable.ic_action_point_add_destination; - - case NavAutoZoomMapAction.TYPE: - return R.drawable.ic_action_search_dark; - - case NavStartStopAction.TYPE: - return R.drawable.ic_action_start_navigation; - - case NavResumePauseAction.TYPE: - return R.drawable.ic_play_dark; - case DayNightModeAction.TYPE: return R.drawable.ic_action_map_day; @@ -442,24 +232,12 @@ public class QuickActionFactory { switch (type) { - case NewAction.TYPE: - return R.string.quick_action_new_action; - - case MarkerAction.TYPE: - return R.string.quick_action_add_marker; - - case FavoriteAction.TYPE: - return R.string.quick_action_add_favorite; - case ShowHideFavoritesAction.TYPE: return R.string.quick_action_showhide_favorites_title; case ShowHidePoiAction.TYPE: return R.string.quick_action_showhide_poi_title; - case GPXAction.TYPE: - return R.string.quick_action_add_gpx; - case ParkingAction.TYPE: return R.string.quick_action_add_parking; @@ -472,14 +250,9 @@ public class QuickActionFactory { case TakeVideoNoteAction.TYPE: return R.string.quick_action_take_video_note; - case NavVoiceAction.TYPE: - return R.string.quick_action_navigation_voice; - case ShowHideOSMBugAction.TYPE: return R.string.quick_action_showhide_osmbugs_title; - case AddPOIAction.TYPE: - return R.string.quick_action_add_poi; case MapStyleAction.TYPE: return R.string.quick_action_map_style; @@ -496,27 +269,6 @@ public class QuickActionFactory { case DayNightModeAction.TYPE: return R.string.quick_action_day_night_switch_mode; - case NavDirectionsFromAction.TYPE: - return R.string.context_menu_item_directions_from; - - case NavAddDestinationAction.TYPE: - return R.string.quick_action_add_destination; - - case NavAddFirstIntermediateAction.TYPE: - return R.string.quick_action_add_first_intermediate; - - case NavReplaceDestinationAction.TYPE: - return R.string.quick_action_replace_destination; - - case NavAutoZoomMapAction.TYPE: - return R.string.quick_action_auto_zoom; - - case NavStartStopAction.TYPE: - return R.string.quick_action_start_stop_navigation; - - case NavResumePauseAction.TYPE: - return R.string.quick_action_resume_pause_navigation; - case ShowHideGpxTracksAction.TYPE: return R.string.quick_action_show_hide_gpx_tracks; @@ -534,24 +286,13 @@ public class QuickActionFactory { public static boolean isActionEditable(int type) { switch (type) { - - case NewAction.TYPE: - case MarkerAction.TYPE: case ShowHideFavoritesAction.TYPE: case ShowHidePoiAction.TYPE: case ParkingAction.TYPE: case TakeAudioNoteAction.TYPE: case TakePhotoNoteAction.TYPE: case TakeVideoNoteAction.TYPE: - case NavVoiceAction.TYPE: - case NavDirectionsFromAction.TYPE: - case NavAddDestinationAction.TYPE: - case NavAddFirstIntermediateAction.TYPE: - case NavReplaceDestinationAction.TYPE: - case NavAutoZoomMapAction.TYPE: case ShowHideOSMBugAction.TYPE: - case NavStartStopAction.TYPE: - case NavResumePauseAction.TYPE: case DayNightModeAction.TYPE: case ShowHideGpxTracksAction.TYPE: case ContourLinesAction.TYPE: diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionType.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionType.java index 856d1f40db..4251e5fc92 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionType.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionType.java @@ -3,6 +3,8 @@ package net.osmand.plus.quickaction; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; +import java.lang.reflect.InvocationTargetException; + public class QuickActionType { public static final int CREATE_CATEGORY = 0; @@ -26,6 +28,7 @@ public class QuickActionType { this.id = id; this.stringId = stringId; this.cl = cl; + this.actionEditable = cl != null; } public QuickActionType nameRes(int nameRes) { @@ -43,8 +46,8 @@ public class QuickActionType { return this; } - public QuickActionType editable() { - actionEditable = true; + public QuickActionType nonEditable() { + actionEditable = false; return this; } @@ -64,6 +67,24 @@ public class QuickActionType { } } + public QuickAction createNew(QuickAction q) { + if(cl != null) { + try { + return cl.getConstructor(QuickAction.class).newInstance(q); + } catch (InstantiationException e) { + throw new UnsupportedOperationException(e); + } catch (IllegalAccessException e) { + throw new UnsupportedOperationException(e); + } catch (NoSuchMethodException e) { + throw new UnsupportedOperationException(e); + } catch (InvocationTargetException e) { + throw new UnsupportedOperationException(e); + } + } else { + return new QuickAction(q); + } + } + public int getId() { return id; } diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java index f40c5ecd77..1d853cfaab 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java @@ -50,6 +50,7 @@ import net.osmand.plus.osmedit.OsmPoint; import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment; import net.osmand.plus.quickaction.CreateEditActionDialog; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.render.RenderingIcons; import net.osmand.util.Algorithms; @@ -66,7 +67,10 @@ import static net.osmand.plus.osmedit.AdvancedEditPoiFragment.addPoiToStringSet; import static net.osmand.plus.osmedit.EditPoiData.POI_TYPE_TAG; public class AddPOIAction extends QuickAction { - public static final int TYPE = 13; + public static final QuickActionType TYPE = new QuickActionType(13, + "osmpoi.add", AddPOIAction.class). + nameRes(R.string.quick_action_add_poi).iconRes(R.drawable.ic_action_gabout_dark). + category(QuickActionType.CREATE_CATEGORY); public static final String KEY_TAG = "key_tag"; public static final String KEY_DIALOG = "dialog"; diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/FavoriteAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/FavoriteAction.java index 8c17d152a0..15b0951c9a 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/FavoriteAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/FavoriteAction.java @@ -23,12 +23,16 @@ import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor; import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.widgets.AutoCompleteTextViewEx; public class FavoriteAction extends QuickAction { - public static final int TYPE = 3; + public static final QuickActionType TYPE = new QuickActionType(3, + "fav.add", FavoriteAction.class). + nameRes(R.string.quick_action_add_favorite).iconRes(R.drawable.ic_action_fav_dark). + category(QuickActionType.CREATE_CATEGORY); public static final String KEY_NAME = "name"; public static final String KEY_DIALOG = "dialog"; public static final String KEY_CATEGORY_NAME = "category_name"; diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/GPXAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/GPXAction.java index 0eadf00279..351fd540aa 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/GPXAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/GPXAction.java @@ -17,11 +17,15 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.editors.EditCategoryDialogFragment; import net.osmand.plus.mapcontextmenu.editors.SelectCategoryDialogFragment; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.widgets.AutoCompleteTextViewEx; public class GPXAction extends QuickAction { - public static final int TYPE = 6; + public static final QuickActionType TYPE = new QuickActionType(6, + "gpx.add", GPXAction.class). + nameRes(R.string.quick_action_add_gpx).iconRes(R.drawable.ic_action_flag_dark). + category(QuickActionType.CREATE_CATEGORY); public static final String KEY_NAME = "name"; public static final String KEY_DIALOG = "dialog"; diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/MarkerAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/MarkerAction.java index 64121971a0..ded03b683b 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/MarkerAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/MarkerAction.java @@ -10,10 +10,15 @@ import net.osmand.data.PointDescription; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class MarkerAction extends QuickAction { - public static final int TYPE = 2; + public static final QuickActionType TYPE = new QuickActionType(2, + "marker.add", MarkerAction.class). + nameRes(R.string.quick_action_add_marker).iconRes(R.drawable.ic_action_flag_dark).nonEditable(). + category(QuickActionType.CREATE_CATEGORY); + public MarkerAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddDestinationAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddDestinationAction.java index 0646d4053d..5270df5be9 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddDestinationAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddDestinationAction.java @@ -9,10 +9,15 @@ import net.osmand.data.LatLon; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavAddDestinationAction extends QuickAction { - public static final int TYPE = 20; + + public static final QuickActionType TYPE = new QuickActionType(20, + "nav.destination.add", NavAddDestinationAction.class). + nameRes(R.string.quick_action_add_destination).iconRes(R.drawable.ic_action_point_add_destination).nonEditable(). + category(QuickActionType.NAVIGATION); public NavAddDestinationAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddFirstIntermediateAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddFirstIntermediateAction.java index f7700e8fee..536662c1e0 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddFirstIntermediateAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAddFirstIntermediateAction.java @@ -9,10 +9,14 @@ import net.osmand.data.LatLon; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavAddFirstIntermediateAction extends QuickAction { - public static final int TYPE = 22; + public static final QuickActionType TYPE = new QuickActionType(22, + "nav.intermediate.add", NavAddFirstIntermediateAction.class). + nameRes(R.string.quick_action_add_first_intermediate).iconRes(R.drawable.ic_action_intermediate).nonEditable(). + category(QuickActionType.NAVIGATION); public NavAddFirstIntermediateAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAutoZoomMapAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAutoZoomMapAction.java index 1b1026be51..a0e2d1d76d 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAutoZoomMapAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavAutoZoomMapAction.java @@ -11,10 +11,15 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavAutoZoomMapAction extends QuickAction { - public static final int TYPE = 23; + public static final QuickActionType TYPE = new QuickActionType(23, + "nav.autozoom", NavAutoZoomMapAction.class). + nameRes(R.string.quick_action_auto_zoom).iconRes(R.drawable.ic_action_search_dark).nonEditable(). + category(QuickActionType.NAVIGATION); + public NavAutoZoomMapAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavDirectionsFromAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavDirectionsFromAction.java index c20af4c8e9..0f940da481 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavDirectionsFromAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavDirectionsFromAction.java @@ -9,10 +9,14 @@ import net.osmand.data.LatLon; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavDirectionsFromAction extends QuickAction { - public static final int TYPE = 19; + public static final QuickActionType TYPE = new QuickActionType(19, + "nav.directions", NavDirectionsFromAction.class). + nameRes(R.string.context_menu_item_directions_from).iconRes(R.drawable.ic_action_route_direction_from_here).nonEditable(). + category(QuickActionType.NAVIGATION); public NavDirectionsFromAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavReplaceDestinationAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavReplaceDestinationAction.java index 7d95615588..8ab75f719d 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavReplaceDestinationAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavReplaceDestinationAction.java @@ -9,10 +9,14 @@ import net.osmand.data.LatLon; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavReplaceDestinationAction extends QuickAction { - public static final int TYPE = 21; + public static final QuickActionType TYPE = new QuickActionType(21, + "nav.destination.replace", NavReplaceDestinationAction.class). + nameRes(R.string.quick_action_replace_destination).iconRes(R.drawable.ic_action_point_add_destination).nonEditable(). + category(QuickActionType.NAVIGATION); public NavReplaceDestinationAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java index f94f4b5ec6..839b00025e 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java @@ -10,11 +10,16 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.routing.RoutingHelper; public class NavResumePauseAction extends QuickAction { - public static final int TYPE = 26; + public static final QuickActionType TYPE = new QuickActionType(26, + "nav.resumepause", NavResumePauseAction .class). + nameRes(R.string.quick_action_resume_pause_navigation).iconRes(R.drawable.ic_play_dark).nonEditable(). + category(QuickActionType.NAVIGATION); + public NavResumePauseAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java index e5b31fa9a6..76574207e7 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java @@ -12,12 +12,18 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.routing.RoutingHelper; public class NavStartStopAction extends QuickAction { - public static final int TYPE = 25; private static final String KEY_DIALOG = "dialog"; + public static final QuickActionType TYPE = new QuickActionType(25, + "nav.startstop", NavStartStopAction .class). + nameRes(R.string.quick_action_start_stop_navigation).iconRes(R.drawable.ic_action_start_navigation).nonEditable(). + category(QuickActionType.NAVIGATION); + + public NavStartStopAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavVoiceAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavVoiceAction.java index 1e4eb81502..48c6b3a7ee 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavVoiceAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavVoiceAction.java @@ -9,9 +9,13 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NavVoiceAction extends QuickAction { - public static final int TYPE = 11; + public static final QuickActionType TYPE = new QuickActionType(11, + "nav.voice", NavVoiceAction.class). + nameRes(R.string.quick_action_navigation_voice).iconRes(R.drawable.ic_action_volume_up).nonEditable(). + category(QuickActionType.NAVIGATION); public NavVoiceAction() { super(TYPE); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NewAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NewAction.java index c0a9bbef5a..dc9d03923a 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/NewAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NewAction.java @@ -2,13 +2,18 @@ package net.osmand.plus.quickaction.actions; import android.view.ViewGroup; +import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.quickaction.AddQuickActionDialog; import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.quickaction.QuickActionType; public class NewAction extends QuickAction { - public static final int TYPE = 1; + public static final QuickActionType TYPE = new QuickActionType(1, "new", + NewAction.class). + nonEditable().iconRes(R.drawable.ic_action_plus).nameRes(R.string.quick_action_new_action); + public NewAction() { super(TYPE);