Search in sources :

Example 6 with BaseSettingsFragment

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);
}
Also used : BaseOsmAndFragment(net.osmand.plus.base.BaseOsmAndFragment) BaseSettingsFragment(net.osmand.plus.settings.fragments.BaseSettingsFragment) TargetPoint(net.osmand.plus.helpers.TargetPointsHelper.TargetPoint) QuadPoint(net.osmand.data.QuadPoint) NewGpxPoint(net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint) MapLayers(net.osmand.plus.views.MapLayers) TopToolbarController(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController)

Example 7 with BaseSettingsFragment

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();
}
Also used : Bundle(android.os.Bundle) BaseSettingsFragment(net.osmand.plus.settings.fragments.BaseSettingsFragment) BaseSettingsFragment(net.osmand.plus.settings.fragments.BaseSettingsFragment) Fragment(androidx.fragment.app.Fragment)

Aggregations

BaseSettingsFragment (net.osmand.plus.settings.fragments.BaseSettingsFragment)7 Fragment (androidx.fragment.app.Fragment)6 Bundle (android.os.Bundle)2 View (android.view.View)2 TextView (android.widget.TextView)2 BaseOsmAndFragment (net.osmand.plus.base.BaseOsmAndFragment)2 MenuBottomSheetDialogFragment (net.osmand.plus.base.MenuBottomSheetDialogFragment)2 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)2 BooleanPreferenceBottomSheet.getCustomButtonView (net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView)2 BooleanPreferenceBottomSheet.updateCustomButtonView (net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView)2 FragmentManager (androidx.fragment.app.FragmentManager)1 SecondSplashScreenFragment (net.osmand.SecondSplashScreenFragment)1 QuadPoint (net.osmand.data.QuadPoint)1 ContextMenuFragment (net.osmand.plus.base.ContextMenuFragment)1 DashBaseFragment (net.osmand.plus.dashboard.DashBaseFragment)1 CrashBottomSheetDialogFragment (net.osmand.plus.dialogs.CrashBottomSheetDialogFragment)1 SendAnalyticsBottomSheetDialogFragment (net.osmand.plus.dialogs.SendAnalyticsBottomSheetDialogFragment)1 WhatsNewDialogFragment (net.osmand.plus.dialogs.WhatsNewDialogFragment)1 XMasDialogFragment (net.osmand.plus.dialogs.XMasDialogFragment)1 FirstUsageWelcomeFragment (net.osmand.plus.firstusage.FirstUsageWelcomeFragment)1