掌中通.apk(点击下载) / BDLocation.java


package com.baidu.location;

import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import com.baidu.location.Address;
import com.baidu.location.b.f;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

public final class BDLocation implements Parcelable, f {
    public static final String BDLOCATION_BD09LL_TO_GCJ02 = "bd09ll2gcj";
    public static final String BDLOCATION_BD09_TO_GCJ02 = "bd092gcj";
    public static final String BDLOCATION_GCJ02_TO_BD09 = "bd09";
    public static final String BDLOCATION_GCJ02_TO_BD09LL = "bd09ll";
    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
        /* class com.baidu.location.BDLocation.AnonymousClass1 */

        /* renamed from: a */
        public BDLocation createFromParcel(Parcel parcel) {
            return new BDLocation(parcel);
        }

        /* renamed from: a */
        public BDLocation[] newArray(int i) {
            return new BDLocation[i];
        }
    };
    public static final int LOCATION_WHERE_IN_CN = 1;
    public static final int LOCATION_WHERE_OUT_CN = 0;
    public static final int LOCATION_WHERE_UNKNOW = 2;
    public static final int OPERATORS_TYPE_MOBILE = 1;
    public static final int OPERATORS_TYPE_TELECOMU = 3;
    public static final int OPERATORS_TYPE_UNICOM = 2;
    public static final int OPERATORS_TYPE_UNKONW = 0;
    public static final int TypeCacheLocation = 65;
    public static final int TypeCriteriaException = 62;
    public static final int TypeGpsLocation = 61;
    public static final int TypeNetWorkException = 63;
    public static final int TypeNetWorkLocation = 161;
    public static final int TypeNone = 0;
    public static final int TypeOffLineLocation = 66;
    public static final int TypeOffLineLocationFail = 67;
    public static final int TypeOffLineLocationNetworkFail = 68;
    public static final int TypeServerError = 167;
    private String k0;
    private int k1;
    private double kA;
    private String kB;
    private boolean kC;
    private boolean kD;
    private boolean kE;
    private String kF;
    private String kG;
    private float kH;
    private String kI;
    private double kJ;
    private boolean kK;
    private Address kL;
    private boolean kM;
    private String kN;
    private String kO;
    private int kP;
    private int kQ;
    private float kR;
    private boolean kS;
    private List kT;
    private int kU;
    private double kV;
    private String kW;
    private boolean kX;
    private float kY;
    private String kZ;
    private String ky;
    private int kz;

    public BDLocation() {
        this.kU = 0;
        this.kZ = null;
        this.kA = Double.MIN_VALUE;
        this.kV = Double.MIN_VALUE;
        this.kC = false;
        this.kJ = Double.MIN_VALUE;
        this.kD = false;
        this.kY = 0.0f;
        this.kM = false;
        this.kR = 0.0f;
        this.kX = false;
        this.kz = -1;
        this.kH = -1.0f;
        this.k0 = null;
        this.kS = false;
        this.ky = null;
        this.kF = null;
        this.kI = null;
        this.kW = null;
        this.kK = false;
        this.kL = new Address.Builder().build();
        this.kB = null;
        this.kN = null;
        this.kE = false;
        this.kQ = 0;
        this.kP = 1;
        this.kO = null;
        this.kG = "";
        this.kT = null;
    }

    private BDLocation(Parcel parcel) {
        this.kU = 0;
        this.kZ = null;
        this.kA = Double.MIN_VALUE;
        this.kV = Double.MIN_VALUE;
        this.kC = false;
        this.kJ = Double.MIN_VALUE;
        this.kD = false;
        this.kY = 0.0f;
        this.kM = false;
        this.kR = 0.0f;
        this.kX = false;
        this.kz = -1;
        this.kH = -1.0f;
        this.k0 = null;
        this.kS = false;
        this.ky = null;
        this.kF = null;
        this.kI = null;
        this.kW = null;
        this.kK = false;
        this.kL = new Address.Builder().build();
        this.kB = null;
        this.kN = null;
        this.kE = false;
        this.kQ = 0;
        this.kP = 1;
        this.kO = null;
        this.kG = "";
        this.kT = null;
        this.kU = parcel.readInt();
        this.kZ = parcel.readString();
        this.kA = parcel.readDouble();
        this.kV = parcel.readDouble();
        this.kJ = parcel.readDouble();
        this.kY = parcel.readFloat();
        this.kR = parcel.readFloat();
        this.kz = parcel.readInt();
        this.kH = parcel.readFloat();
        this.kB = parcel.readString();
        this.kQ = parcel.readInt();
        this.kN = parcel.readString();
        this.kO = parcel.readString();
        String readString = parcel.readString();
        String readString2 = parcel.readString();
        String readString3 = parcel.readString();
        String readString4 = parcel.readString();
        String readString5 = parcel.readString();
        String readString6 = parcel.readString();
        parcel.readString();
        String readString7 = parcel.readString();
        this.kL = new Address.Builder().country(readString7).countryCode(parcel.readString()).province(readString).city(readString2).cityCode(readString6).district(readString3).street(readString4).streetNumber(readString5).build();
        boolean[] zArr = new boolean[7];
        this.k1 = parcel.readInt();
        this.kG = parcel.readString();
        this.kF = parcel.readString();
        this.kI = parcel.readString();
        this.kW = parcel.readString();
        this.kP = parcel.readInt();
        try {
            parcel.readBooleanArray(zArr);
            this.kC = zArr[0];
            this.kD = zArr[1];
            this.kM = zArr[2];
            this.kX = zArr[3];
            this.kS = zArr[4];
            this.kK = zArr[5];
            this.kE = zArr[6];
        } catch (Exception e2) {
        }
        ArrayList arrayList = new ArrayList();
        parcel.readList(arrayList, Poi.class.getClassLoader());
        if (arrayList.size() == 0) {
            this.kT = null;
        } else {
            this.kT = arrayList;
        }
    }

    public BDLocation(BDLocation bDLocation) {
        this.kU = 0;
        this.kZ = null;
        this.kA = Double.MIN_VALUE;
        this.kV = Double.MIN_VALUE;
        this.kC = false;
        this.kJ = Double.MIN_VALUE;
        this.kD = false;
        this.kY = 0.0f;
        this.kM = false;
        this.kR = 0.0f;
        this.kX = false;
        this.kz = -1;
        this.kH = -1.0f;
        this.k0 = null;
        this.kS = false;
        this.ky = null;
        this.kF = null;
        this.kI = null;
        this.kW = null;
        this.kK = false;
        this.kL = new Address.Builder().build();
        this.kB = null;
        this.kN = null;
        this.kE = false;
        this.kQ = 0;
        this.kP = 1;
        this.kO = null;
        this.kG = "";
        this.kT = null;
        this.kU = bDLocation.kU;
        this.kZ = bDLocation.kZ;
        this.kA = bDLocation.kA;
        this.kV = bDLocation.kV;
        this.kC = bDLocation.kC;
        this.kJ = bDLocation.kJ;
        this.kD = bDLocation.kD;
        this.kY = bDLocation.kY;
        this.kM = bDLocation.kM;
        this.kR = bDLocation.kR;
        this.kX = bDLocation.kX;
        this.kz = bDLocation.kz;
        this.kH = bDLocation.kH;
        this.k0 = bDLocation.k0;
        this.kS = bDLocation.kS;
        this.ky = bDLocation.ky;
        this.kK = bDLocation.kK;
        this.kL = new Address.Builder().country(bDLocation.kL.country).countryCode(bDLocation.kL.countryCode).province(bDLocation.kL.province).city(bDLocation.kL.city).cityCode(bDLocation.kL.cityCode).district(bDLocation.kL.district).street(bDLocation.kL.street).streetNumber(bDLocation.kL.streetNumber).build();
        this.kB = bDLocation.kB;
        this.kN = bDLocation.kN;
        this.kP = bDLocation.kP;
        this.kQ = bDLocation.kQ;
        this.kE = bDLocation.kE;
        this.kO = bDLocation.kO;
        this.k1 = bDLocation.k1;
        this.kG = bDLocation.kG;
        this.kF = bDLocation.kF;
        this.kI = bDLocation.kI;
        this.kW = bDLocation.kW;
        if (bDLocation.kT == null) {
            this.kT = null;
            return;
        }
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < bDLocation.kT.size(); i++) {
            Poi poi = (Poi) bDLocation.kT.get(i);
            arrayList.add(new Poi(poi.getId(), poi.getName(), poi.getRank()));
        }
        this.kT = arrayList;
    }

    public BDLocation(String str) {
        String str2 = null;
        this.kU = 0;
        this.kZ = null;
        this.kA = Double.MIN_VALUE;
        this.kV = Double.MIN_VALUE;
        this.kC = false;
        this.kJ = Double.MIN_VALUE;
        this.kD = false;
        this.kY = 0.0f;
        this.kM = false;
        this.kR = 0.0f;
        this.kX = false;
        this.kz = -1;
        this.kH = -1.0f;
        this.k0 = null;
        this.kS = false;
        this.ky = null;
        this.kF = null;
        this.kI = null;
        this.kW = null;
        this.kK = false;
        this.kL = new Address.Builder().build();
        this.kB = null;
        this.kN = null;
        this.kE = false;
        this.kQ = 0;
        this.kP = 1;
        this.kO = null;
        this.kG = "";
        this.kT = null;
        if (str != null && !str.equals("")) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                JSONObject jSONObject2 = jSONObject.getJSONObject("result");
                int parseInt = Integer.parseInt(jSONObject2.getString("error"));
                setLocType(parseInt);
                setTime(jSONObject2.getString("time"));
                if (parseInt == 61) {
                    JSONObject jSONObject3 = jSONObject.getJSONObject("content");
                    JSONObject jSONObject4 = jSONObject3.getJSONObject("point");
                    setLatitude(Double.parseDouble(jSONObject4.getString("y")));
                    setLongitude(Double.parseDouble(jSONObject4.getString("x")));
                    setRadius(Float.parseFloat(jSONObject3.getString("radius")));
                    setSpeed(Float.parseFloat(jSONObject3.getString("s")));
                    setDirection(Float.parseFloat(jSONObject3.getString("d")));
                    setSatelliteNumber(Integer.parseInt(jSONObject3.getString("n")));
                    if (jSONObject3.has("h")) {
                        try {
                            setAltitude(jSONObject3.getDouble("h"));
                        } catch (Exception e2) {
                        }
                    }
                    try {
                        if (jSONObject3.has("in_cn")) {
                            setLocationWhere(Integer.parseInt(jSONObject3.getString("in_cn")));
                        } else {
                            setLocationWhere(1);
                        }
                    } catch (Exception e3) {
                    }
                    if (this.kP == 0) {
                        setCoorType("wgs84");
                    } else {
                        setCoorType("gcj02");
                    }
                } else if (parseInt == 161) {
                    JSONObject jSONObject5 = jSONObject.getJSONObject("content");
                    JSONObject jSONObject6 = jSONObject5.getJSONObject("point");
                    setLatitude(Double.parseDouble(jSONObject6.getString("y")));
                    setLongitude(Double.parseDouble(jSONObject6.getString("x")));
                    setRadius(Float.parseFloat(jSONObject5.getString("radius")));
                    if (jSONObject5.has("sema")) {
                        JSONObject jSONObject7 = jSONObject5.getJSONObject("sema");
                        if (jSONObject7.has("aptag")) {
                            String string = jSONObject7.getString("aptag");
                            if (!TextUtils.isEmpty(string)) {
                                this.kF = string;
                            } else {
                                this.kF = "";
                            }
                        }
                        if (jSONObject7.has("aptagd")) {
                            JSONArray jSONArray = jSONObject7.getJSONObject("aptagd").getJSONArray("pois");
                            ArrayList arrayList = new ArrayList();
                            for (int i = 0; i < jSONArray.length(); i++) {
                                JSONObject jSONObject8 = jSONArray.getJSONObject(i);
                                arrayList.add(new Poi(jSONObject8.getString("pid"), jSONObject8.getString("pname"), jSONObject8.getDouble("pr")));
                            }
                            this.kT = arrayList;
                        }
                        if (jSONObject7.has("poiregion")) {
                            String string2 = jSONObject7.getString("poiregion");
                            if (!TextUtils.isEmpty(string2)) {
                                this.kI = string2;
                            }
                        }
                        if (jSONObject7.has("regular")) {
                            String string3 = jSONObject7.getString("regular");
                            if (!TextUtils.isEmpty(string3)) {
                                this.kW = string3;
                            }
                        }
                    }
                    if (jSONObject5.has("addr")) {
                        String[] split = jSONObject5.getString("addr").split(",");
                        int length = split.length;
                        String str3 = length > 0 ? split[0] : null;
                        String str4 = length > 1 ? split[1] : null;
                        String str5 = length > 2 ? split[2] : null;
                        this.kL = new Address.Builder().country(length > 6 ? split[6] : null).countryCode(length > 7 ? split[7] : str2).province(str3).city(str4).cityCode(length > 5 ? split[5] : null).district(str5).street(length > 3 ? split[3] : null).streetNumber(length > 4 ? split[4] : null).build();
                        this.kS = true;
                    } else {
                        this.kS = false;
                        setAddrStr(null);
                    }
                    if (jSONObject5.has("floor")) {
                        this.kB = jSONObject5.getString("floor");
                        if (TextUtils.isEmpty(this.kB)) {
                            this.kB = null;
                        }
                    }
                    if (jSONObject5.has("loctp")) {
                        this.kO = jSONObject5.getString("loctp");
                        if (TextUtils.isEmpty(this.kO)) {
                            this.kO = null;
                        }
                    }
                    if (jSONObject5.has("bldgid")) {
                        this.kN = jSONObject5.getString("bldgid");
                        if (TextUtils.isEmpty(this.kN)) {
                            this.kN = null;
                        }
                    }
                    if (jSONObject5.has("ibav")) {
                        String string4 = jSONObject5.getString("ibav");
                        if (TextUtils.isEmpty(string4)) {
                            this.kQ = 0;
                        } else if (string4.equals("0")) {
                            this.kQ = 0;
                        } else {
                            this.kQ = Integer.valueOf(string4).intValue();
                        }
                    }
                    try {
                        if (jSONObject5.has("in_cn")) {
                            setLocationWhere(Integer.parseInt(jSONObject5.getString("in_cn")));
                        } else {
                            setLocationWhere(1);
                        }
                    } catch (Exception e4) {
                    }
                    if (this.kP == 0) {
                        setCoorType("wgs84");
                    } else {
                        setCoorType("gcj02");
                    }
                } else if (parseInt == 66 || parseInt == 68) {
                    JSONObject jSONObject9 = jSONObject.getJSONObject("content");
                    JSONObject jSONObject10 = jSONObject9.getJSONObject("point");
                    setLatitude(Double.parseDouble(jSONObject10.getString("y")));
                    setLongitude(Double.parseDouble(jSONObject10.getString("x")));
                    setRadius(Float.parseFloat(jSONObject9.getString("radius")));
                    m8if(Boolean.valueOf(Boolean.parseBoolean(jSONObject9.getString("isCellChanged"))));
                    setCoorType("gcj02");
                } else if (parseInt == 167) {
                    setLocationWhere(2);
                }
            } catch (Exception e5) {
                e5.printStackTrace();
                this.kU = 0;
                this.kS = false;
            }
        }
    }

    private String dA() {
        return this.kI;
    }

    private String dB() {
        return this.kG;
    }

    private String dC() {
        return this.kW;
    }

    private static String dD() {
        return Build.MODEL;
    }

    /* renamed from: if  reason: not valid java name */
    private void m8if(Boolean bool) {
        this.kK = bool.booleanValue();
    }

    public int describeContents() {
        return 0;
    }

    public String getAdUrl(String str) {
        String valueOf = String.valueOf(this.kA);
        String valueOf2 = String.valueOf(this.kV);
        String dB = dB();
        return "http://lba.baidu.com/" + "?a=" + Jni.E("ak=" + str + "&" + "lat=" + valueOf + "&" + "lng=" + valueOf2 + "&" + "cu=" + dB + "&" + "mb=" + dD());
    }

    public String getAddrStr() {
        return this.kL.address;
    }

    public Address getAddress() {
        return this.kL;
    }

    public double getAltitude() {
        return this.kJ;
    }

    public String getBuildingID() {
        return this.kN;
    }

    public String getCity() {
        return this.kL.city;
    }

    public String getCityCode() {
        return this.kL.cityCode;
    }

    public String getCoorType() {
        return this.k0;
    }

    public String getCountry() {
        return this.kL.country;
    }

    public String getCountryCode() {
        return this.kL.countryCode;
    }

    public float getDerect() {
        return this.kH;
    }

    public float getDirection() {
        return this.kH;
    }

    public String getDistrict() {
        return this.kL.district;
    }

    public String getFloor() {
        return this.kB;
    }

    public double getLatitude() {
        return this.kA;
    }

    public int getLocType() {
        return this.kU;
    }

    public String getLocationDescribe() {
        return this.kF;
    }

    public int getLocationWhere() {
        return this.kP;
    }

    public double getLongitude() {
        return this.kV;
    }

    public String getNetworkLocationType() {
        return this.kO;
    }

    public int getOperators() {
        return this.k1;
    }

    public List getPoiList() {
        return this.kT;
    }

    public String getProvince() {
        return this.kL.province;
    }

    public float getRadius() {
        return this.kR;
    }

    public int getSatelliteNumber() {
        this.kX = true;
        return this.kz;
    }

    public String getSemaAptag() {
        return this.kF;
    }

    public float getSpeed() {
        return this.kY;
    }

    public String getStreet() {
        return this.kL.street;
    }

    public String getStreetNumber() {
        return this.kL.streetNumber;
    }

    public String getTime() {
        return this.kZ;
    }

    public boolean hasAddr() {
        return this.kS;
    }

    public boolean hasAltitude() {
        return this.kC;
    }

    public boolean hasRadius() {
        return this.kM;
    }

    public boolean hasSateNumber() {
        return this.kX;
    }

    public boolean hasSpeed() {
        return this.kD;
    }

    public void internalSet(int i, String str) {
        if (str != null && i == 0) {
            this.kG = str;
        }
    }

    public boolean isCellChangeFlag() {
        return this.kK;
    }

    public boolean isIndoorLocMode() {
        return this.kE;
    }

    public int isParkAvailable() {
        return this.kQ;
    }

    public void setAddr(Address address) {
        if (address != null) {
            this.kL = address;
            this.kS = true;
        }
    }

    public void setAddrStr(String str) {
        this.ky = str;
        if (str == null) {
            this.kS = false;
        } else {
            this.kS = true;
        }
    }

    public void setAltitude(double d2) {
        this.kJ = d2;
        this.kC = true;
    }

    public void setBuildingID(String str) {
        this.kN = str;
    }

    public void setCoorType(String str) {
        this.k0 = str;
    }

    public void setDirection(float f) {
        this.kH = f;
    }

    public void setFloor(String str) {
        this.kB = str;
    }

    public void setIndoorLocMode(boolean z) {
        this.kE = z;
    }

    public void setLatitude(double d2) {
        this.kA = d2;
    }

    public void setLocType(int i) {
        this.kU = i;
    }

    public void setLocationDescribe(String str) {
        this.kF = str;
    }

    public void setLocationWhere(int i) {
        this.kP = i;
    }

    public void setLongitude(double d2) {
        this.kV = d2;
    }

    public void setNetworkLocationType(String str) {
        this.kO = str;
    }

    public void setOperators(int i) {
        this.k1 = i;
    }

    public void setParkAvailable(int i) {
        this.kQ = i;
    }

    public void setPoiList(List list) {
        this.kT = list;
    }

    public void setRadius(float f) {
        this.kR = f;
        this.kM = true;
    }

    public void setSatelliteNumber(int i) {
        this.kz = i;
    }

    public void setSpeed(float f) {
        this.kY = f;
        this.kD = true;
    }

    public void setTime(String str) {
        this.kZ = str;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.kU);
        parcel.writeString(this.kZ);
        parcel.writeDouble(this.kA);
        parcel.writeDouble(this.kV);
        parcel.writeDouble(this.kJ);
        parcel.writeFloat(this.kY);
        parcel.writeFloat(this.kR);
        parcel.writeInt(this.kz);
        parcel.writeFloat(this.kH);
        parcel.writeString(this.kB);
        parcel.writeInt(this.kQ);
        parcel.writeString(this.kN);
        parcel.writeString(this.kO);
        parcel.writeString(this.kL.province);
        parcel.writeString(this.kL.city);
        parcel.writeString(this.kL.district);
        parcel.writeString(this.kL.street);
        parcel.writeString(this.kL.streetNumber);
        parcel.writeString(this.kL.cityCode);
        parcel.writeString(this.kL.address);
        parcel.writeString(this.kL.country);
        parcel.writeString(this.kL.countryCode);
        parcel.writeInt(this.k1);
        parcel.writeString(this.kG);
        parcel.writeString(this.kF);
        parcel.writeString(this.kI);
        parcel.writeString(this.kW);
        parcel.writeInt(this.kP);
        parcel.writeBooleanArray(new boolean[]{this.kC, this.kD, this.kM, this.kX, this.kS, this.kK, this.kE});
        parcel.writeList(this.kT);
    }
}