private void addWaypoints(final SubMenu subMenu) {
    subMenu.clear();
    for (final Waypoint waypoint : geocache.getWaypoints()) {
      if (waypoint.getCoords() != null) {
        subMenu
            .add(Menu.NONE, waypoint.getId(), Menu.NONE, waypoint.getName())
            .setOnMenuItemClickListener(
                new OnMenuItemClickListener() {

                  @Override
                  public boolean onMenuItemClick(final MenuItem item) {
                    callback.onWaypointSelected(waypoint);
                    return true;
                  }
                });
      }
    }
    subMenu
        .add(Menu.NONE, Menu.NONE, Menu.NONE, getContext().getString(R.string.cache))
        .setOnMenuItemClickListener(
            new OnMenuItemClickListener() {

              @Override
              public boolean onMenuItemClick(final MenuItem item) {
                callback.onGeocacheSelected(geocache);
                return true;
              }
            });
  }
 private static boolean hasTargets(final Geocache cache) {
   for (final Waypoint waypoint : cache.getWaypoints()) {
     if (waypoint.getCoords() != null) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 3
0
 @Override
 public void navigate(@NonNull final Activity activity, @NonNull final Waypoint waypoint) {
   NewMap.startActivityCoords(
       activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName());
 }