小红书.apk(点击下载) / BaiduMapPoiSearch.java


package com.baidu.mapapi.utils.poi;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.OpenClientUtil;
import com.baidu.mapapi.utils.b;
import com.baidu.mapapi.utils.route.BaiduMapRoutePlan;
import com.baidu.mapsdkplatform.comapi.util.CoordTrans;
import com.baidu.platform.comapi.pano.a;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.tencent.wcdb.database.SQLiteDatabase;
import java.util.List;

public class BaiduMapPoiSearch {

    /* renamed from: a */
    private static boolean f20137a;

    private static void a(PoiParaOption poiParaOption, Context context) {
        Uri parse = Uri.parse("http://api.map.baidu.com/place/detail?" + "uid=" + poiParaOption.f20139a + "&output=html" + "&src=" + context.getPackageName());
        Intent intent = new Intent();
        intent.setAction(CommonConstant.ACTION.HWID_SCHEME_URL);
        intent.setFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
        intent.setData(parse);
        context.startActivity(intent);
    }

    private static void b(PoiParaOption poiParaOption, Context context) {
        StringBuilder sb3 = new StringBuilder();
        sb3.append("http://api.map.baidu.com/place/search?");
        sb3.append("query=");
        sb3.append(poiParaOption.f20140b);
        sb3.append("&location=");
        LatLng latLng = poiParaOption.f20141c;
        if (SDKInitializer.getCoordType() == CoordType.GCJ02) {
            latLng = CoordTrans.gcjToBaidu(latLng);
        }
        sb3.append(latLng.latitude);
        sb3.append(",");
        sb3.append(latLng.longitude);
        sb3.append("&radius=");
        sb3.append(poiParaOption.f20142d);
        sb3.append("&output=html");
        sb3.append("&src=");
        sb3.append(context.getPackageName());
        Uri parse = Uri.parse(sb3.toString());
        Intent intent = new Intent();
        intent.setAction(CommonConstant.ACTION.HWID_SCHEME_URL);
        intent.setFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
        intent.setData(parse);
        context.startActivity(intent);
    }

    public static void b(String str, Context context) {
        if (str == null || str.length() == 0) {
            throw new RuntimeException("BDMapSDKException: pano id can not be null.");
        } else if (context != null) {
            StringBuilder sb3 = new StringBuilder();
            sb3.append("baidumap://map/streetscape?");
            sb3.append("panoid=");
            sb3.append(str);
            sb3.append("&pid=");
            sb3.append(str);
            sb3.append("&panotype=");
            sb3.append("street");
            sb3.append("&src=");
            sb3.append("sdk_[" + context.getPackageName() + "]");
            Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(sb3.toString()));
            intent.setFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
            if (intent.resolveActivity(context.getPackageManager()) != null) {
                context.startActivity(intent);
                return;
            }
            throw new RuntimeException("BDMapSDKException: BaiduMap app is not installed.");
        } else {
            throw new RuntimeException("BDMapSDKException: context cannot be null.");
        }
    }

    public static boolean dispatchPoiToBaiduMap(List<DispathcPoiData> list, Context context) {
        String str;
        if (list.isEmpty() || list.size() <= 0) {
            throw new NullPointerException("BDMapSDKException: dispatch poidata is null");
        }
        int baiduMapVersion = OpenClientUtil.getBaiduMapVersion(context);
        if (baiduMapVersion == 0) {
            str = "BaiduMap app is not installed.";
        } else if (baiduMapVersion >= 840) {
            return b.a(list, context, 6);
        } else {
            str = "Baidumap app version is too lowl.Version is greater than 8.4";
        }
        Log.e("baidumapsdk", str);
        return false;
    }

    public static void finish(Context context) {
        if (context != null) {
            b.a(context);
        }
    }

    public static void openBaiduMapPanoShow(String str, Context context) {
        new a().a(str, new a(context));
    }

    public static boolean openBaiduMapPoiDetialsPage(PoiParaOption poiParaOption, Context context) {
        if (poiParaOption == null || context == null) {
            throw new IllegalPoiSearchArgumentException("BDMapSDKException: para or context can not be null.");
        }
        String str = poiParaOption.f20139a;
        if (str == null) {
            throw new IllegalPoiSearchArgumentException("BDMapSDKException: poi uid can not be null.");
        } else if (str.equals("")) {
            Log.e(BaiduMapRoutePlan.class.getName(), "poi uid can not be empty string");
            return false;
        } else {
            int baiduMapVersion = OpenClientUtil.getBaiduMapVersion(context);
            if (baiduMapVersion == 0) {
                Log.e("baidumapsdk", "BaiduMap app is not installed.");
                if (f20137a) {
                    a(poiParaOption, context);
                    return true;
                }
                throw new IllegalPoiSearchArgumentException("BDMapSDKException: BaiduMap app is not installed.");
            } else if (baiduMapVersion >= 810) {
                return b.a(poiParaOption, context, 3);
            } else {
                Log.e("baidumapsdk", "Baidumap app version is too lowl.Version is greater than 8.1");
                if (f20137a) {
                    a(poiParaOption, context);
                    return true;
                }
                throw new IllegalPoiSearchArgumentException("BDMapSDKException: Baidumap app version is too lowl.Version is greater than 8.1");
            }
        }
    }

    public static boolean openBaiduMapPoiNearbySearch(PoiParaOption poiParaOption, Context context) {
        if (poiParaOption == null || context == null) {
            throw new IllegalPoiSearchArgumentException("BDMapSDKException: para or context can not be null.");
        }
        String str = poiParaOption.f20140b;
        if (str != null) {
            LatLng latLng = poiParaOption.f20141c;
            if (latLng == null) {
                throw new IllegalPoiSearchArgumentException("BDMapSDKException: poi search center can not be null.");
            } else if (latLng.longitude == 0.0d || latLng.latitude == 0.0d) {
                throw new IllegalPoiSearchArgumentException("BDMapSDKException: poi search center longitude or latitude can not be 0.");
            } else if (poiParaOption.f20142d == 0) {
                throw new IllegalPoiSearchArgumentException("BDMapSDKException: poi search radius larger than 0.");
            } else if (str.equals("")) {
                Log.e(BaiduMapRoutePlan.class.getName(), "poi key can not be empty string");
                return false;
            } else {
                int baiduMapVersion = OpenClientUtil.getBaiduMapVersion(context);
                if (baiduMapVersion == 0) {
                    Log.e("baidumapsdk", "BaiduMap app is not installed.");
                    if (f20137a) {
                        b(poiParaOption, context);
                        return true;
                    }
                    throw new IllegalPoiSearchArgumentException("BDMapSDKException: BaiduMap app is not installed.");
                } else if (baiduMapVersion >= 810) {
                    return b.a(poiParaOption, context, 4);
                } else {
                    Log.e("baidumapsdk", "Baidumap app version is too lowl.Version is greater than 8.1");
                    if (f20137a) {
                        b(poiParaOption, context);
                        return true;
                    }
                    throw new IllegalPoiSearchArgumentException("BDMapSDKException: Baidumap app version is too lowl.Version is greater than 8.1");
                }
            }
        } else {
            throw new IllegalPoiSearchArgumentException("BDMapSDKException: poi search key can not be null.");
        }
    }

    public static void setSupportWebPoi(boolean z14) {
        f20137a = z14;
    }
}