示例#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);
 }
示例#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);
  }
示例#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;
  }
示例#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 "";
    }
 public LocationInfoDao(GeoBean bean) {
   this.latlng[0] = bean.getLat();
   this.latlng[1] = bean.getLon();
 }