コード例 #1
0
ファイル: StatusUpdate.java プロジェクト: prt2121/TPic
  /* package */ HttpParameter[] asHttpParameterArray(final HttpParameter includeEntities) {
    final ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
    appendParameter("status", status, params);
    if (-1 != inReplyToStatusId) {
      appendParameter("in_reply_to_status_id", inReplyToStatusId, params);
    }
    if (location != null) {
      appendParameter("lat", location.getLatitude(), params);
      appendParameter("long", location.getLongitude(), params);
    }
    appendParameter("place_id", placeId, params);
    if (!displayCoordinates) {
      appendParameter("display_coordinates", "false", params);
    }
    params.add(includeEntities);
    if (null != mediaFile) {
      Log.v("StatusUpdate", "null != mediaFile");
      params.add(new HttpParameter("media[]", mediaFile));
      params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
    } else if (mediaName != null && mediaBody != null) {
      Log.v("StatusUpdate", "mediaName != null && mediaBody != null");
      params.add(new HttpParameter("media[]", mediaName, mediaBody));
      params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
    }

    final HttpParameter[] paramArray = new HttpParameter[params.size()];
    for (HttpParameter param : params) {
      Log.v("StatusUpdate", "name " + param.getName());
      Log.v("StatusUpdate", "name " + param.getValue());
    }

    return params.toArray(paramArray);
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {

    GeoLocation aux = (GeoLocation) obj;

    return latitude == aux.getLatitude() && longitude == aux.getLongitude();
  }
コード例 #3
0
  private Tweet getTweetObjectFromStatus(Status status) {

    Tweet tweet = new Tweet();
    tweet.setId(Long.toString(status.getId()));
    tweet.setText(status.getText());
    tweet.setCreatedAt(status.getCreatedAt());

    tweet.setFavCount(status.getFavoriteCount());

    User user = status.getUser();

    tweet.setUserId(user.getId());
    tweet.setUserName(user.getName());
    tweet.setUserScreenName(user.getScreenName());

    HashtagEntity[] hashtagEntities = status.getHashtagEntities();
    List<String> hashtags = new ArrayList<String>();

    for (HashtagEntity hashtagEntity : hashtagEntities) {
      hashtags.add(hashtagEntity.getText());
    }

    tweet.setHashTags(hashtags.toArray(new String[hashtags.size()]));

    GeoLocation geoLocation = status.getGeoLocation();
    if (geoLocation != null) {
      double[] coordinates = {geoLocation.getLongitude(), geoLocation.getLatitude()};
      tweet.setCoordinates(coordinates);
    }

    return tweet;
  }
コード例 #4
0
 private static List<List<List<Double>>> getPlaceCoordinates(GeoLocation[][] geoLocations) {
   List<List<List<Double>>> listListListBoundingBox = new ArrayList<>();
   for (GeoLocation[] geoLocation1 : geoLocations) {
     List<List<Double>> listListBoundingBox = new ArrayList<>();
     for (GeoLocation geoLocation2 : geoLocation1) {
       List<Double> listBoundingBox = new ArrayList<>();
       listBoundingBox.add(geoLocation2.getLatitude());
       listBoundingBox.add(geoLocation2.getLongitude());
       listListBoundingBox.add(listBoundingBox);
     }
     listListListBoundingBox.add(listListBoundingBox);
   }
   return listListListBoundingBox;
 }
コード例 #5
0
 public void setNear(GeoLocation location) {
   put("near", location.getLatitude() + "," + location.getLongitude());
 }
コード例 #6
0
 public Double getLongitude() {
   return location.getLongitude();
 }