Search in sources :

Example 1 with MapWidgetRegInfo

use of net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo in project Osmand by osmandapp.

the class MapInfoLayer method registerSideWidget.

public void registerSideWidget(TextInfoWidget widget, WidgetState widgetState, String key, boolean left, int priorityOrder) {
    MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, widgetState, key, left, priorityOrder);
    updateReg(calculateTextState(), reg);
}
Also used : MapWidgetRegInfo(net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo)

Example 2 with MapWidgetRegInfo

use of net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo in project Osmand by osmandapp.

the class MapInfoLayer method registerSideWidget.

public MapWidgetRegInfo registerSideWidget(TextInfoWidget widget, int drawableMenu, int messageId, String key, boolean left, int priorityOrder) {
    MapWidgetRegInfo reg = mapInfoControls.registerSideWidgetInternal(widget, drawableMenu, messageId, key, left, priorityOrder);
    updateReg(calculateTextState(), reg);
    return reg;
}
Also used : MapWidgetRegInfo(net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo)

Example 3 with MapWidgetRegInfo

use of net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo in project Osmand by osmandapp.

the class MapInfoLayer method updateColorShadowsOfText.

public void updateColorShadowsOfText() {
    boolean transparent = view.getSettings().TRANSPARENT_MAP_THEME.get();
    boolean nightMode = drawSettings != null && drawSettings.isNightMode();
    boolean following = routeLayer.getHelper().isFollowingMode();
    int calcThemeId = (transparent ? 4 : 0) | (nightMode ? 2 : 0) | (following ? 1 : 0);
    if (themeId != calcThemeId) {
        themeId = calcThemeId;
        TextState ts = calculateTextState();
        map.findViewById(R.id.map_center_info).setBackgroundResource(ts.boxFree);
        for (MapWidgetRegInfo reg : mapInfoControls.getLeftWidgetSet()) {
            updateReg(ts, reg);
        }
        for (MapWidgetRegInfo reg : mapInfoControls.getRightWidgetSet()) {
            updateReg(ts, reg);
        }
        updateStreetName(nightMode, ts);
        updateTopToolbar(nightMode);
        lanesControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius / 2);
        rulerControl.updateTextSize(nightMode, ts.textColor, ts.textShadowColor, (int) (2 * view.getDensity()));
        this.expand.setBackgroundResource(ts.expand);
        rightStack.invalidate();
        leftStack.invalidate();
    }
}
Also used : MapWidgetRegInfo(net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo)

Example 4 with MapWidgetRegInfo

use of net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo in project Osmand by osmandapp.

the class OsmandAidlApi method registerAddMapWidgetReceiver.

private void registerAddMapWidgetReceiver(final MapActivity mapActivity) {
    addMapWidgetReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String widgetId = intent.getStringExtra(AIDL_OBJECT_ID);
            if (widgetId != null) {
                AMapWidget widget = widgets.get(widgetId);
                if (widget != null) {
                    MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
                    if (layer != null) {
                        TextInfoWidget control = createWidgetControl(mapActivity, widgetId);
                        widgetControls.put(widgetId, control);
                        int menuIconId = getDrawableId(widget.getMenuIconName());
                        MapWidgetRegInfo widgetInfo = layer.registerSideWidget(control, menuIconId, widget.getMenuTitle(), "aidl_widget_" + widgetId, false, widget.getOrder());
                        if (!mapActivity.getMapLayers().getMapWidgetRegistry().isVisible(widgetInfo.key)) {
                            mapActivity.getMapLayers().getMapWidgetRegistry().setVisibility(widgetInfo, true, false);
                        }
                        layer.recreateControls();
                    }
                }
            }
        }
    };
    mapActivity.registerReceiver(addMapWidgetReceiver, new IntentFilter(AIDL_ADD_MAP_WIDGET));
}
Also used : Context(android.content.Context) TextInfoWidget(net.osmand.plus.views.mapwidgets.TextInfoWidget) IntentFilter(android.content.IntentFilter) MapWidgetRegInfo(net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo) MapInfoLayer(net.osmand.plus.views.MapInfoLayer) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) AMapWidget(net.osmand.aidl.mapwidget.AMapWidget)

Example 5 with MapWidgetRegInfo

use of net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo in project Osmand by osmandapp.

the class OsmandAidlApi method registerWidgetControls.

public void registerWidgetControls(MapActivity mapActivity) {
    for (AMapWidget widget : widgets.values()) {
        MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
        if (layer != null) {
            TextInfoWidget control = createWidgetControl(mapActivity, widget.getId());
            widgetControls.put(widget.getId(), control);
            int menuIconId = getDrawableId(widget.getMenuIconName());
            MapWidgetRegInfo widgetInfo = layer.registerSideWidget(control, menuIconId, widget.getMenuTitle(), "aidl_widget_" + widget.getId(), false, widget.getOrder());
            if (!mapActivity.getMapLayers().getMapWidgetRegistry().isVisible(widgetInfo.key)) {
                mapActivity.getMapLayers().getMapWidgetRegistry().setVisibility(widgetInfo, true, false);
            }
        }
    }
}
Also used : TextInfoWidget(net.osmand.plus.views.mapwidgets.TextInfoWidget) MapWidgetRegInfo(net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo) MapInfoLayer(net.osmand.plus.views.MapInfoLayer) AMapWidget(net.osmand.aidl.mapwidget.AMapWidget) FavouritePoint(net.osmand.data.FavouritePoint) AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint)

Aggregations

MapWidgetRegInfo (net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo)5 AMapWidget (net.osmand.aidl.mapwidget.AMapWidget)2 MapInfoLayer (net.osmand.plus.views.MapInfoLayer)2 TextInfoWidget (net.osmand.plus.views.mapwidgets.TextInfoWidget)2 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 AMapPoint (net.osmand.aidl.maplayer.point.AMapPoint)1 FavouritePoint (net.osmand.data.FavouritePoint)1