Пример #1
0
 public boolean updateWaypoint() {
   final LocationPointWrapper pnt = waypointHelper.getMostImportantLocationPoint(null);
   boolean changed = this.lastPoint != pnt;
   this.lastPoint = pnt;
   if (pnt == null) {
     topBar.setOnClickListener(null);
     updateVisibility(waypointInfoBar, false);
     return false;
   } else {
     updateVisibility(addressText, false);
     updateVisibility(addressTextShadow, false);
     boolean updated = updateVisibility(waypointInfoBar, true);
     // pass top bar to make it clickable
     WaypointDialogHelper.updatePointInfoView(
         map.getMyApplication(),
         map,
         topBar,
         pnt,
         true,
         map.getMyApplication().getDaynightHelper().isNightModeForMapControls(),
         false,
         true);
     if (updated || changed) {
       ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
       ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
       all.setOnClickListener(
           new View.OnClickListener() {
             @Override
             public void onClick(View view) {
               map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
             }
           });
       remove.setOnClickListener(
           new View.OnClickListener() {
             @Override
             public void onClick(View view) {
               waypointHelper.removeVisibleLocationPoint(pnt);
               map.refreshMap();
             }
           });
     }
     return true;
   }
 }
 public boolean updateInfo(DrawSettings drawSettings) {
   boolean trafficWarnings = settings.SHOW_TRAFFIC_WARNINGS.get();
   boolean cams = settings.SHOW_CAMERAS.get();
   boolean peds = settings.SHOW_PEDESTRIAN.get();
   boolean visible = false;
   boolean eval = rh.isFollowingMode() || trackingUtilities.isMapLinkedToLocation();
   if ((trafficWarnings || cams) && eval) {
     AlarmInfo alarm;
     if (rh.isFollowingMode()) {
       alarm = wh.getMostImportantAlarm(settings.METRIC_SYSTEM.get(), cams);
     } else {
       RouteDataObject ro = locationProvider.getLastKnownRouteSegment();
       Location loc = locationProvider.getLastKnownLocation();
       if (ro != null && loc != null) {
         alarm = wh.calculateMostImportantAlarm(ro, loc, settings.METRIC_SYSTEM.get(), cams);
       } else {
         alarm = null;
       }
     }
     if (alarm != null) {
       int locimgId = R.drawable.warnings_limit;
       String text = "";
       if (alarm.getType() == AlarmInfoType.SPEED_LIMIT) {
         if (settings.DRIVING_REGION.get().americanSigns) {
           locimgId = R.drawable.warnings_speed_limit_us;
           // else case is done by drawing red ring
         }
         text = alarm.getIntValue() + "";
       } else if (alarm.getType() == AlarmInfoType.SPEED_CAMERA) {
         locimgId = R.drawable.warnings_speed_camera;
       } else if (alarm.getType() == AlarmInfoType.BORDER_CONTROL) {
         locimgId = R.drawable.warnings_border_control;
       } else if (alarm.getType() == AlarmInfoType.HAZARD) {
         locimgId = R.drawable.warnings_hazard;
       } else if (alarm.getType() == AlarmInfoType.TOLL_BOOTH) {
         // image done by drawing red ring
       } else if (alarm.getType() == AlarmInfoType.TRAFFIC_CALMING) {
         if (settings.DRIVING_REGION.get().americanSigns) {
           locimgId = R.drawable.warnings_traffic_calming_us;
         } else {
           locimgId = R.drawable.warnings_traffic_calming;
         }
       } else if (alarm.getType() == AlarmInfoType.STOP) {
         locimgId = R.drawable.warnings_stop;
       } else if (alarm.getType() == AlarmInfoType.RAILWAY) {
         if (settings.DRIVING_REGION.get().americanSigns) {
           locimgId = R.drawable.warnings_railways_us;
         } else {
           locimgId = R.drawable.warnings_railways;
         }
       } else if (alarm.getType() == AlarmInfoType.PEDESTRIAN) {
         if (settings.DRIVING_REGION.get().americanSigns) {
           locimgId = R.drawable.warnings_pedestrian_us;
         } else {
           locimgId = R.drawable.warnings_pedestrian;
         }
       } else {
         text = null;
       }
       visible = (text != null && text.length() > 0) || (locimgId != 0);
       if (visible) {
         if (alarm.getType() == AlarmInfoType.SPEED_CAMERA) {
           visible = cams;
         } else if (alarm.getType() == AlarmInfoType.PEDESTRIAN) {
           visible = peds;
         } else {
           visible = trafficWarnings;
         }
       }
       if (visible) {
         if (locimgId != imgId) {
           imgId = locimgId;
           icon.setImageResource(locimgId);
         }
         if (!Algorithms.objectEquals(text, this.textString)) {
           textString = text;
           this.text.setText(this.textString);
         }
       }
     }
   }
   updateVisibility(layout, visible);
   return true;
 }