use of net.osmand.plus.settings.fragments.BaseSettingsFragment in project Osmand by osmandapp.
the class MapActivity method updateStatusBarColor.
public void updateStatusBarColor() {
int colorId = -1;
MapLayers mapLayers = getMapLayers();
BaseOsmAndFragment fragmentAboveDashboard = getVisibleBaseOsmAndFragment(R.id.fragmentContainer);
BaseSettingsFragment settingsFragmentAboveDashboard = getVisibleBaseSettingsFragment(R.id.fragmentContainer);
BaseOsmAndFragment fragmentBelowDashboard = getVisibleBaseOsmAndFragment(R.id.routeMenuContainer, R.id.topFragmentContainer, R.id.bottomFragmentContainer);
if (fragmentAboveDashboard != null) {
colorId = fragmentAboveDashboard.getStatusBarColorId();
} else if (settingsFragmentAboveDashboard != null) {
colorId = settingsFragmentAboveDashboard.getStatusBarColorId();
} else if (dashboardOnMap.isVisible()) {
colorId = dashboardOnMap.getStatusBarColor();
} else if (fragmentBelowDashboard != null) {
colorId = fragmentBelowDashboard.getStatusBarColorId();
} else if (mapLayers.getMapQuickActionLayer() != null && mapLayers.getMapQuickActionLayer().isWidgetVisible()) {
colorId = R.color.status_bar_transparent_gradient;
}
if (colorId != -1) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorId));
return;
}
int color = TopToolbarController.NO_COLOR;
boolean mapControlsVisible = findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE;
boolean topToolbarVisible = getMapLayers().getMapInfoLayer().isTopToolbarViewVisible();
boolean night = app.getDaynightHelper().isNightModeForMapControls();
TopToolbarController toolbarController = getMapLayers().getMapInfoLayer().getTopToolbarController();
if (toolbarController != null && mapControlsVisible && topToolbarVisible) {
color = toolbarController.getStatusBarColor(this, night);
}
if (color == TopToolbarController.NO_COLOR) {
boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE;
boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE;
boolean coordinatesTopBar = findViewById(R.id.coordinates_top_bar).getVisibility() == View.VISIBLE;
if (coordinatesTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_main_dark : R.color.status_bar_main_dark;
} else if (mapTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (markerTopBar && mapControlsVisible) {
colorId = R.color.status_bar_color_dark;
} else {
colorId = night ? R.color.status_bar_transparent_dark : R.color.status_bar_transparent_light;
}
color = ContextCompat.getColor(this, colorId);
}
getWindow().setStatusBarColor(color);
}
use of net.osmand.plus.settings.fragments.BaseSettingsFragment in project Osmand by osmandapp.
the class ChangeDataStorageBottomSheet method positiveButtonsClick.
private void positiveButtonsClick(boolean moveData) {
Bundle bundle = new Bundle();
bundle.putBoolean(TAG, true);
bundle.putParcelable(CHOSEN_DIRECTORY, newDirectory);
bundle.putBoolean(MOVE_DATA, moveData);
Fragment fragment = getTargetFragment();
if (fragment instanceof BaseSettingsFragment) {
((BaseSettingsFragment) fragment).onPreferenceChange(getPreference(), bundle);
}
dismiss();
}
Aggregations