Search in sources :

Example 1 with ContextMenuFragment

use of net.osmand.plus.base.ContextMenuFragment in project Osmand by osmandapp.

the class MapActivity method fitCurrentRouteToMap.

private void fitCurrentRouteToMap() {
    boolean portrait = true;
    int leftBottomPaddingPx = 0;
    WeakReference<?> fragmentRef = mapRouteInfoMenu.findMenuFragment();
    if (fragmentRef == null) {
        fragmentRef = mapRouteInfoMenu.findFollowTrackFragment();
    }
    View mapBottomView = findViewById(R.id.MapBottomContainer);
    int mapBottomViewHeight = mapBottomView.getHeight();
    if (fragmentRef != null) {
        ContextMenuFragment f = (ContextMenuFragment) fragmentRef.get();
        portrait = f.isPortrait();
        if (!portrait) {
            leftBottomPaddingPx = f.getWidth();
        } else {
            leftBottomPaddingPx = Math.max(0, f.getHeight() - mapBottomViewHeight);
        }
    }
    app.getOsmandMap().fitCurrentRouteToMap(portrait, leftBottomPaddingPx);
}
Also used : AtlasMapRendererView(net.osmand.core.android.AtlasMapRendererView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) View(android.view.View) TextView(android.widget.TextView) OsmAndMapSurfaceView(net.osmand.plus.views.OsmAndMapSurfaceView) OsmAndMapLayersView(net.osmand.plus.views.OsmAndMapLayersView) TargetPoint(net.osmand.plus.helpers.TargetPointsHelper.TargetPoint) QuadPoint(net.osmand.data.QuadPoint) NewGpxPoint(net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint) ContextMenuFragment(net.osmand.plus.base.ContextMenuFragment)

Aggregations

View (android.view.View)1 TextView (android.widget.TextView)1 AtlasMapRendererView (net.osmand.core.android.AtlasMapRendererView)1 QuadPoint (net.osmand.data.QuadPoint)1 ContextMenuFragment (net.osmand.plus.base.ContextMenuFragment)1 TargetPoint (net.osmand.plus.helpers.TargetPointsHelper.TargetPoint)1 NewGpxPoint (net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint)1 OsmAndMapLayersView (net.osmand.plus.views.OsmAndMapLayersView)1 OsmAndMapSurfaceView (net.osmand.plus.views.OsmAndMapSurfaceView)1 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)1