Don't show context menu on backToLocation button click on other screens
This commit is contained in:
parent
3d2a3e4160
commit
eb2fb10386
3 changed files with 13 additions and 11 deletions
|
@ -117,7 +117,7 @@ public abstract class ContextMenuScrollFragment extends ContextMenuFragment impl
|
|||
MapControlsLayer mapControlsLayer = mapLayers.getMapControlsLayer();
|
||||
mapControlsLayer.setupZoomInButton(zoomInButtonView, longClickListener, ZOOM_IN_BUTTON_ID);
|
||||
mapControlsLayer.setupZoomOutButton(zoomOutButtonView, longClickListener, ZOOM_OUT_BUTTON_ID);
|
||||
mapControlsLayer.setupBackToLocationButton(myLocButtonView, BACK_TO_LOC_BUTTON_ID);
|
||||
mapControlsLayer.setupBackToLocationButton(myLocButtonView, false, BACK_TO_LOC_BUTTON_ID);
|
||||
|
||||
MapInfoLayer mapInfoLayer = mapLayers.getMapInfoLayer();
|
||||
rulerWidget = mapInfoLayer.setupRulerWidget(mapRulerView);
|
||||
|
|
|
@ -376,7 +376,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
|
||||
mapControlsLayer.setupZoomInButton(zoomInButton, longClickListener, ZOOM_IN_BUTTON_ID);
|
||||
mapControlsLayer.setupZoomOutButton(zoomOutButton, longClickListener, ZOOM_OUT_BUTTON_ID);
|
||||
mapControlsLayer.setupBackToLocationButton(backToLocation, BACK_TO_LOC_BUTTON_ID);
|
||||
mapControlsLayer.setupBackToLocationButton(backToLocation, false, BACK_TO_LOC_BUTTON_ID);
|
||||
|
||||
AndroidUiHelper.updateVisibility(zoomButtonsView, true);
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
private void initControls() {
|
||||
View backToLocation = mapActivity.findViewById(R.id.map_my_location_button);
|
||||
backToLocationControl = setupBackToLocationButton(backToLocation, BACK_TO_LOC_HUD_ID);
|
||||
backToLocationControl = setupBackToLocationButton(backToLocation, true, BACK_TO_LOC_HUD_ID);
|
||||
|
||||
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
|
||||
|
||||
|
@ -397,7 +397,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
});
|
||||
}
|
||||
|
||||
public MapHudButton setupBackToLocationButton(View backToLocation, String buttonId) {
|
||||
public MapHudButton setupBackToLocationButton(View backToLocation, boolean showContextMenu, String buttonId) {
|
||||
MapHudButton backToLocationButton = createHudButton(backToLocation, R.drawable.ic_my_location, buttonId)
|
||||
.setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark)
|
||||
.setBg(R.drawable.btn_circle_blue);
|
||||
|
@ -409,13 +409,15 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
});
|
||||
|
||||
backToLocation.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
onBackToLocationClick(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (showContextMenu) {
|
||||
backToLocation.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
onBackToLocationClick(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
controls.add(backToLocationButton);
|
||||
|
||||
|
|
Loading…
Reference in a new issue