导航功能开始
This commit is contained in:
@@ -121,6 +121,10 @@ dependencies {
|
|||||||
implementation 'com.tencent.map:tencent-map-vector-sdk:4.4.2'
|
implementation 'com.tencent.map:tencent-map-vector-sdk:4.4.2'
|
||||||
// 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
|
// 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
|
||||||
implementation 'com.tencent.map:sdk-utilities:1.0.6'
|
implementation 'com.tencent.map:sdk-utilities:1.0.6'
|
||||||
|
// 导航库
|
||||||
|
implementation 'com.tencent.map:tencent-map-nav-sdk:5.3.8.3'
|
||||||
|
// 导航依赖库
|
||||||
|
implementation 'com.tencent.map:tencent-map-nav-surport:1.1.0.1'
|
||||||
|
|
||||||
//腾讯地图 定位
|
//腾讯地图 定位
|
||||||
implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.6'
|
implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.6'
|
||||||
|
|||||||
@@ -68,9 +68,12 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.webkit.WebView.EnableSafeBrowsing"
|
android:name="android.webkit.WebView.EnableSafeBrowsing"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
<!-- <meta-data-->
|
||||||
|
<!-- android:name="TencentMapSDK"-->
|
||||||
|
<!-- android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />-->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="TencentMapSDK"
|
android:name="TencentMapSDK"
|
||||||
android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
android:value="7UEBZ-TWAYK-5JFJM-A5SJI-FA4U6-3IBMX" />
|
||||||
<!-- 今日头屏幕适配 -->
|
<!-- 今日头屏幕适配 -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_width_in_dp"
|
android:name="design_width_in_dp"
|
||||||
|
|||||||
@@ -267,4 +267,11 @@ public class Constant {
|
|||||||
FILE_PATH = null;//银行卡图片途径
|
FILE_PATH = null;//银行卡图片途径
|
||||||
LEVEL = 0;//用户等级
|
LEVEL = 0;//用户等级
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导航方式
|
||||||
|
enum NAV_TYPE {
|
||||||
|
CAR, RIDE, WALK
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NAV_TYPE currentNaviType; // 当前的导航方式
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import com.navinfo.outdoor.activity.WebActivity;
|
|||||||
import com.navinfo.outdoor.bean.NotificationBean;
|
import com.navinfo.outdoor.bean.NotificationBean;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.util.TalentLocationUtils;
|
import com.navinfo.outdoor.util.TalentLocationUtils;
|
||||||
|
import com.tencent.map.navi.TencentNavi;
|
||||||
|
import com.tencent.navi.surport.utils.DeviceUtils;
|
||||||
import com.umeng.commonsdk.UMConfigure;
|
import com.umeng.commonsdk.UMConfigure;
|
||||||
import com.umeng.message.IUmengRegisterCallback;
|
import com.umeng.message.IUmengRegisterCallback;
|
||||||
import com.umeng.message.MsgConstant;
|
import com.umeng.message.MsgConstant;
|
||||||
@@ -59,6 +61,13 @@ public class UserApplication extends Application {
|
|||||||
TalentLocationUtils.getInstance(this).startLocation(this);
|
TalentLocationUtils.getInstance(this).startLocation(this);
|
||||||
//创建一个线程池
|
//创建一个线程池
|
||||||
fixedThreadPool = Executors.newSingleThreadExecutor(); // 使用单线程线程池
|
fixedThreadPool = Executors.newSingleThreadExecutor(); // 使用单线程线程池
|
||||||
|
// 初始化腾讯导航
|
||||||
|
TencentNavi.Config config = new TencentNavi.Config();
|
||||||
|
// 记录设备标识,反馈导航问题时请提供该设备标识以及发生问题的时间
|
||||||
|
String deviceID = DeviceUtils.getImei(getApplicationContext());
|
||||||
|
config.setDeviceId(deviceID);
|
||||||
|
// 或者设置开发者自己的的设备号config.setDeviceId(xxxxxxxx);
|
||||||
|
TencentNavi.init(this, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserApplication getUserApplication() {
|
public static UserApplication getUserApplication() {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
|||||||
import com.navinfo.outdoor.util.TimestampUtil;
|
import com.navinfo.outdoor.util.TimestampUtil;
|
||||||
import com.navinfo.outdoor.util.ToastUtils;
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
import com.tencent.lbssearch.httpresponse.Poi;
|
import com.tencent.lbssearch.httpresponse.Poi;
|
||||||
|
import com.tencent.map.navi.car.TencentCarNaviManager;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
private PoiEntity poiEntity;
|
private PoiEntity poiEntity;
|
||||||
private File logFile;
|
private File logFile;
|
||||||
private StringBuilder gatherGetBuilder;
|
private StringBuilder gatherGetBuilder;
|
||||||
|
private TextView tvStartNav;
|
||||||
|
|
||||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||||
GatherGetFragment fragment = new GatherGetFragment();
|
GatherGetFragment fragment = new GatherGetFragment();
|
||||||
@@ -144,6 +146,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
TextView tvTime = findViewById(R.id.tv_time);
|
TextView tvTime = findViewById(R.id.tv_time);
|
||||||
TextView tvDistance = findViewById(R.id.tv_distance);
|
TextView tvDistance = findViewById(R.id.tv_distance);
|
||||||
TextView tvDescribe = findViewById(R.id.tv_describe);
|
TextView tvDescribe = findViewById(R.id.tv_describe);
|
||||||
|
tvStartNav = findViewById(R.id.tv_gather_start_navi);
|
||||||
Button btnDelete = findViewById(R.id.btn_delete);
|
Button btnDelete = findViewById(R.id.btn_delete);
|
||||||
btnDelete.setOnClickListener(this);
|
btnDelete.setOnClickListener(this);
|
||||||
btnCancelGet = findViewById(R.id.btn_cancel_get);//取消领取
|
btnCancelGet = findViewById(R.id.btn_cancel_get);//取消领取
|
||||||
@@ -185,6 +188,15 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
assert poiEntity != null;
|
assert poiEntity != null;
|
||||||
int taskStatus = poiEntity.getTaskStatus();
|
int taskStatus = poiEntity.getTaskStatus();
|
||||||
initViewByTaskStatus(taskStatus);
|
initViewByTaskStatus(taskStatus);
|
||||||
|
// 用户点击开始导航
|
||||||
|
tvStartNav.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (Constant.currentNaviType == null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
app/src/main/java/com/navinfo/outdoor/util/NaviUtils.java
Normal file
13
app/src/main/java/com/navinfo/outdoor/util/NaviUtils.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
public class NaviUtils {
|
||||||
|
private static NaviUtils instance;
|
||||||
|
public static NaviUtils getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new NaviUtils();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_delete"
|
android:id="@+id/btn_delete"
|
||||||
android:layout_width="25dp"
|
android:layout_width="28dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="28dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@drawable/delete"
|
android:background="@drawable/delete"
|
||||||
@@ -16,6 +16,19 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_gather_start_navi"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/pickerview_topbar_title_textsize"
|
||||||
|
android:textColor="@color/colorWhite"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:background="@drawable/selector_red_bg"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/btn_delete"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/btn_delete"
|
||||||
|
android:layout_marginEnd="18dp"
|
||||||
|
android:text="导航到此处"></androidx.appcompat.widget.AppCompatTextView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linear_layout"
|
android:id="@+id/linear_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user