Exemple #1
0
  /**
   * Called when the user clicks on one of the icons in the map. It uses a Toast to say hello.
   *
   * @param pIndex is the Find's index in the ArrayList
   */
  @Override
  protected boolean onTap(int pIndex) {
    Dialog dialog = new Dialog(mContext);
    dialog.setCanceledOnTouchOutside(true);

    OverlayItem item = mOverlays.get(pIndex);
    dialog.setContentView(R.layout.custom_dialog);
    dialog.setTitle(item.getTitle());

    TextView text = (TextView) dialog.findViewById(R.id.text);
    text.setText(item.getSnippet());
    ImageView image = (ImageView) dialog.findViewById(R.id.image);

    image.setImageResource(R.drawable.small_letter);
    dialog.show();

    // Get contact
    StringTokenizer st = new StringTokenizer(item.getTitle(), "  ,      ");
    String temp = st.nextToken();
    final String contact = st.nextToken();

    final Button button = (Button) dialog.findViewById(R.id.more_info_button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Intent myIntent = new Intent();
            myIntent.setClassName("edu.stanford.jdiprete", "edu.stanford.jdiprete.DialogOnclick");
            myIntent.putExtra("contact", contact);
            myIntent.putExtra("captureId", captureId);
            mContext.startActivity(myIntent);
          }
        });
    return true;
  }
  @Override
  public boolean onTap(int index) {
    OverlayItem item = overlayItemList.get(index);
    Log.d("CBOverlay", item.getTitle() + ": " + item.getSnippet());
    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet());

    dialog.setPositiveButton(
        "Apply!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            // Apply to CB Job
            try {
              String response = CurrentUser.sendApplication();
              Toast.makeText(mContext, "Posted Job Successfully!", Toast.LENGTH_SHORT).show();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
    dialog.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            // Disregard
            dialog.dismiss();
          }
        });

    dialog.show();
    return true;
  }
Exemple #3
0
    @Override
    protected boolean onTap(int i) {
      if (item.getSnippet() == null) {
        // Show toast message with current location string
        Toast.makeText(LocationMap.this, item.getTitle(), Toast.LENGTH_SHORT).show();
      } else {
        // Show dialog with options on tap
        AlertDialog.Builder builder = new AlertDialog.Builder(LocationMap.this);
        tapCode = item.getSnippet();
        tapName = item.getTitle();
        builder
            .setTitle(getString(R.string.station))
            .setMessage(tapName + " (" + tapCode + ")")
            .setPositiveButton(
                getString(R.string.query),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    // USSD query
                    BusPlus bp = (BusPlus) getApplicationContext();
                    bp.callUSSDCode(tapCode);
                    dialog.dismiss();
                  }
                })
            .setNeutralButton(
                getString(R.string.favorites),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    String suffix = "";
                    if (!lineSummary.equals(""))
                      suffix = " (" + lineSummary.replaceAll("\\s+/.*?/", "") + ")";

                    // Add favorite and toast a message
                    helper.insertFavorite(Integer.parseInt(tapCode), tapName + suffix);
                    BusPlus bp = (BusPlus) getApplicationContext();
                    bp.showToastMessage(getString(R.string.favorite_added_to_list));
                  }
                })
            .setNegativeButton(
                getString(R.string.shortcut),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    String suffix = "";
                    if (!lineSummary.equals(""))
                      suffix = " (" + lineSummary.replaceAll("\\s+/.*?/", "") + ")";

                    // Add shortcut
                    BusPlus bp = (BusPlus) getApplicationContext();
                    bp.setupShortcut(tapCode, tapName + suffix);
                  }
                });
        AlertDialog alert = builder.create();
        alert.show();
      }
      return (true);
    }
  @Override
  protected boolean onBalloonTap(int index, OverlayItem item) {
    Toast.makeText(c, "Retrieving profile for " + item.getTitle(), Toast.LENGTH_LONG).show();
    Intent other = new Intent(c, OtherProfileActivity.class);
    UserProfile userProf = fetchProfile(item.getTitle());
    SnotgAndroidConstants.STATE_CHAT_OTHER_USERID =
        userProf.getUserId(); // State for chat recipient

    Bundle b = new Bundle();
    b.putSerializable("profile", userProf);
    other.putExtras(b);
    c.startActivity(other);

    return true;
  }
Exemple #5
0
  @Override
  protected boolean onTap(int index) {
    item = mOverlays.get(index);
    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet());
    dialog.setPositiveButton(
        "Details",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            Intent intent = new Intent(mContext, TabBar.class);
            Bundle b = new Bundle();
            b.putString("assetname", asset.name);
            b.putString("modelname", asset.model);

            intent.putExtras(b);
            mContext.startActivity(intent);
          }
        });
    dialog.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {}
        });
    dialog.show();

    return true;
  }
Exemple #6
0
 @Override
 protected boolean onTap(int index) {
   OverlayItem item = mOverlays.get(index);
   AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
   dialog.setTitle(item.getTitle());
   final String snippet = item.getSnippet();
   if (snippet.toString().length() > 0) {
     dialog.setMessage(snippet);
     dialog.setPositiveButton(
         "More Info",
         new OnClickListener() {
           @Override
           public void onClick(DialogInterface arg0, int arg1) {
             String[] snippetArray = snippet.replace(" ", "+").split("\n");
             Uri uri =
                 Uri.parse(
                     "https://www.google.com/search?q=" + snippetArray[0] + "+" + snippetArray[1]);
             Intent intent = new Intent(Intent.ACTION_VIEW, uri);
             mContext.startActivity(intent);
           }
         });
   }
   dialog.show();
   return true;
 }
 @Override
 protected boolean onTap(int i) {
   OverlayItem item = items.get(i);
   String text = item.getTitle() + " - " + item.getSnippet();
   Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
   return true;
 }
    @Override
    protected boolean onTap(int index) {

      final OverlayItem item = mOverlays.get(index);
      AlertDialog.Builder dialog = new AlertDialog.Builder(MapsScience.this);
      dialog.setTitle(item.getTitle());
      dialog.setMessage(item.getSnippet());

      dialog.setNegativeButton(
          "Navigate",
          new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int id) {
              startActivity(
                  new Intent(
                      Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + item.getSnippet())));
            }
          });

      dialog.setPositiveButton(
          "Ok",
          new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
            }
          });
      dialog.show();

      return true;
    }
Exemple #9
0
  @Override
  protected boolean onTap(int index) {
    final OverlayItem overlayItem = overlays.get(index);
    String name = overlayItem.getTitle();

    String currentTarget = map.getPointsProvider().getStatus(DataProvider.CURRENT_TARGET);
    final Clue clue = map.getPointsProvider().getClue(name);
    Log.d(LOG_TAG, "Tapped on clue: " + clue);
    Clue currentTargetClue = null;
    if (currentTarget != null) {
      currentTargetClue = map.getPointsProvider().getClue(currentTarget);
    }

    if (clue.getFound() != null) {
      //		  handleResetFoundMenu();
      return true;
    }
    if (clue.getName().equals(currentTarget)) {
      // handleWisselNaarEindpuntMenu
      return true;
    }

    handleGaNaarMenu(clue, currentTargetClue);

    Log.d(LOG_TAG, clue.toString());

    return true;
  }
Exemple #10
0
	@Override
	protected boolean onTap(int i) {
		OverlayItem overlayItem = imagens.get(i);
		String texto = overlayItem.getTitle() + " - " + overlayItem.getSnippet();
		Toast.makeText(context, texto,Toast.LENGTH_SHORT).show();
		return(true);
	}
Exemple #11
0
 protected boolean OnTap(int index) {
   OverlayItem item = mapOverlays.get(index);
   AlertDialog.Builder dialog = new AlertDialog.Builder(context);
   dialog.setTitle(item.getTitle());
   dialog.setMessage(item.getSnippet());
   dialog.show();
   return true;
 }
  @Override
  protected boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    String station = item.getTitle();
    String city = item.getSnippet();

    prompt_confirm(station, city, mSetResult);
    return true;
  }
 @Override
 protected boolean onTap(int index) {
   // TODO Auto-generated method stub
   OverlayItem item = overlayItems.get(index);
   AlertDialog.Builder builder = new AlertDialog.Builder(context);
   builder.setTitle(item.getTitle());
   builder.setMessage(item.getSnippet());
   Dialog dialog = builder.create();
   dialog.show();
   return true;
 }
  @Override
  public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    // go through all OverlayItems and draw title for each of them
    for (OverlayItem item : mOverlays) {
      /* Converts latitude & longitude of this overlay item to coordinates on screen.
       * As we have called boundCenterBottom() in constructor, so these coordinates
       * will be of the bottom center position of the displayed marker.
       */
      GeoPoint point = item.getPoint();
      Point markerBottomCenterCoords = new Point();
      mapView.getProjection().toPixels(point, markerBottomCenterCoords);

      /* Find the width and height of the title*/
      TextPaint paintText = new TextPaint();
      Paint paintRect = new Paint();

      Rect rect = new Rect();
      paintText.setTextSize(FONT_SIZE);
      paintText.getTextBounds(item.getTitle(), 0, item.getTitle().length(), rect);

      rect.inset(-TITLE_MARGIN, -TITLE_MARGIN);
      rect.offsetTo(
          markerBottomCenterCoords.x - rect.width() / 2,
          markerBottomCenterCoords.y - markerHeight - rect.height());

      paintText.setTextAlign(Paint.Align.CENTER);
      paintText.setTextSize(FONT_SIZE);
      paintText.setARGB(255, 255, 255, 255);
      paintRect.setARGB(130, 0, 0, 0);

      canvas.drawRoundRect(new RectF(rect), 2, 2, paintRect);
      canvas.drawText(
          item.getTitle(), rect.left + rect.width() / 2, rect.bottom - TITLE_MARGIN, paintText);
    }
  }
  @Override
  protected boolean onTap(int index) {

    if (myContext != null) {

      // obtain zipcode and locationid of tapped item
      OverlayItem item = overlayList.get(index);
      String zipcode = item.getTitle();
      String locationid = item.getSnippet();

      // start Demographic activity, passing in zipcode
      SearchMapActivity mapActivity = (SearchMapActivity) myContext;
      Intent intent = new Intent(mapActivity, DemographicActivity.class);
      intent.putExtra("zipcode", zipcode);
      intent.putExtra("locationid", locationid);
      mapActivity.startActivity(intent);
    }
    return true;
  }
 @Override
 protected boolean onTap(int index) {
   OverlayItem item = overlays.get(index);
   AlertDialog.Builder dialog = new AlertDialog.Builder(context);
   dialog.setTitle(item.getTitle());
   dialog.setMessage(item.getSnippet());
   if ((item instanceof StopOverlayItem) && (context instanceof MapChooserActivity)) {
     final Stop stop = ((StopOverlayItem) item).getStop();
     if (stop.getNumber() != null) {
       dialog.setPositiveButton(
           context.getString(R.string.open),
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
               dialog.dismiss();
               FetchRoutesTask task = new FetchRoutesTask(context, db);
               ((MapChooserActivity) context).setFetchRoutesTask(task);
               task.execute(stop.getNumber());
             }
           });
     }
     dialog.setNegativeButton(
         context.getString(R.string.cancel),
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
             dialog.cancel();
           }
         });
   } else {
     dialog.setNegativeButton(
         context.getString(R.string.ok),
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
             dialog.cancel();
           }
         });
   }
   dialog.show();
   return true;
 }
Exemple #17
0
  @Override
  public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow);

    Paint mPaint = new Paint();
    mPaint.setDither(true);
    mPaint.setColor(Color.RED);
    mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(2);

    List<Clue> clues = huntedService.getDataProvider().getTrackLog();

    Clue prevClue = null;
    for (Clue clue : clues) {
      if (prevClue != null) {
        GeoPoint prevCluePoint = Map.getPointForClue(prevClue);
        GeoPoint currentCluePoint = Map.getPointForClue(clue);
        Point fromPoint = new Point();
        mapView.getProjection().toPixels(prevCluePoint, fromPoint);
        Point toPoint = new Point();
        mapView.getProjection().toPixels(currentCluePoint, toPoint);
        canvas.drawLine(fromPoint.x, fromPoint.y, toPoint.x, toPoint.y, mPaint);
      }

      prevClue = clue;
    }

    // go through all OverlayItems and draw title for each of them
    List<OverlayItem> overlaysCopy = new ArrayList<OverlayItem>(overlays);
    for (OverlayItem item : overlaysCopy) {
      /* Converts latitude & longitude of this overlay item to coordinates on screen.
       * As we have called boundCenterBottom() in constructor, so these coordinates
       * will be of the bottom center position of the displayed marker.
       */
      GeoPoint point = item.getPoint();
      Point markerBottomCenterCoords = new Point();
      mapView.getProjection().toPixels(point, markerBottomCenterCoords);

      /* Find the width and height of the title*/
      TextPaint paintText = new TextPaint();
      Paint paintRect = new Paint();

      Rect rect = new Rect();
      paintText.setTextSize(FONT_SIZE);
      paintText.getTextBounds(item.getTitle(), 0, item.getTitle().length(), rect);

      rect.inset(-TITLE_MARGIN, -TITLE_MARGIN);
      rect.offsetTo(
          markerBottomCenterCoords.x - rect.width() / 2,
          markerBottomCenterCoords.y - 15 - rect.height());

      paintText.setTextAlign(Paint.Align.CENTER);
      paintText.setTextSize(FONT_SIZE);
      paintText.setARGB(255, 255, 255, 255);
      paintRect.setARGB(130, 0, 0, 0);

      canvas.drawRoundRect(new RectF(rect), 2, 2, paintRect);
      canvas.drawText(
          item.getTitle(), rect.left + rect.width() / 2, rect.bottom - TITLE_MARGIN, paintText);
    }
  }