quick action fab proper visibility with context menu; center map shift in quick action mode
This commit is contained in:
parent
0bb62d6b9c
commit
bbb35bc385
3 changed files with 26 additions and 5 deletions
|
@ -587,6 +587,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
public void onSingleTapOnMap() {
|
||||
if (menuController == null || !menuController.handleSingleTapOnMap()) {
|
||||
hide();
|
||||
if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn())
|
||||
mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,13 +170,17 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
|||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(MapMultiSelectionMenuFragment.TAG);
|
||||
Fragment fragment = getFragmentByTag();
|
||||
return fragment != null;
|
||||
}
|
||||
|
||||
public Fragment getFragmentByTag() {
|
||||
return getMapActivity().getSupportFragmentManager().findFragmentByTag(MapMultiSelectionMenuFragment.TAG);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
clearMenu();
|
||||
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(MapMultiSelectionMenuFragment.TAG);
|
||||
Fragment fragment = getFragmentByTag();
|
||||
if (fragment != null) {
|
||||
MapMultiSelectionMenuFragment menuFragment = (MapMultiSelectionMenuFragment) fragment;
|
||||
menuFragment.dismissMenu();
|
||||
|
|
|
@ -46,6 +46,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
|
||||
private OsmandMapTileView view;
|
||||
private boolean wasCollapseButtonVisible;
|
||||
private int previousMapPosition;
|
||||
|
||||
|
||||
private boolean inChangeMarkerPositionMode;
|
||||
|
@ -102,6 +103,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
public void refreshLayer() {
|
||||
setLayerState(true);
|
||||
isLayerOn = quickActionRegistry.isQuickActionOn();
|
||||
setUpQuickActionBtnVisibility();
|
||||
}
|
||||
|
||||
private void setQuickActionButtonMargin() {
|
||||
|
@ -160,6 +162,8 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
}
|
||||
|
||||
private void enterMovingMode(RotatedTileBox tileBox) {
|
||||
previousMapPosition = view.getMapPosition();
|
||||
view.setMapPosition( OsmandSettings.BOTTOM_CONSTANT);
|
||||
MapContextMenu menu = mapActivity.getContextMenu();
|
||||
LatLon ll = menu.isActive() && tileBox.containsLatLon(menu.getLatLon()) ? menu.getLatLon() : tileBox.getCenterLatLon();
|
||||
|
||||
|
@ -167,7 +171,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
menu.close();
|
||||
|
||||
RotatedTileBox rb = new RotatedTileBox(tileBox);
|
||||
// rb.setCenterLocation(0.5f, 0.5f);
|
||||
// tileBox.setCenterLocation(0.5f, 0.75f);
|
||||
rb.setLatLonCenter(ll.getLatitude(), ll.getLongitude());
|
||||
double lat = rb.getLatFromPixel(tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
||||
double lon = rb.getLonFromPixel(tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
||||
|
@ -189,6 +193,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
}
|
||||
|
||||
private void quitMovingMarker() {
|
||||
view.setMapPosition(previousMapPosition);
|
||||
inChangeMarkerPositionMode = false;
|
||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
|
||||
|
@ -228,10 +233,16 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
||||
contextMarker.draw(canvas);
|
||||
}
|
||||
setUpQuickActionBtnVisibility();
|
||||
}
|
||||
|
||||
private void setUpQuickActionBtnVisibility() {
|
||||
boolean hideQuickButton = !isLayerOn ||
|
||||
contextMenuLayer.isInChangeMarkerPositionMode() ||
|
||||
mapActivity.getContextMenu().isVisible() ||
|
||||
mapActivity.getContextMenu().getMultiSelectionMenu().isVisible();
|
||||
mapActivity.getContextMenu().isVisible() && !mapActivity.getContextMenu().findMenuFragment().get().isRemoving() ||
|
||||
mapActivity.getContextMenu().isVisible() && mapActivity.getContextMenu().findMenuFragment().get().isAdded() ||
|
||||
mapActivity.getContextMenu().getMultiSelectionMenu().isVisible() && mapActivity.getContextMenu().getMultiSelectionMenu().getFragmentByTag().isAdded() ||
|
||||
mapActivity.getContextMenu().getMultiSelectionMenu().isVisible() && !mapActivity.getContextMenu().getMultiSelectionMenu().getFragmentByTag().isRemoving();
|
||||
quickActionButton.setVisibility(hideQuickButton ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -265,6 +276,10 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
return isLayerOn && inChangeMarkerPositionMode;
|
||||
}
|
||||
|
||||
public boolean isLayerOn() {
|
||||
return isLayerOn;
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
return setLayerState(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue