Search in sources :

Example 1 with PreviewRouteLineInfo

use of net.osmand.plus.routing.PreviewRouteLineInfo in project Osmand by osmandapp.

the class RouteLineAppearanceFragment method createPreviewRouteLineInfo.

private PreviewRouteLineInfo createPreviewRouteLineInfo() {
    OsmandSettings settings = requireSettings();
    int colorDay = settings.CUSTOM_ROUTE_COLOR_DAY.getModeValue(appMode);
    int colorNight = settings.CUSTOM_ROUTE_COLOR_NIGHT.getModeValue(appMode);
    ColoringType coloringType = settings.ROUTE_COLORING_TYPE.getModeValue(appMode);
    String routeInfoAttribute = settings.ROUTE_INFO_ATTRIBUTE.getModeValue(appMode);
    String widthKey = settings.ROUTE_LINE_WIDTH.getModeValue(appMode);
    boolean showTurnArrows = settings.ROUTE_SHOW_TURN_ARROWS.getModeValue(appMode);
    PreviewRouteLineInfo previewRouteLineInfo = new PreviewRouteLineInfo(colorDay, colorNight, coloringType, routeInfoAttribute, widthKey, showTurnArrows);
    previewRouteLineInfo.setIconId(appMode.getNavigationIcon().getIconId());
    previewRouteLineInfo.setIconColor(appMode.getProfileColor(isNightMode()));
    return previewRouteLineInfo;
}
Also used : ColoringType(net.osmand.plus.routing.ColoringType) PreviewRouteLineInfo(net.osmand.plus.routing.PreviewRouteLineInfo) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Example 2 with PreviewRouteLineInfo

use of net.osmand.plus.routing.PreviewRouteLineInfo in project Osmand by osmandapp.

the class RouteLineAppearanceFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupAppMode(savedInstanceState);
    toolbarHeightPx = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
    if (savedInstanceState != null) {
        previewRouteLineInfo = new PreviewRouteLineInfo(savedInstanceState);
        initMapTheme = DayNightMode.valueOf(savedInstanceState.getString(INIT_MAP_THEME));
        selectedMapTheme = DayNightMode.valueOf(savedInstanceState.getString(SELECTED_MAP_THEME));
    } else {
        previewRouteLineInfo = createPreviewRouteLineInfo();
        initMapTheme = requireSettings().DAYNIGHT_MODE.getModeValue(appMode);
        selectedMapTheme = initMapTheme;
    }
    requireMapActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {

        public void handleOnBackPressed() {
            dismiss();
        }
    });
}
Also used : OnBackPressedCallback(androidx.activity.OnBackPressedCallback) PreviewRouteLineInfo(net.osmand.plus.routing.PreviewRouteLineInfo)

Aggregations

PreviewRouteLineInfo (net.osmand.plus.routing.PreviewRouteLineInfo)2 OnBackPressedCallback (androidx.activity.OnBackPressedCallback)1 ColoringType (net.osmand.plus.routing.ColoringType)1 OsmandSettings (net.osmand.plus.settings.backend.OsmandSettings)1