Example #1
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;
  }
Example #2
0
  private void handleGevondenAlert(final Clue selectedClue, final Clue currentTargetClue) {
    AlertDialog.Builder alert = new AlertDialog.Builder(context);

    alert.setTitle("Gevonden: " + currentTargetClue.getName());
    alert.setMessage("Woord");

    // Set an EditText view to get user input
    final EditText input = new EditText(context);
    alert.setView(input);

    alert.setPositiveButton(
        "Versturen",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            String word = input.getText().toString();
            new GevondenTask(context, huntedService, word, selectedClue.getName()).execute(null);
            //				map.createMapOverlay();
            //				map.moveMapToClue(selectedClue);
            // Do something with value!
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
Example #3
0
  private void handleGaNaarMenu(final Clue selectedClue, final Clue currentTargetClue) {
    CharSequence[] itemseq = null;
    if (currentTargetClue == null) {
      itemseq = new CharSequence[] {"Vertrek naar " + selectedClue.getName()};
    } else {
      itemseq =
          new CharSequence[] {
            currentTargetClue.getName() + " gevonden, naar " + selectedClue.getName(),
            "Wissel van " + currentTargetClue.getName() + " naar " + selectedClue.getName(),
            "Ga naar eindpunt"
          };
    }
    final CharSequence[] items = itemseq;

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("Punt " + selectedClue.getName());
    builder.setItems(
        items,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int item) {
            if (item == 0) {
              if (currentTargetClue != null) {
                // ga naar
                handleGevondenAlert(selectedClue, currentTargetClue);
              } else {
                // vertrek
                new VertrekNaarTask(context, huntedService, selectedClue.getName()).execute(null);
                //						map.createMapOverlay();
                //						map.moveMapToClue(selectedClue);
              }

            } else if (item == 1) {
              // wissel
              new WisselTask(context, huntedService, selectedClue.getName()).execute(null);
              //			          map.createMapOverlay();
              //			          map.moveMapToClue(selectedClue);
            } else if (item == 2) {
              // ga naar eindpunt
            } else if (item == 3) {
              // wissel naar eindpunt
            }
          }
        });
    AlertDialog alert = builder.create();
    alert.show();
  }