use of net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment in project Osmand by osmandapp.
the class DashboardOnMap method setDashboardVisibility.
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation, int[] animationCoordinates) {
if (visible == this.visible && type == visibleType) {
return;
}
mapActivity.getRoutingHelper().removeListener(this);
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
this.previousVisibleType = prevItem;
this.visible = visible;
ApplicationMode currentAppMode = getMyApplication().getSettings().APPLICATION_MODE.get();
boolean appModeChanged = currentAppMode != previousAppMode;
boolean refresh = this.visibleType == type && !appModeChanged;
previousAppMode = currentAppMode;
this.visibleType = type;
DashboardOnMap.staticVisible = visible;
DashboardOnMap.staticVisibleType = type;
mapActivity.enableDrawer();
if (swipeDismissListener != null) {
swipeDismissListener.discardUndo();
}
removeMapillaryFiltersFragment();
if (visible) {
mapActivity.dismissCardDialog();
mapActivity.getContextMenu().hideMenues();
mapViewLocation = mapActivity.getMapLocation();
mapRotation = mapActivity.getMapRotate();
mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
mapActivity.getMapViewTrackingUtilities().setDashboard(this);
mapActivity.disableDrawer();
dashboardView.setVisibility(View.VISIBLE);
if (isActionButtonVisible()) {
setActionButton(visibleType);
actionButton.setVisibility(View.VISIBLE);
} else {
hideActionButton();
if (visibleType == DashboardType.CONFIGURE_MAP) {
int btnSizePx = mapActivity.getResources().getDimensionPixelSize(R.dimen.map_small_button_size);
compassButton = mapActivity.getMapLayers().getMapControlsLayer().moveCompassButton(dashboardView, getActionButtonLayoutParams(btnSizePx), nightMode);
}
}
updateDownloadBtn();
View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.MAPILLARY) {
if (visibleType == DashboardType.DASHBOARD) {
addOrUpdateDashboardFragments();
} else {
mapActivity.getSupportFragmentManager().beginTransaction().replace(R.id.content, new MapillaryFiltersFragment(), MapillaryFiltersFragment.TAG).commit();
}
scrollView.setVisibility(View.VISIBLE);
scrollView.scrollTo(0, 0);
listViewLayout.setVisibility(View.GONE);
onScrollChanged(scrollView.getScrollY(), false, false);
} else {
scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE);
if (refresh) {
refreshContent(false);
} else {
listView.scrollTo(0, 0);
listView.clearParams();
onScrollChanged(listView.getScrollY(), false, false);
updateListAdapter();
}
updateListBackgroundHeight();
applyDayNightMode();
}
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
mapActivity.getMapLayers().getMapControlsLayer().hideMapControls();
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
if (!portrait) {
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin_external), true);
mapActivity.getMapView().setMapPositionX(1);
mapActivity.refreshMap();
}
updateToolbarActions();
// fabButton.showFloatingActionButton();
open(animation, animationCoordinates);
updateLocation(true, true, false);
// addOrUpdateDashboardFragments();
mapActivity.getRoutingHelper().addListener(this);
} else {
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
hide(animation);
if (!MapRouteInfoMenu.isVisible()) {
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin_external), false);
mapActivity.getMapView().setMapPositionX(0);
mapActivity.getMapView().refreshMap();
}
mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
hideActionButton();
for (WeakReference<DashBaseFragment> df : fragList) {
if (df.get() != null) {
df.get().onCloseDash();
}
}
OsmandSettings settings = getMyApplication().getSettings();
if (settings.SHOW_MAPILLARY.get() && !settings.MAPILLARY_FIRST_DIALOG_SHOWN.get()) {
MapillaryFirstDialogFragment fragment = new MapillaryFirstDialogFragment();
fragment.show(mapActivity.getSupportFragmentManager(), MapillaryFirstDialogFragment.TAG);
settings.MAPILLARY_FIRST_DIALOG_SHOWN.set(true);
}
}
mapActivity.updateStatusBarColor();
}
Aggregations