Search in sources :

Example 1 with TimeWidgetState

use of net.osmand.plus.views.mapwidgets.widgetstates.TimeWidgetState in project Osmand by osmandapp.

the class MapInfoLayer method registerAllControls.

private void registerAllControls(@NonNull MapActivity map) {
    rulerWidgets = new ArrayList<>();
    RouteInfoWidgetsFactory ric = new RouteInfoWidgetsFactory();
    MapInfoWidgetsFactory mic = new MapInfoWidgetsFactory();
    MapMarkersWidgetsFactory mwf = map.getMapLayers().getMapMarkersLayer().getWidgetsFactory();
    OsmandApplication app = view.getApplication();
    lanesControl = RouteInfoWidgetsFactory.createLanesControl(map, view);
    TextState ts = calculateTextState();
    streetNameView = new TopTextView(map.getMyApplication(), map);
    updateStreetName(false, ts);
    topCoordinatesView = new TopCoordinatesView(map.getMyApplication(), map);
    updateTopCoordinates(false, ts);
    topToolbarView = new TopToolbarView(map);
    updateTopToolbar(false);
    alarmControl = RouteInfoWidgetsFactory.createAlarmInfoControl(app, map);
    alarmControl.setVisibility(false);
    elevationProfileWidget = new ElevationProfileWidget(map);
    setupRulerWidget(mapRulerLayout);
    // register left stack
    registerSideWidget(null, R.drawable.ic_action_compass, R.string.map_widget_compass, WIDGET_COMPASS, true, 4);
    NextTurnWidget bigInfoControl = ric.createNextInfoControl(map, app, false);
    registerSideWidget(bigInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn, WIDGET_NEXT_TURN, true, 5);
    NextTurnWidget smallInfoControl = ric.createNextInfoControl(map, app, true);
    registerSideWidget(smallInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_turn_small, WIDGET_NEXT_TURN_SMALL, true, 6);
    NextTurnWidget nextNextInfoControl = ric.createNextNextInfoControl(map, app, true);
    registerSideWidget(nextNextInfoControl, R.drawable.ic_action_next_turn, R.string.map_widget_next_next_turn, WIDGET_NEXT_NEXT_TURN, true, 7);
    // register right stack
    // priorityOrder: 10s navigation-related, 20s position-related, 30s recording- and other plugin-related, 40s general device information, 50s debugging-purpose
    TextInfoWidget intermediateDist = ric.createIntermediateDistanceControl(map);
    registerSideWidget(intermediateDist, R.drawable.ic_action_intermediate, R.string.map_widget_intermediate_distance, WIDGET_INTERMEDIATE_DISTANCE, false, 13);
    TextInfoWidget intermediateTime = ric.createTimeControl(map, true);
    registerSideWidget(intermediateTime, new TimeWidgetState(app, true), WIDGET_INTERMEDIATE_TIME, false, 14);
    TextInfoWidget dist = ric.createDistanceControl(map);
    registerSideWidget(dist, R.drawable.ic_action_target, R.string.map_widget_distance, WIDGET_DISTANCE, false, 15);
    TextInfoWidget time = ric.createTimeControl(map, false);
    registerSideWidget(time, new TimeWidgetState(app, false), WIDGET_TIME, false, 16);
    TextInfoWidget marker = mwf.createMapMarkerControl(map, true);
    registerSideWidget(marker, R.drawable.ic_action_flag, R.string.map_marker_1st, WIDGET_MARKER_1, false, 17);
    TextInfoWidget bearing = ric.createBearingControl(map);
    registerSideWidget(bearing, new BearingWidgetState(app), WIDGET_BEARING, false, 18);
    TextInfoWidget marker2nd = mwf.createMapMarkerControl(map, false);
    registerSideWidget(marker2nd, R.drawable.ic_action_flag, R.string.map_marker_2nd, WIDGET_MARKER_2, false, 19);
    TextInfoWidget speed = ric.createSpeedControl(map);
    registerSideWidget(speed, R.drawable.ic_action_speed, R.string.map_widget_speed, WIDGET_SPEED, false, 20);
    TextInfoWidget maxspeed = ric.createMaxSpeedControl(map);
    registerSideWidget(maxspeed, R.drawable.ic_action_speed_limit, R.string.map_widget_max_speed, WIDGET_MAX_SPEED, false, 21);
    TextInfoWidget alt = mic.createAltitudeControl(map);
    registerSideWidget(alt, R.drawable.ic_action_altitude, R.string.map_widget_altitude, WIDGET_ALTITUDE, false, 23);
    TextInfoWidget gpsInfo = mic.createGPSInfoControl(map);
    registerSideWidget(gpsInfo, R.drawable.ic_action_gps_info, R.string.map_widget_gps_info, WIDGET_GPS_INFO, false, 28);
    TextInfoWidget plainTime = ric.createPlainTimeControl(map);
    registerSideWidget(plainTime, R.drawable.ic_action_time, R.string.map_widget_plain_time, WIDGET_PLAIN_TIME, false, 41);
    TextInfoWidget battery = ric.createBatteryControl(map);
    registerSideWidget(battery, R.drawable.ic_action_battery, R.string.map_widget_battery, WIDGET_BATTERY, false, 42);
    TextInfoWidget radiusRuler = mic.createRadiusRulerControl(map);
    registerSideWidget(radiusRuler, new CompassRulerWidgetState(app), WIDGET_RADIUS_RULER, false, 43);
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) MapInfoWidgetsFactory(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory) BearingWidgetState(net.osmand.plus.views.mapwidgets.widgetstates.BearingWidgetState) RouteInfoWidgetsFactory(net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory) CompassRulerWidgetState(net.osmand.plus.views.mapwidgets.widgetstates.CompassRulerWidgetState) MapMarkersWidgetsFactory(net.osmand.plus.views.mapwidgets.MapMarkersWidgetsFactory) TextInfoWidget(net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget) TimeWidgetState(net.osmand.plus.views.mapwidgets.widgetstates.TimeWidgetState) ElevationProfileWidget(net.osmand.plus.views.mapwidgets.widgets.ElevationProfileWidget) TopCoordinatesView(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopCoordinatesView) TopTextView(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView) TopToolbarView(net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarView) NextTurnWidget(net.osmand.plus.views.mapwidgets.widgets.NextTurnWidget)

Aggregations

OsmandApplication (net.osmand.plus.OsmandApplication)1 MapInfoWidgetsFactory (net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory)1 TopCoordinatesView (net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopCoordinatesView)1 TopTextView (net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView)1 TopToolbarView (net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarView)1 MapMarkersWidgetsFactory (net.osmand.plus.views.mapwidgets.MapMarkersWidgetsFactory)1 RouteInfoWidgetsFactory (net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory)1 ElevationProfileWidget (net.osmand.plus.views.mapwidgets.widgets.ElevationProfileWidget)1 NextTurnWidget (net.osmand.plus.views.mapwidgets.widgets.NextTurnWidget)1 TextInfoWidget (net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget)1 BearingWidgetState (net.osmand.plus.views.mapwidgets.widgetstates.BearingWidgetState)1 CompassRulerWidgetState (net.osmand.plus.views.mapwidgets.widgetstates.CompassRulerWidgetState)1 TimeWidgetState (net.osmand.plus.views.mapwidgets.widgetstates.TimeWidgetState)1