コード例 #1
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    MenuItem item;
    item = menu.findItem(1);
    if (settings.useCompass == 1) {
      item.setTitle(res.getString(R.string.use_gps));
    } else {
      item.setTitle(res.getString(R.string.use_compass));
    }

    return true;
  }
コード例 #2
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    try {
      boolean visible = waypoint != null && waypoint.getCoords() != null;
      menu.findItem(MENU_ID_NAVIGATION).setVisible(visible);
      menu.findItem(MENU_ID_COMPASS).setVisible(visible);
      menu.findItem(MENU_ID_CACHES_AROUND).setVisible(visible);
    } catch (Exception e) {
      // nothing
    }

    return true;
  }
コード例 #3
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    try {
      boolean visible = waypoint != null && waypoint.getCoords() != null;
      menu.findItem(MENU_ID_NAVIGATION).setVisible(visible);
      menu.findItem(MENU_ID_DEFAULT_NAVIGATION).setVisible(visible);
      menu.findItem(MENU_ID_CACHES_AROUND).setVisible(visible);

      boolean openGeocache = waypoint != null && StringUtils.isNotEmpty(waypoint.getGeocode());
      menu.findItem(MENU_ID_OPEN_GEOCACHE).setVisible(openGeocache);
    } catch (Exception e) {
      // nothing
    }

    return true;
  }
コード例 #4
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    try {
      final Geopoint coords = getDestination();

      if (coords != null) {
        menu.findItem(MENU_NAVIGATE).setVisible(true);
        menu.findItem(MENU_COMPASS).setVisible(true);
        menu.findItem(MENU_CACHES_AROUND).setVisible(true);
      } else {
        menu.findItem(MENU_NAVIGATE).setVisible(false);
        menu.findItem(MENU_COMPASS).setVisible(false);
        menu.findItem(MENU_CACHES_AROUND).setVisible(false);
      }

      menu.findItem(MENU_CLEAR_HISTORY).setEnabled(!getHistoryOfSearchedLocations().isEmpty());
    } catch (Exception e) {
      // nothing
    }

    return true;
  }