From 5566745949b29b8d19c96e171476422990066c9a Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 3 Mar 2017 10:39:28 +0300 Subject: [PATCH] Fixed add/edit wpt without monitoring plugin activated. Work on track details. --- .../plus/activities/MapActivityActions.java | 31 +++ .../net/osmand/plus/helpers/GpxUiHelper.java | 9 +- .../plus/mapcontextmenu/MapContextMenu.java | 5 +- .../other/TrackDetailsMenu.java | 109 +++++++++++ .../other/TrackDetailsMenuFragment.java | 183 ++++++++++++++++++ .../monitoring/OsmandMonitoringPlugin.java | 33 ---- .../osmand/plus/views/MapControlsLayer.java | 7 + 7 files changed, 341 insertions(+), 36 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index ac8a65cce2..c7bf42a978 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.download.IndexItem; import net.osmand.plus.liveupdates.OsmLiveActivity; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.BaseMapLayer; @@ -275,6 +276,36 @@ public class MapActivityActions implements DialogProvider { } OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj); + ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() { + @Override + public boolean onContextMenuClick(ArrayAdapter adapter, int resId, int pos, boolean isChecked) { + if (resId == R.string.context_menu_item_add_waypoint) { + mapActivity.getContextMenu().addWptPt(); + } else if (resId == R.string.context_menu_item_edit_waypoint) { + mapActivity.getContextMenu().editWptPt(); + } + return true; + } + }; + + if (!mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty() + || (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) { + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(R.string.context_menu_item_add_waypoint, mapActivity) + .setIcon(R.drawable.ic_action_gnew_label_dark) + .setListener(listener).createItem()); + } + + if (selectedObj instanceof GPXUtilities.WptPt) { + GPXUtilities.WptPt pt = (GPXUtilities.WptPt) selectedObj; + if (getMyApplication().getSelectedGpxHelper().getSelectedGPXFile(pt) != null) { + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity) + .setIcon(R.drawable.ic_action_edit_dark) + .setListener(listener).createItem()); + } + } + final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity); final ArrayAdapter listAdapter = adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent()); diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 623b1e836b..22e788339c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -65,6 +65,7 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.IconsCache; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.ActivityResultListener; @@ -74,6 +75,7 @@ import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.dialogs.ConfigureMapMenu; import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem; import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRulesStorage; import net.osmand.util.Algorithms; @@ -225,12 +227,15 @@ public class GpxUiHelper { return null; } - public static AlertDialog selectSingleGPXFile(final Activity activity, - final boolean showCurrentGpx, final CallbackWithObject callbackWithObject) { + public static AlertDialog selectSingleGPXFile(final Activity activity, boolean showCurrentGpx, + final CallbackWithObject callbackWithObject) { OsmandApplication app = (OsmandApplication) activity.getApplication(); int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length(); List selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles(); final List list = new ArrayList<>(selectedGpxFiles.size() + 1); + if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) == null) { + showCurrentGpx = false; + } if (!selectedGpxFiles.isEmpty() || showCurrentGpx) { if (showCurrentGpx) { list.add(new GPXInfo(activity.getString(R.string.shared_string_currently_recording_track), 0, 0)); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 7e8a005fc4..5b69d52061 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -24,6 +24,7 @@ import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; @@ -42,6 +43,7 @@ import net.osmand.plus.mapcontextmenu.editors.PointEditor; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.ShareMenu; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.ContextMenuLayer; import net.osmand.plus.views.OsmandMapLayer; @@ -767,7 +769,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL final List list = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles(); - if (list.isEmpty() || (list.size() == 1 && list.get(0).getGpxFile().showCurrentTrack)) { + if ((list.isEmpty() || (list.size() == 1 && list.get(0).getGpxFile().showCurrentTrack)) + && OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) { GPXFile gpxFile = mapActivity.getMyApplication().getSavingTrackHelper().getCurrentGpx(); getWptPtPointEditor().add(gpxFile, latLon, title); } else { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java new file mode 100644 index 0000000000..059c8ada45 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -0,0 +1,109 @@ +package net.osmand.plus.mapcontextmenu.other; + +import android.support.v4.app.Fragment; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.views.MapControlsLayer; +import net.osmand.plus.views.OsmandMapTileView; + +import java.lang.ref.WeakReference; + +public class TrackDetailsMenu { + + private MapActivity mapActivity; + private OsmandMapTileView mapView; + private MapControlsLayer mapControlsLayer; + + private static boolean VISIBLE; + private boolean nightMode; + + public TrackDetailsMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) { + this.mapActivity = mapActivity; + this.mapControlsLayer = mapControlsLayer; + mapView = mapActivity.getMapView(); + } + + public void show() { + if (!VISIBLE) { + VISIBLE = true; + boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); + if (!portrait) { + mapActivity.getMapView().setMapPositionX(1); + } + + mapActivity.refreshMap(); + + TrackDetailsMenuFragment.showInstance(mapActivity); + + if (!AndroidUiHelper.isXLargeDevice(mapActivity)) { + AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), false); + } + if (!portrait) { + AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), true); + } + } + } + + public void hide() { + WeakReference fragmentRef = findMenuFragment(); + if (fragmentRef != null) { + fragmentRef.get().dismiss(); + } else { + VISIBLE = false; + } + } + + public WeakReference findMenuFragment() { + Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(TrackDetailsMenuFragment.TAG); + if (fragment != null && !fragment.isDetached()) { + return new WeakReference<>((TrackDetailsMenuFragment) fragment); + } else { + return null; + } + } + + public void onDismiss() { + VISIBLE = false; + mapActivity.getMapView().setMapPositionX(0); + mapActivity.getMapView().refreshMap(); + AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false); + AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true); + } + + public void updateInfo(final View main) { + nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls(); + updateView(main); + } + + private void updateView(final View parentView) { + /* + String via = generateViaDescription(); + View viaLayout = parentView.findViewById(R.id.ViaLayout); + if (via.length() == 0) { + viaLayout.setVisibility(View.GONE); + parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE); + } else { + viaLayout.setVisibility(View.VISIBLE); + parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE); + ((TextView) parentView.findViewById(R.id.ViaView)).setText(via); + } + + viaLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (getTargets().checkPointToNavigateShort()) { + mapActivity.getMapActions().openIntermediatePointsDialog(); + } + } + }); + + ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon); + viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate)); + */ + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java new file mode 100644 index 0000000000..f214c1a35f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java @@ -0,0 +1,183 @@ +package net.osmand.plus.mapcontextmenu.other; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentActivity; +import android.support.v4.app.FragmentManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import net.osmand.AndroidUtils; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; + +public class TrackDetailsMenuFragment extends Fragment { + public static final String TAG = "TrackDetailsMenuFragment"; + + private TrackDetailsMenu menu; + private View mainView; + + private MapActivity getMapActivity() { + return (MapActivity) getActivity(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + MapActivity mapActivity = getMapActivity(); + + menu = mapActivity.getMapLayers().getMapControlsLayer().getTrackDetailsMenu(); + View view = inflater.inflate(R.layout.plan_route_info, container, false); + if (menu == null) { + return view; + } + + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + mainView = view.findViewById(R.id.main_view); + updateInfo(); + + return view; + } + + @Override + public void onResume() { + super.onResume(); + if (menu == null) { + dismiss(); + } + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + if (menu != null) { + menu.onDismiss(); + } + } + + public int getHeight() { + if (mainView != null) { + return mainView.getHeight(); + } else { + return 0; + } + } + + public int getWidth() { + if (mainView != null) { + return mainView.getWidth(); + } else { + return 0; + } + } + + public void updateInfo() { + menu.updateInfo(mainView); + applyDayNightMode(); + } + + public void show(MapActivity mapActivity) { + int slideInAnim = R.anim.slide_in_bottom; + int slideOutAnim = R.anim.slide_out_bottom; + + mapActivity.getSupportFragmentManager().beginTransaction() + .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) + .add(R.id.routeMenuContainer, this, TAG) + .addToBackStack(TAG) + .commitAllowingStateLoss(); + } + + public void dismiss() { + FragmentActivity activity = getActivity(); + if (activity != null) { + try { + activity.getSupportFragmentManager().popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE); + } catch (Exception e) { + // ignore + } + } + } + + public void applyDayNightMode() { + MapActivity ctx = getMapActivity(); + boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx); + boolean landscapeLayout = !portraitMode; + boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls(); + if (!landscapeLayout) { + AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); + } else { + AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark); + } + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode, + R.color.dashboard_divider_light, R.color.dashboard_divider_dark); + + AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode); + AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode); + AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.toTitle), nightMode); + AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.fromTitle), nightMode); + AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.InfoTextView), nightMode); + + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode); + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode); + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode); + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Info), nightMode); + + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Next), nightMode); + AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Prev), nightMode); + + AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceText), nightMode); + AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceTitle), nightMode); + AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode); + AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode); + } + + public static boolean showInstance(final MapActivity mapActivity) { + try { + boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); + int slideInAnim; + int slideOutAnim; + if (portrait) { + slideInAnim = R.anim.slide_in_bottom; + slideOutAnim = R.anim.slide_out_bottom; + } else { + slideInAnim = R.anim.slide_in_left; + slideOutAnim = R.anim.slide_out_left; + } + + MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment(); + mapActivity.getSupportFragmentManager().beginTransaction() + .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) + .add(R.id.routeMenuContainer, fragment, TAG) + .addToBackStack(TAG).commitAllowingStateLoss(); + + return true; + + } catch (RuntimeException e) { + return false; + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index a4e50b2f91..2681bf4b86 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -8,7 +8,6 @@ import android.support.v7.app.AlertDialog; import android.util.DisplayMetrics; import android.view.View; import android.view.WindowManager; -import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; @@ -21,9 +20,6 @@ import android.widget.TextView; import net.osmand.Location; import net.osmand.ValueHolder; import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ContextMenuAdapter; -import net.osmand.plus.ContextMenuItem; -import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.NavigationService; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable; @@ -131,35 +127,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { } } } - - @Override - public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude, - ContextMenuAdapter adapter, Object selectedObj) { - ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() { - @Override - public boolean onContextMenuClick(ArrayAdapter adapter, int resId, int pos, boolean isChecked) { - if (resId == R.string.context_menu_item_add_waypoint) { - mapActivity.getContextMenu().addWptPt(); - } else if (resId == R.string.context_menu_item_edit_waypoint) { - mapActivity.getContextMenu().editWptPt(); - } - return true; - } - }; - adapter.addItem(new ContextMenuItem.ItemBuilder() - .setTitleId(R.string.context_menu_item_add_waypoint, mapActivity) - .setIcon(R.drawable.ic_action_gnew_label_dark) - .setListener(listener).createItem()); - if (selectedObj instanceof WptPt) { - WptPt pt = (WptPt) selectedObj; - if (app.getSelectedGpxHelper().getSelectedGPXFile(pt) != null) { - adapter.addItem(new ContextMenuItem.ItemBuilder() - .setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity) - .setIcon(R.drawable.ic_action_edit_dark) - .setListener(listener).createItem()); - } - } - } public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90}; public static final int[] MINUTES = new int[] {2, 3, 5}; diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 4f4c5271ce..a8111503ce 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu; +import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.corenative.NativeCoreContext; @@ -83,6 +84,7 @@ public class MapControlsLayer extends OsmandMapLayer { private OsmandSettings settings; private MapRouteInfoMenu mapRouteInfoMenu; + private TrackDetailsMenu trackDetailsMenu; private MapHudButton backToLocationControl; private MapHudButton menuControl; private MapHudButton compassHud; @@ -114,6 +116,10 @@ public class MapControlsLayer extends OsmandMapLayer { return mapRouteInfoMenu; } + public TrackDetailsMenu getTrackDetailsMenu() { + return trackDetailsMenu; + } + @Override public boolean drawInScreenPixels() { return true; @@ -276,6 +282,7 @@ public class MapControlsLayer extends OsmandMapLayer { private void initRouteControls() { mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this); + trackDetailsMenu = new TrackDetailsMenu(mapActivity, this); } public void updateRouteButtons(View main, boolean routeInfo) {