Exemplo n.º 1
0
  private void updateCurrentLocationItem() {
    Context context = AndroidPersistentContext.getInstance().getContext();
    PoiDataWrapper poiDataWrapper = (PoiDataWrapper) this.model.get(KEY_O_POI_DATA_WRAPPER);
    Stop anchor = null;
    Address currentAddress = (Address) this.model.get(KEY_O_CURRENT_ADDRESS);
    String lastline = null;
    if (currentAddress != null) {
      anchor = currentAddress.getStop();
      // If this anchor have no firstline this is an address with unknown label.
    }
    if (anchor == null) {
      anchor = poiDataWrapper.getAnchorStop();
    }
    if (anchor == null) {
      lastline = context.getString(R.string.addplace_current_location_loading);
    } else {
      lastline = anchor.getFirstLine();
      if (lastline == null || lastline.length() == 0) {
        lastline =
            context.getString(
                R.string.addplace_location_info,
                anchor.getLat() / 100000.0d,
                anchor.getLon() / 100000.0d);
      }
    }

    if (!lastline.equals(currentLocationItem.getLastLine())) {
      currentLocationItem.setLastLine(lastline);
    }
  }