Exemplo n.º 1
0
 private void updateWithNewLocation(Location result) {
   haveGPS.setVisibility(View.VISIBLE);
   geoBean = new GeoBean();
   geoBean.setLatitude(result.getLatitude());
   geoBean.setLongitude(result.getLongitude());
   new GetGoogleLocationInfo(geoBean).execute();
   ((LocationManager) WriteWeiboActivity.this.getSystemService(Context.LOCATION_SERVICE))
       .removeUpdates(locationListener);
 }
Exemplo n.º 2
0
  private boolean sendNewMsgWithPic(String str, FileUploaderHttpHelper.ProgressListener listener)
      throws WeiboException {
    String url = URLHelper.STATUSES_UPLOAD;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("status", str);
    if (geoBean != null) {
      map.put("lat", String.valueOf(geoBean.getLat()));
      map.put("long", String.valueOf(geoBean.getLon()));
    }

    return HttpUtility.getInstance().executeUploadTask(url, map, pic, listener);
  }
Exemplo n.º 3
0
  public boolean sendNewMsg(String str, FileUploaderHttpHelper.ProgressListener listener)
      throws WeiboException {

    if (!TextUtils.isEmpty(pic)) {
      return sendNewMsgWithPic(str, listener);
    }
    String url = URLHelper.STATUSES_UPDATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("status", str);
    if (geoBean != null) {
      map.put("lat", String.valueOf(geoBean.getLat()));
      map.put("long", String.valueOf(geoBean.getLon()));
    }

    HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    return true;
  }
Exemplo n.º 4
0
    @Override
    protected String doInBackground(Void... params) {

      Geocoder geocoder = new Geocoder(WriteWeiboActivity.this, Locale.getDefault());

      List<Address> addresses = null;
      try {
        addresses = geocoder.getFromLocation(geoBean.getLat(), geoBean.getLon(), 1);
      } catch (IOException e) {
        cancel(true);
      }
      if (addresses != null && addresses.size() > 0) {
        Address address = addresses.get(0);

        StringBuilder builder = new StringBuilder();
        int size = address.getMaxAddressLineIndex();
        for (int i = 0; i < size; i++) {
          builder.append(address.getAddressLine(i));
        }
        return builder.toString();
      }

      return "";
    }
Exemplo n.º 5
0
 public LocationInfoDao(GeoBean bean) {
   this.latlng[0] = bean.getLat();
   this.latlng[1] = bean.getLon();
 }