This commit is contained in:
Vitaliy 2020-03-06 12:27:58 +02:00
parent b8ea4f2ab7
commit eaba5bdcfd
2 changed files with 5 additions and 13 deletions

View file

@ -21,7 +21,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.AidlMapLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import net.osmand.util.Algorithms;
@ -174,11 +173,8 @@ public class ConnectedApp implements Comparable<ConnectedApp> {
widgetControls.put(widget.getId(), control);
int iconId = AndroidUtils.getDrawableId(mapActivity.getMyApplication(), widget.getMenuIconName());
int menuIconId = iconId != 0 ? iconId : ContextMenuItem.INVALID_ID;
MapWidgetRegistry.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);
}
String widgetKey = "aidl_widget_" + widget.getId();
layer.registerSideWidget(control, menuIconId, widget.getMenuTitle(), widgetKey, false, widget.getOrder());
}
}
}

View file

@ -72,7 +72,6 @@ import net.osmand.plus.views.AidlMapLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import net.osmand.router.TurnType;
import net.osmand.util.Algorithms;
@ -320,14 +319,11 @@ public class OsmandAidlApi {
ApplicationMode.regWidgetVisibility(widget.getId(), (ApplicationMode[]) null);
TextInfoWidget control = connectedApp.createWidgetControl(mapActivity, widgetId);
connectedApp.getWidgetControls().put(widgetId, control);
int iconId = AndroidUtils.getDrawableId(app, widget.getMenuIconName());
int menuIconId = iconId != 0 ? iconId : ContextMenuItem.INVALID_ID;
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);
}
String widgetKey = "aidl_widget_" + widgetId;
layer.registerSideWidget(control, menuIconId, widget.getMenuTitle(), widgetKey, false, widget.getOrder());
layer.recreateControls();
}
}