GetNearestZoneRequest.java 1.57 KB
package com.arellomobile.android.push.request;

import android.content.Context;
import android.location.Location;
import com.arellomobile.android.push.data.PushZoneLocation;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class GetNearestZoneRequest
  extends PushRequest
{
  private Location b;
  private PushZoneLocation c;
  
  public GetNearestZoneRequest(Location paramLocation)
  {
    this.b = paramLocation;
  }
  
  protected void buildParams(Context paramContext, Map<String, Object> paramMap)
  {
    paramMap.put("lat", Double.valueOf(this.b.getLatitude()));
    paramMap.put("lng", Double.valueOf(this.b.getLongitude()));
  }
  
  public String getMethod()
  {
    return "getNearestZone";
  }
  
  public PushZoneLocation getNearestLocation()
  {
    return this.c;
  }
  
  public void parseResponse(JSONObject paramJSONObject)
    throws JSONException
  {
    try
    {
      paramJSONObject = paramJSONObject.getJSONObject("response");
      this.c = new PushZoneLocation();
      this.c.setName(paramJSONObject.getString("name"));
      this.c.setLat(paramJSONObject.getDouble("lat"));
      this.c.setLng(paramJSONObject.getDouble("lng"));
      this.c.setDistanceTo(paramJSONObject.getLong("distance"));
      return;
    }
    catch (JSONException paramJSONObject)
    {
      this.c = null;
      throw paramJSONObject;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/request/GetNearestZoneRequest.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */