@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;
  }
示例#2
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);
    }
示例#3
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);
	}
示例#4
0
    @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;
    }
示例#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;
  }
示例#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;
 }
示例#8
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;
  }
示例#9
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
  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;
 }
示例#14
0
 @Override
 protected boolean onTap(int i) {
   Toast.makeText(RestaurantMap.this, item.getSnippet(), Toast.LENGTH_SHORT).show();
   return (true);
 }