Search in sources :

Example 1 with MapInfoLayer

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

the class AudioVideoNotesPlugin method registerWidget.

private void registerWidget(MapActivity activity) {
    MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
    if (mapInfoLayer != null) {
        recordControl = new TextInfoWidget(activity);
        if (mediaRec != null && mediaRecFile != null) {
            updateRecordControl(activity, mediaRecFile);
        } else {
            recordControl.setImageDrawable(activity.getResources().getDrawable(R.drawable.monitoring_rec_inactive));
            setRecordListener(recordControl, activity);
        }
        mapInfoLayer.registerSideWidget(recordControl, R.drawable.ic_action_micro_dark, R.string.map_widget_av_notes, "audionotes", false, 32);
        mapInfoLayer.recreateControls();
    }
}
Also used : TextInfoWidget(net.osmand.plus.views.mapwidgets.TextInfoWidget) MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Example 2 with MapInfoLayer

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

the class AudioVideoNotesPlugin method updateLayers.

@Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
    if (isActive()) {
        if (SHOW_RECORDINGS.get()) {
            if (audioNotesLayer == null) {
                registerLayers(activity);
            } else if (!mapView.getLayers().contains(audioNotesLayer)) {
                mapView.addLayer(audioNotesLayer, 3.5f);
            }
        } else if (audioNotesLayer != null) {
            mapView.removeLayer(audioNotesLayer);
        }
        if (recordControl == null) {
            registerWidget(activity);
        }
    } else {
        if (audioNotesLayer != null) {
            mapView.removeLayer(audioNotesLayer);
            audioNotesLayer = null;
        }
        MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
        if (recordControl != null && mapInfoLayer != null) {
            mapInfoLayer.removeSideWidget(recordControl);
            recordControl = null;
            mapInfoLayer.recreateControls();
        }
        recordControl = null;
    }
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer)

Example 3 with MapInfoLayer

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

the class OsmandDevelopmentPlugin method registerWidget.

private void registerWidget(MapActivity activity) {
    MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
    final OsmandMapTileView mv = activity.getMapView();
    if (mapInfoLayer != null && mapInfoLayer.getSideWidget(FPSTextInfoWidget.class) == null) {
        FPSTextInfoWidget fps = new FPSTextInfoWidget(mv, activity);
        mapInfoLayer.registerSideWidget(fps, R.drawable.ic_action_fps, R.string.map_widget_fps_info, "fps", false, 50);
        mapInfoLayer.recreateControls();
    }
}
Also used : MapInfoLayer(net.osmand.plus.views.MapInfoLayer) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView)

Example 4 with MapInfoLayer

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

the class DashboardOnMap method updateToolbarActions.

private void updateToolbarActions() {
    TextView tv = (TextView) dashboardView.findViewById(R.id.toolbar_text);
    tv.setText("");
    boolean waypointsVisible = visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT;
    if (waypointsVisible) {
        tv.setText(R.string.waypoints);
    } else if (visibleType == DashboardType.CONFIGURE_MAP) {
        tv.setText(R.string.configure_map);
    } else if (visibleType == DashboardType.CONFIGURE_SCREEN) {
        tv.setText(R.string.layer_map_appearance);
    } else if (visibleType == DashboardType.ROUTE_PREFERENCES) {
        tv.setText(R.string.shared_string_settings);
    } else if (visibleType == DashboardType.UNDERLAY_MAP) {
        tv.setText(R.string.map_underlay);
    } else if (visibleType == DashboardType.OVERLAY_MAP) {
        tv.setText(R.string.map_overlay);
    } else if (visibleType == DashboardType.MAPILLARY) {
        tv.setText(R.string.mapillary);
    } else if (visibleType == DashboardType.CONTOUR_LINES) {
        tv.setText(R.string.srtm_plugin_name);
    } else if (visibleType == DashboardType.HILLSHADE) {
        tv.setText(R.string.layer_hillshade);
    } else if (visibleType == DashboardType.OSM_NOTES) {
        tv.setText(R.string.osm_notes);
    }
    ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
    edit.setVisibility(View.GONE);
    ImageView sort = (ImageView) dashboardView.findViewById(R.id.toolbar_sort);
    sort.setVisibility(View.GONE);
    ImageView ok = (ImageView) dashboardView.findViewById(R.id.toolbar_ok);
    ok.setVisibility(View.GONE);
    ImageView flat = (ImageView) dashboardView.findViewById(R.id.toolbar_flat);
    flat.setVisibility(View.GONE);
    ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
    settingsButton.setVisibility(View.GONE);
    IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
    ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
    lst.setVisibility(View.GONE);
    ImageView back = (ImageView) dashboardView.findViewById(R.id.toolbar_back);
    back.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
    back.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            backPressed();
        }
    });
    if (waypointsVisible && getMyApplication().getWaypointHelper().getAllPoints().size() > 0) {
        if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
            flat.setVisibility(View.VISIBLE);
            final boolean flatNow = visibleType == DashboardType.WAYPOINTS_FLAT;
            flat.setImageDrawable(iconsCache.getIcon(flatNow ? R.drawable.ic_tree_list_dark : R.drawable.ic_flat_list_dark));
            flat.setContentDescription(mapActivity.getString(flatNow ? R.string.access_tree_list : R.string.drawer));
            flat.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS : DashboardType.WAYPOINTS_FLAT, previousVisibleType, false, AndroidUtils.getCenterViewCoordinates(v));
                }
            });
        }
    }
    if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
        settingsButton.setVisibility(View.VISIBLE);
        settingsButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                new DashboardSettingsDialogFragment().show(mapActivity.getSupportFragmentManager(), "dashboard_settings");
            }
        });
        lst.setVisibility(View.VISIBLE);
        lst.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                hideDashboard(false);
                mapActivity.openDrawer();
            }
        });
    }
    toolbar.getMenu().clear();
    if (visibleType == DashboardType.CONFIGURE_SCREEN) {
        toolbar.inflateMenu(R.menu.refresh_menu);
        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem menuItem) {
                if (menuItem.getItemId() == R.id.action_refresh) {
                    MapWidgetRegistry registry = mapActivity.getMapLayers().getMapWidgetRegistry();
                    registry.resetToDefault();
                    MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
                    if (mil != null) {
                        mil.recreateControls();
                    }
                    updateListAdapter(registry.getViewConfigureMenuAdapter(mapActivity));
                }
                return false;
            }
        });
    }
}
Also used : MenuItem(android.view.MenuItem) ContextMenuItem(net.osmand.plus.ContextMenuItem) ImageView(android.widget.ImageView) DynamicListView(net.osmand.plus.views.controls.DynamicListView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) ScrollView(android.widget.ScrollView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) MapWidgetRegistry(net.osmand.plus.views.mapwidgets.MapWidgetRegistry) MapInfoLayer(net.osmand.plus.views.MapInfoLayer) TextView(android.widget.TextView) DashboardSettingsDialogFragment(net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment) ImageView(android.widget.ImageView) IconsCache(net.osmand.plus.IconsCache) Toolbar(android.support.v7.widget.Toolbar)

Example 5 with MapInfoLayer

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

the class MapWidgetRegistry method updateMapMarkersMode.

public void updateMapMarkersMode(MapActivity mapActivity) {
    for (MapWidgetRegInfo info : rightWidgetSet) {
        if ("map_marker_1st".equals(info.key)) {
            setVisibility(info, settings.MAP_MARKERS_MODE.get().isWidgets() && settings.MARKERS_DISTANCE_INDICATION_ENABLED.get(), false);
        } else if ("map_marker_2nd".equals(info.key)) {
            setVisibility(info, settings.MAP_MARKERS_MODE.get().isWidgets() && settings.MARKERS_DISTANCE_INDICATION_ENABLED.get() && settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 2, false);
        }
    }
    MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
    if (mil != null) {
        mil.recreateControls();
    }
    mapActivity.refreshMap();
}
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