コード例 #1
0
  public void onNavigationClick(View view) {
    Logger.Debug("On navigation click");
    if (this.currentPlace != null && this.currentPlace.getLocation() != null) {
      android.location.Location currentLocation = AppLocationManager.getCurrentLocation();

      if (currentLocation != null) {
        String uri =
            "google.navigation:q="
                + this.currentPlace.getLocation().getLatitude()
                + ","
                + this.currentPlace.getLocation().getLongitude();
        Logger.Debug("Uri = " + uri);

        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
        this.startActivity(intent);
      }
    }
  }
コード例 #2
0
  public void onDirectionsClick(View view) {
    Logger.Debug("On direction click");
    if (this.currentPlace != null && this.currentPlace.getLocation() != null) {
      android.location.Location currentLocation = AppLocationManager.getCurrentLocation();

      if (currentLocation != null) {
        String uri =
            "http://maps.google.com/maps?saddr="
                + currentLocation.getLatitude()
                + ","
                + currentLocation.getLongitude()
                + "&daddr="
                + this.currentPlace.getLocation().getLatitude()
                + ","
                + this.currentPlace.getLocation().getLongitude();
        Logger.Debug("Uri = " + uri);

        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
        this.startActivity(intent);
      }
    }
  }
コード例 #3
0
  public void onCheckIn(View view) {
    Logger.Debug("On check in click");
    if (this.currentPlace != null && this.currentPlace.getLocation() != null) {
      Intent intent = new Intent(this, FbPlacePicker.class);

      Location currentLocation = this.currentPlace.getLocation();
      intent.putExtra("latitude", currentLocation.getLatitude());
      intent.putExtra("longitude", currentLocation.getLongitude());
      intent.putExtra(PlacePickerFragment.RADIUS_IN_METERS_BUNDLE_KEY, 50);
      intent.putExtra(PlacePickerFragment.SHOW_SEARCH_BOX_BUNDLE_KEY, false);
      intent.putExtra(PlacePickerFragment.SEARCH_TEXT_BUNDLE_KEY, this.currentPlace.getName());

      android.location.Location location =
          new android.location.Location(LocationManager.GPS_PROVIDER);
      location.setLatitude(Double.valueOf(currentLocation.getLatitude()));
      location.setLongitude(Double.valueOf(currentLocation.getLongitude()));

      intent.putExtra(PlacePickerFragment.LOCATION_BUNDLE_KEY, location);

      this.startActivity(intent);
    }
  }
コード例 #4
0
  private void showEventList(List<Event> eventList) {

    TextView tv = (TextView) findViewById(android.R.id.empty);
    if (eventList != null && eventList.size() > 0) {

      tv.setText(R.string.events);
      // tv.setVisibility(View.GONE);
      LinearLayout ll = (LinearLayout) findViewById(android.R.id.list);

      if (ll != null) {
        for (int i = 0; i < eventList.size(); i++) {
          Event event = eventList.get(i);
          tv = new TextView(this);

          String eventName = event.getName().trim();
          Logger.Debug("Add event with name = " + event.toString());
          tv.setText(eventName);

          final String eventId = event.getId();
          final SourceType source = event.getSource();
          tv.setOnClickListener(
              new OnClickListener() {
                @Override
                public void onClick(View v) {
                  // TODO Auto-generated method stub
                  Intent intent = new Intent(PlaceDetailsActivity.this, EventDetailsActivity.class);
                  intent.putExtra("event_id", eventId);
                  intent.putExtra("source", source);
                  PlaceDetailsActivity.this.startActivity(intent);
                }
              });
          ll.addView(tv, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        }
      }
    } else {
      tv.setVisibility(View.VISIBLE);
    }
  } // end showEventList