コード例 #1
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (poiThumbnail != null) poiThumbnail.cancelDownload();

    JunaioUtils.unbindDrawables(findViewById(android.R.id.content));
  }
コード例 #2
0
  /** Update GUI from currently selected POI Load POI actions */
  private void updateGUI() {
    try {
      TextView poiName = (TextView) findViewById(R.id.textPOIName);
      TextView poiDescription = (TextView) findViewById(R.id.textPOIDescription);
      View layoutLocation = findViewById(R.id.layoutPOILocation);

      poiThumbnail = (RemoteImageView) findViewById(R.id.imagePOIThumbnail);

      if (mPOI.getThumbnailURL().length() > 0) {
        poiThumbnail.setRemoteSource(new String(mPOI.getThumbnailURL()));
      } else {
        poiThumbnail.setVisibility(View.INVISIBLE);
      }

      final String name = mPOI.getName();
      if (name != null && name.length() >= 0) poiName.setText(name);

      poiDescription.setText(mPOI.getDescription());

      // add clickable links to strings like emails and websites
      Linkify.addLinks(poiDescription, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

      // show location information only if the POI has LLA coordinates
      if (mPOI.hasLLA()) {
        TextView poiLocation = (TextView) findViewById(R.id.textPOILocation);
        LLACoordinate mylocation =
            JunaioPlugin.getSensorsManager(getApplicationContext()).getLocation();

        // get the distance and store in results[0], get the bearing and
        // store it in results[1]
        float[] results = new float[2];
        Location.distanceBetween(
            mylocation.getLatitude(),
            mylocation.getLongitude(),
            mPOI.getLocation().getLatitude(),
            mPOI.getLocation().getLongitude(),
            results);

        // get the proper units. To change units see
        // JunaioPlugin.Settings.useImperialUnits
        poiLocation.setText(
            JunaioUtils.getRelativeLocationString(
                mPOI.getCurrentDistance(), 0, false, JunaioPlugin.Settings.useImperialUnits));

        JunaioPlugin.log("Bearing: " + results[1]);

        pointer.updateOrientation(-results[1]);
        layoutLocation.setVisibility(View.VISIBLE);
      } else {
        layoutLocation.setVisibility(View.GONE);
      }

      loadPOIActions();

    } catch (Exception e) {
      JunaioPlugin.log("POIDetailDialog.updateGUI: " + e.getMessage());
    }
  }