Search in sources :

Example 6 with MapInfoLayer

use of net.osmand.plus.views.MapInfoLayer in project Osmand by osmandapp.

the class OsmandAidlApi method registerRemoveMapWidgetReceiver.

private void registerRemoveMapWidgetReceiver(final MapActivity mapActivity) {
    removeMapWidgetReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String widgetId = intent.getStringExtra(AIDL_OBJECT_ID);
            if (widgetId != null) {
                MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
                TextInfoWidget widgetControl = widgetControls.get(widgetId);
                if (layer != null && widgetControl != null) {
                    layer.removeSideWidget(widgetControl);
                    widgetControls.remove(widgetId);
                    layer.recreateControls();
                }
            }
        }
    };
    mapActivity.registerReceiver(removeMapWidgetReceiver, new IntentFilter(AIDL_REMOVE_MAP_WIDGET));
}
Also used : Context(android.content.Context) TextInfoWidget(net.osmand.plus.views.mapwidgets.TextInfoWidget) IntentFilter(android.content.IntentFilter) MapInfoLayer(net.osmand.plus.views.MapInfoLayer) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

Example 7 with MapInfoLayer

use of net.osmand.plus.views.MapInfoLayer in project Osmand by osmandapp.

the class OsmandMonitoringPlugin method updateLayers.

@Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
    if (isActive()) {
        if (monitoringControl == null) {
            registerWidget(activity);
        }
    } else {
        if (monitoringControl != null) {
            MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
            layer.removeSideWidget(monitoringControl);
            layer.recreateControls();
            monitoringControl = null;
        }
    }
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Example 8 with MapInfoLayer

use of net.osmand.plus.views.MapInfoLayer in project Osmand by osmandapp.

the class ParkingPositionPlugin method registerWidget.

private void registerWidget(MapActivity activity) {
    MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
    if (mapInfoLayer != null) {
        parkingPlaceControl = createParkingPlaceInfoControl(activity);
        mapInfoLayer.registerSideWidget(parkingPlaceControl, R.drawable.ic_action_parking_dark, R.string.map_widget_parking, "parking", false, 10);
        mapInfoLayer.recreateControls();
    }
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Example 9 with MapInfoLayer

use of net.osmand.plus.views.MapInfoLayer in project Osmand by osmandapp.

the class OsmandMonitoringPlugin method registerWidget.

private void registerWidget(MapActivity activity) {
    MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
    monitoringControl = createMonitoringControl(activity);
    layer.registerSideWidget(monitoringControl, R.drawable.ic_action_play_dark, R.string.map_widget_monitoring, "monitoring", false, 30);
    layer.recreateControls();
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Example 10 with MapInfoLayer

use of net.osmand.plus.views.MapInfoLayer in project Osmand by osmandapp.

the class MapillaryPlugin method registerWidget.

private void registerWidget(MapActivity activity) {
    MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
    mapillaryControl = createMonitoringControl(activity);
    mapillaryWidgetRegInfo = layer.registerSideWidget(mapillaryControl, R.drawable.ic_action_mapillary, R.string.mapillary, "mapillary", false, 19);
    layer.recreateControls();
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Aggregations

MapInfoLayer (net.osmand.plus.views.MapInfoLayer)19 TextInfoWidget (net.osmand.plus.views.mapwidgets.TextInfoWidget)4 BroadcastReceiver (android.content.BroadcastReceiver)2 Context (android.content.Context)2 Intent (android.content.Intent)2 IntentFilter (android.content.IntentFilter)2 MenuItem (android.view.MenuItem)2 View (android.view.View)2 AMapWidget (net.osmand.aidl.mapwidget.AMapWidget)2 ContextMenuItem (net.osmand.plus.ContextMenuItem)2 IconsCache (net.osmand.plus.IconsCache)2 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)2 MapWidgetRegInfo (net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo)2 Toolbar (android.support.v7.widget.Toolbar)1 Menu (android.view.Menu)1 MenuInflater (android.view.MenuInflater)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1