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);
}
Aggregations