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.widget_no_icon, R.string.map_widget_fps_info, "fps", false, 30);
     mapInfoLayer.recreateControls();
   }
 }
 @Override
 public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
   if (isActive()) {
     registerWidget(activity);
   } else {
     MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
     if (mapInfoLayer != null && mapInfoLayer.getSideWidget(FPSTextInfoWidget.class) != null) {
       mapInfoLayer.removeSideWidget(mapInfoLayer.getSideWidget(FPSTextInfoWidget.class));
       mapInfoLayer.recreateControls();
     }
   }
 }
  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,
        18);
    layer.recreateControls();
  }
 @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;
     }
   }
 }
Example #5
0
 private void registerWidget(MapActivity activity) {
   MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
   if (mapInfoLayer != null) {
     routeStepsControl =
         createRouteStepsInfoControl(
             activity, mapInfoLayer.getPaintSubText(), mapInfoLayer.getPaintSubText());
     mapInfoLayer
         .getMapInfoControls()
         .registerSideWidget(
             routeStepsControl,
             R.drawable.widget_target,
             R.string.map_widget_route_points,
             "route_steps",
             false,
             8);
     mapInfoLayer.recreateControls();
   }
 }