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();
}
}
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;
}
}
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();
}
}
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;
}
});
}
}
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();
}
Aggregations