コード例 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == MENU_MAP) {
      CGeoMap.startActivityCoords(this, dstCoords, null, null);
    } else if (id == MENU_SWITCH_COMPASS_GPS) {
      boolean oldSetting = Settings.isUseCompass();
      Settings.setUseCompass(!oldSetting);
      if (oldSetting) {
        if (dir != null) {
          dir = app.removeDir();
        }
      } else {
        if (dir == null) {
          dir = app.startDir(this, dirUpdate);
        }
      }
    } else if (id == 2) {
      Intent pointIntent = new Intent(this, cgeopoint.class);
      startActivity(pointIntent);

      finish();
      return true;
    } else if (id > 3 && coordinates.get(id - 4) != null) {
      cgCoord coordinate = coordinates.get(id - 4);

      title = coordinate.getName();
      dstCoords = coordinate.getCoords();
      setTitle();
      setDestCoords();
      updateDistanceInfo();

      Log.d(Settings.tag, "destination set: " + title + " (" + dstCoords + ")");
      return true;
    }

    return false;
  }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: happyhugo/cgeo
 /** @param v unused here but needed since this method is referenced from XML layout */
 public void cgeoFindOnMap(final View v) {
   findOnMap.setPressed(true);
   CGeoMap.startActivityLiveMap(this);
 }