<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/baidu_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ulz_white_selector"
android:text="百度地图"/>
<include layout="@layout/common_line_view"/>
<Button
android:id="@+id/gaode_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ulz_white_selector"
android:text="高德地图"/>
<include layout="@layout/common_line_view"/>
<Button
android:id="@+id/tencent_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ulz_white_selector"
android:text="腾讯地图"/>
<include layout="@layout/common_line_view"/>
<Button
android:id="@+id/cancel_btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ulz_white_selector"
android:text="取消"/>
</LinearLayout>
mapSheetView = LayoutInflater.from(this).inflate(R.layout.map_navagation_sheet, null);
mBottomSheetPop = new BottomSheetPop(this);
mBottomSheetPop.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mBottomSheetPop.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mBottomSheetPop.setContentView(mapSheetView);
mBottomSheetPop.setBackgroundDrawable(new ColorDrawable(0x00000000));
mBottomSheetPop.setOutsideTouchable(true);
mBottomSheetPop.setFocusable(true);
mBottomSheetPop.showAtLocation(this.getWindow().getDecorView(), Gravity.BOTTOM, 0, 0);
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.navigation_btn:
mBottomSheetPop = new BottomSheetPop(this);
mBottomSheetPop.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mBottomSheetPop.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mBottomSheetPop.setContentView(mapSheetView);
mBottomSheetPop.setBackgroundDrawable(new ColorDrawable(0x00000000));
mBottomSheetPop.setOutsideTouchable(true);
mBottomSheetPop.setFocusable(true);
mBottomSheetPop.showAtLocation(this.getWindow().getDecorView(), Gravity.BOTTOM, 0, 0);
break;
case R.id.cancel_btn2:
if (mBottomSheetPop != null) {
mBottomSheetPop.dismiss();
}
break;
case R.id.baidu_btn:
if (isAvilible(this, "com.baidu.BaiduMap")) {//传入指定应用包名
try {
Intent intent = Intent.getIntent("intent://map/direction?" +
"destination=latlng:" + mInfo.getLat() + "," + mInfo.getLng() + "|name:我的目的地" + //终点
"&mode=driving&" + //导航路线方式
"&src=appname#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
startActivity(intent); //启动调用
} catch (URISyntaxException e) {
Log.e("intent", e.getMessage());
}
} else {//未安装
//market为路径,id为包名
//显示手机上所有的market商店
Toast.makeText(this, "您尚未安装百度地图", Toast.LENGTH_LONG).show();
Uri uri = Uri.parse("market://details?id=com.baidu.BaiduMap");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (intent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
}
mBottomSheetPop.dismiss();
break;
case R.id.gaode_btn:
if (isAvilible(this, "com.autonavi.minimap")) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
//将功能Scheme以URI的方式传入data
Uri uri = Uri.parse("androidamap://navi?sourceApplication=appname&poiname=fangheng&lat=" + mInfo.getLat() + "&lon=" + mInfo.getLng() + "&dev=1&style=2");
intent.setData(uri);
//启动该页面即可
startActivity(intent);
} else {
Toast.makeText(this, "您尚未安装高德地图", Toast.LENGTH_LONG).show();
Uri uri = Uri.parse("market://details?id=com.autonavi.minimap");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (intent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
}
mBottomSheetPop.dismiss();
break;
case R.id.tencent_btn:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
//将功能Scheme以URI的方式传入data
Uri uri = Uri.parse("qqmap://map/routeplan?type=drive&to=我的目的地&tocoord=" + mInfo.getLat() + "," + mInfo.getLng());
intent.setData(uri);
if (intent.resolveActivity(getPackageManager()) != null) {
//启动该页面即可
startActivity(intent);
} else {
Toast.makeText(this, "您尚未安装腾讯地图", Toast.LENGTH_LONG).show();
}
mBottomSheetPop.dismiss();
break;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有