| | |
| | | applicationId "com.xianning.driver" |
| | | minSdkVersion 26 |
| | | targetSdkVersion 29 |
| | | versionCode 11 |
| | | versionName "1.6" |
| | | versionCode 12 |
| | | versionName "1.7" |
| | | multiDexEnabled true |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | |
| | | // 导航SDK内部使用了annotationProcessor,需要添加下面代码,防止编译异常 |
| | | javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } } |
| | | |
| | | manifestPlaceholders = [ |
| | | JPUSH_PKGNAME : applicationId, |
| | |
| | | implementation(name: 'alipaySdk-15.7.5-20200422171619', ext: 'aar') |
| | | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| | | implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.8.0' |
| | | implementation 'androidx.appcompat:appcompat:1.1.0' |
| | | implementation 'androidx.core:core-ktx:1.2.0' |
| | | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' |
| | | testImplementation 'junit:junit:4.12' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | |
| | | implementation 'com.github.zackratos.ultimatebar:ultimatebar3:3.1.1' |
| | | implementation 'com.aliyun.dpa:oss-android-sdk:2.9.2' |
| | | implementation 'org.greenrobot:eventbus:3.1.1' |
| | | implementation 'com.github.bumptech.glide:glide:4.9.0' |
| | | implementation 'com.github.bumptech.glide:glide:4.12.0' |
| | | annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' |
| | | implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' |
| | | implementation 'com.google.android.material:material:1.1.0' |
| | |
| | | implementation project(path: ':easyfloat') |
| | | |
| | | implementation 'com.baidu.lbsyun:BaiduMapSDK_Location_All:9.6.4' |
| | | implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-Navi:7.5.9' |
| | | |
| | | implementation 'com.baidu.lbsyun:BaiduMapSDK_Search:7.5.9' |
| | | implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-Navi:7.6.1' |
| | | //以下是百度导航依赖 |
| | | implementation 'androidx.cardview:cardview:1.0.0' |
| | | implementation 'androidx.appcompat:appcompat:1.2.0' |
| | | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' |
| | | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |
| | | implementation 'com.airbnb.android:lottie:3.6.0' |
| | | } |
| | |
| | | [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":11,"versionName":"1.6","enabled":true,"outputFile":"xianning-1.6-2024-12-31.apk","fullName":"release","baseName":"release","dirName":""},"path":"xianning-1.6-2024-12-31.apk","properties":{}}] |
| | | [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":12,"versionName":"1.7","enabled":true,"outputFile":"xianning-1.7-2025-01-09.apk","fullName":"release","baseName":"release","dirName":""},"path":"xianning-1.7-2025-01-09.apk","properties":{}}] |
| | |
| | | <activity android:name=".ui.mine.WithdrawActivity" /> |
| | | <activity android:name=".ui.mine.WithdrawRecordActivity" /> |
| | | <activity android:name=".ui.mine.WalletRecordActivity" /> |
| | | <activity android:name=".ui.main.CallOrderActivity" /> <!-- 微信 --> |
| | | <activity android:name=".ui.main.CallOrderActivity" /> |
| | | <activity android:name=".base.gaode.gpsnav.BaiduNaviActivity" /> <!-- 微信 --> |
| | | |
| | | <!-- Since JCore2.0.0 Required SDK核心功能--> |
| | | <!-- 可配置android:process参数将Service放在其他进程中;android:enabled属性不能是false --> |
| | |
| | | XUI.init(this) |
| | | registerActivityLifecycleCallbacks(this) |
| | | initSocket() |
| | | SDKInitializer.setAgreePrivacy(this,true) |
| | | SDKInitializer.initialize(this) |
| | | SDKInitializer.setCoordType(CoordType.BD09LL); |
| | | SDKInitializer.setCoordType(CoordType.BD09LL) |
| | | |
| | | } |
| | | |
| | | fun initPersionDate(){ |
| | |
| | | package com.xianning.driver.base.gaode |
| | | |
| | | import android.content.Context |
| | | import android.graphics.Color |
| | | import android.location.LocationManager |
| | | import android.os.Bundle |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | | import android.text.TextUtils |
| | | import android.view.View |
| | | import androidx.core.content.ContextCompat |
| | | import cn.sinata.xldutils.utils.sysErr |
| | | import com.amap.api.fence.GeoFenceClient |
| | | import com.amap.api.fence.GeoFenceListener |
| | | import com.amap.api.services.core.LatLonPoint |
| | | import com.amap.api.services.geocoder.* |
| | | import com.amap.api.services.route.* |
| | | import com.amap.api.services.route.RouteSearch.DriveRouteQuery |
| | | import com.amap.api.services.route.RouteSearch.FromAndTo |
| | |
| | | import com.baidu.location.LocationClientOption.LocationMode |
| | | import com.baidu.mapapi.map.* |
| | | import com.baidu.mapapi.model.LatLng |
| | | import com.baidu.mapapi.model.LatLngBounds |
| | | import com.xianning.driver.R |
| | | import java.util.* |
| | | |
| | |
| | | |
| | | fun initMap(savedInstanceState: Bundle?, mapView: MapView): BaiduMap { |
| | | val aMap = mapView.map |
| | | val mMyLocationStyle = BaiduMapOptions() |
| | | val uiSettings = aMap.uiSettings |
| | | uiSettings.isCompassEnabled = false |
| | | mapView.showScaleControl(false) |
| | | mapView.showZoomControls(false) |
| | | return aMap |
| | | } |
| | | |
| | | fun drawLine(context: Context, aMap: BaiduMap, start: LatLng, end: LatLng): Polyline? { |
| | | // val latLngs: MutableList<LatLng> = ArrayList() |
| | | // latLngs.add(start) |
| | | // latLngs.add(end) |
| | | // return aMap.addPolyline( |
| | | // PolylineOptions().addAll(latLngs).width(10f).color( |
| | | // ContextCompat.getColor(context, R.color.main_yellow_qia) |
| | | // ) |
| | | // ) |
| | | return null |
| | | fun drawLine(context: Context, aMap: BaiduMap, start: LatLng, end: LatLng): Overlay? { |
| | | val latLngs: MutableList<LatLng> = ArrayList() |
| | | latLngs.add(start) |
| | | latLngs.add(end) |
| | | //设置折线的属性 |
| | | val mOverlayOptions: OverlayOptions = PolylineOptions() |
| | | .width(10) |
| | | .color(ContextCompat.getColor(context, R.color.main_yellow_qia)) |
| | | .points(latLngs) |
| | | //在地图上绘制折线 |
| | | //mPloyline 折线对象 |
| | | return aMap.addOverlay(mOverlayOptions) |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | fun drawLine(context: Context, aMap: BaiduMap, latLngs: List<LatLng?>?): Polyline? { |
| | | // val options = PolylineOptions().addAll(latLngs).width(20f) |
| | | // .color(ContextCompat.getColor(context, R.color.qing)) |
| | | // return aMap.addPolyline(options) |
| | | return null |
| | | fun drawLine(context: Context, aMap: BaiduMap, points: List<LatLng>?): Overlay { |
| | | val latLngs: MutableList<LatLng> = ArrayList() |
| | | latLngs.addAll(points?: arrayListOf()) |
| | | //设置折线的属性 |
| | | val mOverlayOptions: OverlayOptions = PolylineOptions() |
| | | .width(10) |
| | | .color(ContextCompat.getColor(context, R.color.qing)) |
| | | .points(latLngs) |
| | | //在地图上绘制折线 |
| | | //mPloyline 折线对象 |
| | | return aMap.addOverlay(mOverlayOptions) |
| | | } |
| | | |
| | | fun moveCamera(aMap: BaiduMap, latlng: LatLng?) { |
| | | // val mCameraUpdate = CameraUpdateFactory.newCameraPosition( |
| | | // CameraPosition(latlng, 16f, 0f, 0f) |
| | | // ) |
| | | // aMap.animateCamera(mCameraUpdate) |
| | | fun moveCamera(aMap: BaiduMap, latlng: LatLng) { |
| | | val mapStatusUpdate = MapStatusUpdateFactory.newLatLng(latlng) |
| | | aMap.animateMapStatus(mapStatusUpdate,16) |
| | | } |
| | | |
| | | fun moveCamera(aMap: BaiduMap, start: LatLng?, end: LatLng?) { |
| | | // var bounds: LatLngBounds? = null |
| | | // if (start!!.latitude < end!!.latitude) |
| | | // bounds = LatLngBounds(start, end) |
| | | // else |
| | | // bounds = LatLngBounds(end, start) |
| | | // val mCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 150) |
| | | // aMap.animateCamera(mCameraUpdate, object : AMap.CancelableCallback { |
| | | // override fun onFinish() { |
| | | // sysErr("onFinish") |
| | | // } |
| | | // |
| | | // override fun onCancel() { |
| | | // sysErr("onCancel") |
| | | // } |
| | | // }) |
| | | val bounds = LatLngBounds.Builder().include(start).include(end).build() |
| | | val mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(bounds,100,100,100,100) |
| | | aMap.animateMapStatus(mapStatusUpdate) |
| | | } |
| | | |
| | | fun moveCamera3(aMap: BaiduMap, start: LatLng?, end: LatLng?, car: LatLng?) { |
| | | // var bounds: LatLngBounds? = null |
| | | // if (start!!.latitude < end!!.latitude) |
| | | // bounds = LatLngBounds(start, end) |
| | | // else |
| | | // bounds = LatLngBounds(end, start) |
| | | // bounds.including(car) |
| | | // val mCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 150) |
| | | // aMap.animateCamera(mCameraUpdate, object : AMap.CancelableCallback { |
| | | // override fun onFinish() { |
| | | // sysErr("onFinish") |
| | | // } |
| | | // |
| | | // override fun onCancel() { |
| | | // sysErr("onCancel") |
| | | // } |
| | | // }) |
| | | val bounds = LatLngBounds.Builder().include(start).include(end).include(car).build() |
| | | val mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(bounds,150,150,150,150) |
| | | aMap.animateMapStatus(mapStatusUpdate) |
| | | |
| | | } |
| | | |
| | | fun moveCamera(aMap: BaiduMap, start: LatLng?, end: LatLng?, padd: Int) { |
| | | // val bounds = LatLngBounds(start, end) |
| | | // val mCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padd) |
| | | // aMap.animateCamera(mCameraUpdate) |
| | | fun moveCamera(aMap: BaiduMap, start: LatLng, end: LatLng, padd: Int) { |
| | | val bounds = LatLngBounds.Builder().include(start).include(end).build() |
| | | val mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(bounds,padd,padd,padd,padd) |
| | | aMap.animateMapStatus(mapStatusUpdate) |
| | | } |
| | | |
| | | fun getOption( |
| | |
| | | mLng: Double?, |
| | | view: View, |
| | | peopleId: String |
| | | ): Marker? { |
| | | ): Overlay? { |
| | | if (mLat == null || mLng == null){ |
| | | return null |
| | | } |
| | | val options: MarkerOptions = getOption(LatLng(mLat, mLng), view) |
| | | val marker: Overlay = aMap.addOverlay(options) |
| | | return null |
| | | return marker |
| | | } |
| | | |
| | | fun getTance(tance: Float): String { |
| | |
| | | start: LatLng, end: LatLng, centerPoint: List<LatLonPoint>?, |
| | | onClick: (latLngs: MutableList<LatLng>, lineTance: Float, lineTime: Long) -> Unit |
| | | ) { |
| | | |
| | | |
| | | |
| | | var routeSearch = RouteSearch(context) |
| | | val fromAndTo = FromAndTo( |
| | | LatLonPoint(start.latitude, start.longitude), |
New file |
| | |
| | | package com.xianning.driver.base.gaode; |
| | | |
| | | import com.baidu.mapapi.model.LatLng; |
| | | import com.baidu.mapapi.search.route.BikingRouteResult; |
| | | import com.baidu.mapapi.search.route.DrivingRouteLine; |
| | | import com.baidu.mapapi.search.route.DrivingRoutePlanOption; |
| | | import com.baidu.mapapi.search.route.DrivingRouteResult; |
| | | import com.baidu.mapapi.search.route.IndoorRouteResult; |
| | | import com.baidu.mapapi.search.route.MassTransitRouteResult; |
| | | import com.baidu.mapapi.search.route.OnGetRoutePlanResultListener; |
| | | import com.baidu.mapapi.search.route.PlanNode; |
| | | import com.baidu.mapapi.search.route.RoutePlanSearch; |
| | | import com.baidu.mapapi.search.route.TransitRouteResult; |
| | | import com.baidu.mapapi.search.route.WalkingRouteResult; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | public class BaiduUtils { |
| | | public static void initRouteLine(LatLng start,LatLng end,Callback callback){ |
| | | RoutePlanSearch mSearch = RoutePlanSearch.newInstance(); |
| | | OnGetRoutePlanResultListener listener = new OnGetRoutePlanResultListener(){ |
| | | @Override |
| | | public void onGetWalkingRouteResult(WalkingRouteResult walkingRouteResult) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetTransitRouteResult(TransitRouteResult transitRouteResult) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetMassTransitRouteResult(MassTransitRouteResult massTransitRouteResult) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetDrivingRouteResult(DrivingRouteResult drivingRouteResult) { |
| | | //驾车 |
| | | if (drivingRouteResult.getRouteLines().size()>0){ |
| | | DrivingRouteLine drivingRouteLine = drivingRouteResult.getRouteLines().get(0); |
| | | ArrayList<LatLng> latLngs = new ArrayList<>(); |
| | | for (int i=0;i<drivingRouteLine.getAllStep().size();i++){ |
| | | DrivingRouteLine.DrivingStep steps = drivingRouteLine.getAllStep().get(i); |
| | | latLngs.addAll(steps.getWayPoints()); |
| | | } |
| | | callback.onGetDrivingRouteResult(latLngs,(float) drivingRouteLine.getDistance(), drivingRouteLine.getDuration()); |
| | | } |
| | | mSearch.destroy(); |
| | | } |
| | | |
| | | @Override |
| | | public void onGetIndoorRouteResult(IndoorRouteResult indoorRouteResult) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetBikingRouteResult(BikingRouteResult bikingRouteResult) { |
| | | |
| | | } |
| | | }; |
| | | mSearch.setOnGetRoutePlanResultListener(listener); |
| | | PlanNode stNode = PlanNode.withLocation(start); |
| | | PlanNode enNode = PlanNode.withLocation(end); |
| | | mSearch.drivingSearch((new DrivingRoutePlanOption()) |
| | | .from(stNode) |
| | | .to(enNode)); |
| | | } |
| | | |
| | | public interface Callback{ |
| | | void onGetDrivingRouteResult(ArrayList<LatLng> latLngs,float lineTance,long lineTime); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.xianning.driver.base.gaode.gpsnav |
| | | |
| | | import android.content.Intent |
| | | import android.content.res.Configuration |
| | | import android.graphics.Color |
| | | import android.os.Build |
| | | import android.os.Bundle |
| | | import android.util.Log |
| | | import android.view.KeyEvent |
| | | import android.view.View |
| | | import android.view.Window |
| | | import android.view.WindowManager |
| | | import androidx.fragment.app.FragmentActivity |
| | | import com.baidu.navisdk.adapter.* |
| | | import com.baidu.navisdk.adapter.struct.BNGuideConfig |
| | | |
| | | |
| | | class BaiduNaviActivity:FragmentActivity() { |
| | | private var mRouteGuideManager: IBNRouteGuideManager? = null |
| | | private val mMode = IBNaviListener.DayNightMode.DAY |
| | | private val TAG = "BaiduNavi" |
| | | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | val fullScreen: Boolean = supportFullScreen() |
| | | val params = Bundle() |
| | | params.putBoolean(BNaviCommonParams.ProGuideKey.IS_SUPPORT_FULL_SCREEN, fullScreen) |
| | | mRouteGuideManager = BaiduNaviManagerFactory.getRouteGuideManager() |
| | | val config = BNGuideConfig.Builder() |
| | | .params(params) |
| | | .build() |
| | | val view: View? = mRouteGuideManager?.onCreate(this, config) |
| | | if (view != null) { |
| | | setContentView(view) |
| | | } |
| | | routeGuideEvent() |
| | | } |
| | | |
| | | // 导航过程事件监听 |
| | | private fun routeGuideEvent() { |
| | | BaiduNaviManagerFactory.getRouteGuideManager().setNaviListener(object : IBNaviListener() { |
| | | override fun onNaviGuideEnd() { |
| | | this@BaiduNaviActivity.finish() |
| | | } |
| | | |
| | | override fun onYawingSuccess() { |
| | | super.onYawingSuccess() |
| | | Log.e(TAG, "onYawingSuccess") |
| | | val routePlanInfo = BaiduNaviManagerFactory.getRoutePlanManager().routePlanInfo |
| | | } |
| | | }) |
| | | BaiduNaviManagerFactory.getRouteGuideManager().setNaviViewListener( |
| | | object : IBNaviViewListener() { |
| | | override fun onMainInfoPanCLick() {} |
| | | override fun onNaviTurnClick() {} |
| | | override fun onFullViewButtonClick(b: Boolean) {} |
| | | override fun onFullViewWindowClick(b: Boolean) {} |
| | | override fun onNaviBackClick() {} |
| | | override fun onBottomBarClick(action: Action) {} |
| | | override fun onNaviSettingClick() {} |
| | | override fun onRefreshBtnClick() {} |
| | | override fun onZoomLevelChange(i: Int) {} |
| | | override fun onMapClicked(v: Double, v1: Double) {} |
| | | override fun onMapMoved() { |
| | | Log.e(TAG, "onMapMoved") |
| | | } |
| | | |
| | | override fun onFloatViewClicked() { |
| | | try { |
| | | val intent = Intent() |
| | | intent.setPackage(packageName) |
| | | intent.setClass( |
| | | this@BaiduNaviActivity, |
| | | Class.forName(BaiduNaviActivity::class.java.getName()) |
| | | ) |
| | | intent.setFlags( |
| | | Intent.FLAG_ACTIVITY_NEW_TASK |
| | | or Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
| | | ) |
| | | startActivity(intent) |
| | | } catch (e: ClassNotFoundException) { |
| | | e.printStackTrace() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | private fun supportFullScreen(): Boolean { |
| | | if (Build.VERSION.SDK_INT >= 21) { |
| | | val window: Window = window |
| | | val color: Int |
| | | color = if (Build.VERSION.SDK_INT >= 23) { |
| | | Color.TRANSPARENT |
| | | } else { |
| | | 0x2d000000 |
| | | } |
| | | window.setStatusBarColor(color) |
| | | if (Build.VERSION.SDK_INT >= 23) { |
| | | window.getDecorView().setSystemUiVisibility( |
| | | View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
| | | ) |
| | | var uiVisibility: Int = window.getDecorView().getSystemUiVisibility() |
| | | if (mMode == IBNaviListener.DayNightMode.DAY) { |
| | | uiVisibility = uiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR |
| | | } |
| | | window.getDecorView().setSystemUiVisibility(uiVisibility) |
| | | } else { |
| | | window.getDecorView().setSystemUiVisibility( |
| | | View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
| | | ) |
| | | } |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | override fun onStart() { |
| | | super.onStart() |
| | | mRouteGuideManager!!.onStart() |
| | | } |
| | | |
| | | override fun onResume() { |
| | | super.onResume() |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |
| | | mRouteGuideManager!!.onResume() |
| | | } |
| | | |
| | | override fun onPause() { |
| | | super.onPause() |
| | | mRouteGuideManager!!.onPause() |
| | | window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |
| | | } |
| | | |
| | | override fun onStop() { |
| | | super.onStop() |
| | | mRouteGuideManager!!.onStop() |
| | | } |
| | | |
| | | override fun onDestroy() { |
| | | super.onDestroy() |
| | | mRouteGuideManager!!.onDestroy(false) |
| | | mRouteGuideManager = null |
| | | } |
| | | |
| | | override fun onBackPressed() { |
| | | mRouteGuideManager!!.onBackPressed(false, true) |
| | | } |
| | | |
| | | override fun onConfigurationChanged(newConfig: Configuration) { |
| | | super.onConfigurationChanged(newConfig!!) |
| | | mRouteGuideManager!!.onConfigurationChanged(newConfig) |
| | | } |
| | | |
| | | override fun setRequestedOrientation(requestedOrientation: Int) { |
| | | |
| | | } |
| | | |
| | | override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { |
| | | return if (!mRouteGuideManager!!.onKeyDown(keyCode, event)) { |
| | | super.onKeyDown(keyCode, event) |
| | | } else true |
| | | } |
| | | |
| | | override fun onRequestPermissionsResult( |
| | | requestCode: Int, permissions: Array<String?>, |
| | | grantResults: IntArray |
| | | ) { |
| | | mRouteGuideManager!!.onRequestPermissionsResult(requestCode, permissions, grantResults) |
| | | } |
| | | |
| | | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
| | | super.onActivityResult(requestCode, resultCode, data) |
| | | mRouteGuideManager!!.onActivityResult(requestCode, resultCode, data) |
| | | } |
| | | } |
| | |
| | | import com.xianning.driver.base.BaseRvAdapter |
| | | import com.xianning.driver.base.BaseViewHolder |
| | | import com.xianning.driver.bean.SitePointBean |
| | | import kotlinx.android.synthetic.main.activity_search_site.view.tv_city_name |
| | | import kotlinx.android.synthetic.main.item_city_select.view.* |
| | | |
| | | class CitySelectAdapter: BaseRvAdapter<SitePointBean.DataBean>() { |
| | |
| | | import android.view.View |
| | | import cn.sinata.xldutils.activitys.DialogActivity |
| | | import cn.sinata.xldutils.utils.* |
| | | import com.amap.api.maps.AMap |
| | | import com.amap.api.maps.model.LatLng |
| | | import com.baidu.mapapi.map.BaiduMap |
| | | import com.baidu.mapapi.model.LatLng |
| | | import com.xianning.driver.R |
| | | import com.xianning.driver.base.MyApplication |
| | | import com.xianning.driver.base.gaode.AMapKit |
| | |
| | | import com.xianning.driver.netUtls.* |
| | | import com.xianning.driver.ui.UiUtil |
| | | import com.google.gson.Gson |
| | | import com.xianning.driver.base.gaode.BaiduUtils |
| | | import kotlinx.android.synthetic.main.item_get_order.* |
| | | import kotlinx.android.synthetic.main.item_map_market.view.* |
| | | import org.jetbrains.anko.startActivity |
| | | import java.util.ArrayList |
| | | |
| | | class GetOrderFragment : DialogActivity() { |
| | | |
| | |
| | | callNet(this, Api.queryPushOrder, map) { |
| | | val data = Gson().fromJson<OrderBean>(it, OrderBean::class.java).data |
| | | sysErr(data) |
| | | val startView = createView(R.layout.item_map_market, this) |
| | | val endView = createView(R.layout.item_map_market, this) |
| | | startView.iv_img.setImageResource(R.mipmap.starting_point) |
| | | endView.iv_img.setImageResource(R.mipmap.end_point) |
| | | AMapKit.addMarker(aMap, data.startLat, data.startLon, startView, "") |
| | | AMapKit.addMarker(aMap, data.endLat, data.endLon, endView, "") |
| | | tv_time.text = data.travelTime |
| | | tv_car_type.text = UiUtil.getNameByType(orderType!!) + "订单" |
| | | tv_remark.visibility = if (data.remark.isNullOrEmpty()) View.GONE else View.VISIBLE |
| | |
| | | tv_reassign.text = data.type |
| | | |
| | | if (data.endLat != null&&data.endLat != 0.0&& data.endLon != null&& data.endLon != 0.0) { |
| | | AMapKit.drawLineAndMove( |
| | | this, |
| | | aMap, |
| | | LatLng(data.startLat, data.startLon), |
| | | LatLng(data.endLat, data.endLon), 100 |
| | | ) |
| | | AMapKit.initRouteLine( |
| | | this, |
| | | LatLng(data.startLat, data.startLon), |
| | | LatLng(data.endLat, data.endLon), |
| | | object : (MutableList<LatLng>, Float, Long) -> Unit { |
| | | override fun invoke( |
| | | latLngs: MutableList<LatLng>, |
| | | BaiduUtils.initRouteLine(LatLng(data.startLat, data.startLon), |
| | | LatLng(data.endLat, data.endLon),object :BaiduUtils.Callback{ |
| | | override fun onGetDrivingRouteResult( |
| | | latLngs: ArrayList<LatLng>?, |
| | | lineTance: Float, |
| | | lineTime: Long |
| | | ) { |
| | |
| | | ) |
| | | ) |
| | | } |
| | | |
| | | }) |
| | | AMapKit.drawLineAndMove( |
| | | this, |
| | | aMap, |
| | | LatLng(data.startLat, data.startLon), |
| | | LatLng(data.endLat, data.endLon), 100 |
| | | ) |
| | | }else{ |
| | | AMapKit.moveCamera(aMap,LatLng(data.startLat, data.startLon)) |
| | | MyApplication.getTTsManager().setVideoText( |
| | |
| | | ) |
| | | } |
| | | |
| | | AMapKit.initRouteLine( |
| | | this, |
| | | LatLng(MyApplication.getLocation().latitude, MyApplication.getLocation().longitude), |
| | | LatLng(data.startLat, data.startLon), |
| | | object : (MutableList<LatLng>, Float, Long) -> Unit { |
| | | override fun invoke( |
| | | latLngs: MutableList<LatLng>, |
| | | BaiduUtils.initRouteLine(LatLng(MyApplication.getLocation().latitude, MyApplication.getLocation().longitude), |
| | | LatLng(data.startLat, data.startLon),object :BaiduUtils.Callback{ |
| | | override fun onGetDrivingRouteResult( |
| | | latLngs: ArrayList<LatLng>?, |
| | | lineTance: Float, |
| | | lineTime: Long |
| | | ) { |
| | | tv_title.text = "距您约" + AMapKit.getTance(lineTance) |
| | | } |
| | | }) |
| | | |
| | | val startView = createView(R.layout.item_map_market, this) |
| | | val endView = createView(R.layout.item_map_market, this) |
| | | startView.iv_img.setImageResource(R.mipmap.starting_point) |
| | | endView.iv_img.setImageResource(R.mipmap.end_point) |
| | | AMapKit.addMarker(aMap, data.startLat, data.startLon, startView, "") |
| | | AMapKit.addMarker(aMap, data.endLat, data.endLon, endView, "") |
| | | } |
| | | } |
| | | |
| | |
| | | package com.xianning.driver.ui.main |
| | | |
| | | import android.os.Bundle |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | | import android.os.PersistableBundle |
| | | import android.os.* |
| | | import android.util.Log |
| | | import android.view.View |
| | | import androidx.core.os.bundleOf |
| | | import cn.sinata.xldutils.utils.* |
| | | import com.amap.api.location.AMapLocationListener |
| | | import com.amap.api.maps.AMap |
| | | import com.amap.api.maps.model.LatLng |
| | | import com.amap.api.maps.model.Marker |
| | | import com.amap.api.maps.model.Polyline |
| | | import com.baidu.location.BDAbstractLocationListener |
| | | import com.baidu.location.BDLocation |
| | | import com.baidu.location.LocationClient |
| | | import com.baidu.mapapi.map.BaiduMap |
| | | import com.baidu.mapapi.map.Marker |
| | | import com.baidu.mapapi.map.Overlay |
| | | import com.baidu.mapapi.model.LatLng |
| | | import com.baidu.navisdk.adapter.BNRoutePlanNode |
| | | import com.baidu.navisdk.adapter.BaiduNaviManagerFactory |
| | | import com.baidu.navisdk.adapter.IBNRoutePlanManager |
| | | import com.baidu.navisdk.adapter.IBaiduNaviManager |
| | | import com.baidu.navisdk.adapter.struct.BNaviInitConfig |
| | | import com.xianning.driver.R |
| | | import com.xianning.driver.base.BaseEvent |
| | | import com.xianning.driver.base.MyApplication |
| | |
| | | import com.xianning.driver.base.gaode.gpsnav.GPSNaviActivity |
| | | import com.xianning.driver.bean.OrderBean |
| | | import com.xianning.driver.bean.OrderSimpleData |
| | | import com.xianning.driver.bean.RessignBean |
| | | import com.xianning.driver.netUtls.* |
| | | import com.xianning.driver.ui.DialogUtil |
| | | import com.xianning.driver.ui.main.major.MajorSureMoneyActivity |
| | |
| | | import com.google.gson.Gson |
| | | import com.trello.rxlifecycle3.android.ActivityEvent |
| | | import com.xianning.driver.base.gaode.AMapKit.moveCamera3 |
| | | import com.xianning.driver.base.gaode.BaiduUtils |
| | | import com.xianning.driver.base.gaode.gpsnav.BaiduNaviActivity |
| | | import com.ypx.imagepicker.utils.PBitmapUtils |
| | | import io.reactivex.Observable |
| | | import io.reactivex.android.schedulers.AndroidSchedulers |
| | | import io.reactivex.disposables.Disposable |
| | |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.toast |
| | | import java.util.ArrayList |
| | | import java.util.concurrent.TimeUnit |
| | | |
| | | |
| | |
| | | var startMarker: Marker? = null |
| | | var endMarker: Marker? = null |
| | | var carMarker: Marker? = null |
| | | var markerLine: Polyline? = null |
| | | lateinit var aMap: AMap |
| | | var markerLine: Overlay? = null |
| | | lateinit var aMap: BaiduMap |
| | | lateinit var orderBean: OrderBean |
| | | |
| | | |
| | | private var listener:BDAbstractLocationListener? = null |
| | | private var locationClient: LocationClient? = null |
| | | |
| | | var naviHandler: Handler? = null |
| | | |
| | | override fun setContentView() { |
| | | setContentView(R.layout.activity_trip) |
| | |
| | | setTitleText("准备出发-去接客户-等待客户-服务中") |
| | | tv_Right.text = "取消订单" |
| | | callOrder() |
| | | initNaviSdk() |
| | | initMineLocation() |
| | | onclick() |
| | | addSockectCancel() |
| | | naviHandler = object :Handler(Looper.getMainLooper()){ |
| | | override fun handleMessage(msg: Message) { |
| | | when(msg.what){ |
| | | IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_START->{ |
| | | Log.e("mmp","算路开始") |
| | | } |
| | | IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_SUCCESS->{ |
| | | Log.e("mmp","算路成功") |
| | | } |
| | | IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_FAILED->{ |
| | | Log.e("mmp","算路失败") |
| | | } |
| | | IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_TO_NAVI->{ |
| | | Log.e("mmp","算路成功准备进入导航") |
| | | startActivity<BaiduNaviActivity>() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private fun initNaviSdk() { |
| | | val config = BNaviInitConfig.Builder().sdcardRootPath(PBitmapUtils.getPickerFileDirectory(this).absolutePath) |
| | | .naviInitListener(object :IBaiduNaviManager.INaviInitListener{ |
| | | override fun onAuthResult(p0: Int, p1: String?) { |
| | | Log.e("mmp","导航组件初始化onAuthResult(${p0}:${p1})") |
| | | } |
| | | |
| | | override fun initStart() { |
| | | Log.e("mmp","导航组件初始化开始") |
| | | } |
| | | |
| | | override fun initSuccess() { |
| | | Log.e("mmp","导航组件初始化成功") |
| | | } |
| | | |
| | | override fun initFailed(p0: Int) { |
| | | Log.e("mmp","导航组件初始化失败:$p0") |
| | | } |
| | | }).build() |
| | | BaiduNaviManagerFactory.getBaiduNaviManager().init(this, config) |
| | | } |
| | | |
| | | private fun addSockectCancel() { |
| | |
| | | when (it.data.orderState) { |
| | | 2, 3 -> { |
| | | // startAMapNavi(makeMarker!!) |
| | | // startNavi(carMarker!!.position,makeMarker!!.position) |
| | | startActivity<GPSNaviActivity>( |
| | | "start" to carMarker!!.position, |
| | | "end" to makeMarker!!.position |
| | | "start" to com.amap.api.maps.model.LatLng(carMarker!!.position.latitude,carMarker!!.position.longitude), |
| | | "end" to com.amap.api.maps.model.LatLng(makeMarker!!.position.latitude,makeMarker!!.position.longitude) |
| | | ) |
| | | |
| | | } |
| | | |
| | | 4 -> { |
| | |
| | | if (endMarker == null){ |
| | | toast("暂无终点") |
| | | }else{ |
| | | startActivity<GPSNaviActivity>( |
| | | "start" to carMarker!!.position, |
| | | "end" to endMarker!!.position |
| | | ) |
| | | startNavi(carMarker!!.position,endMarker!!.position) |
| | | // startActivity<GPSNaviActivity>( |
| | | // "start" to com.amap.api.maps.model.LatLng(carMarker!!.position.latitude,carMarker!!.position.longitude), |
| | | // "end" to com.amap.api.maps.model.LatLng(endMarker!!.position.latitude,endMarker!!.position.longitude) |
| | | // ) |
| | | } |
| | | |
| | | } |
| | | else -> { |
| | | |
| | |
| | | |
| | | private fun changeCarThree(isMove: Boolean) { |
| | | if (makeMarker != null && carMarker != null) { |
| | | AMapKit.initRouteLine( |
| | | this, |
| | | makeMarker!!.position, |
| | | carMarker!!.position, |
| | | object : (MutableList<LatLng>, Float, Long) -> Unit { |
| | | override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) { |
| | | var view = creatCarView("距预约点" + AMapKit.getTance(p2)) |
| | | carMarker!!.setIcon(getIcon(view)) |
| | | addline(p1) |
| | | if (isMove) |
| | | moveCamera(aMap, makeMarker!!.position, carMarker!!.position) |
| | | } |
| | | }) |
| | | BaiduUtils.initRouteLine(carMarker!!.position,makeMarker!!.position,object :BaiduUtils.Callback{ |
| | | override fun onGetDrivingRouteResult( |
| | | latLngs: ArrayList<LatLng>?, |
| | | lineTance: Float, |
| | | lineTime: Long |
| | | ) { |
| | | var view = creatCarView("距预约点" + AMapKit.getTance(lineTance)) |
| | | carMarker!!.setIcon(getIcon(view)) |
| | | addline(latLngs?: arrayListOf()) |
| | | if (isMove) |
| | | moveCamera(aMap, makeMarker!!.position, carMarker!!.position) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | private fun changeCarFive(isMove: Boolean) { |
| | | if (carMarker != null && endMarker != null) { |
| | | AMapKit.initRouteLine( |
| | | this, |
| | | carMarker!!.position, |
| | | endMarker!!.position, |
| | | object : (MutableList<LatLng>, Float, Long) -> Unit { |
| | | override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) { |
| | | addline(p1) |
| | | var view = |
| | | creatCarView("剩余" + AMapKit.getTance(p2) + "\n" + "预计还需" + p3.toInt() + "分钟") |
| | | carMarker!!.setIcon(getIcon(view)) |
| | | if (isMove) { |
| | | moveCamera3(aMap, carMarker!!.position, endMarker!!.position,carMarker!!.position) |
| | | } |
| | | BaiduUtils.initRouteLine(carMarker!!.position,endMarker!!.position,object :BaiduUtils.Callback{ |
| | | override fun onGetDrivingRouteResult( |
| | | latLngs: ArrayList<LatLng>, |
| | | lineTance: Float, |
| | | lineTime: Long |
| | | ) { |
| | | addline(latLngs) |
| | | var view = |
| | | creatCarView("剩余" + AMapKit.getTance(lineTance) + "\n" + "预计还需" + lineTime.toInt() + "分钟") |
| | | carMarker!!.setIcon(getIcon(view)) |
| | | if (isMove) { |
| | | moveCamera3(aMap, carMarker!!.position, endMarker!!.position,carMarker!!.position) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | var view = |
| | | creatCarView() |
| | |
| | | if (makeMarker == null) { |
| | | val view = createView(R.layout.item_map_market_make, this) |
| | | view.iv_img.setImageResource(R.mipmap.trip_yuyue) |
| | | makeMarker = addMarker(aMap, it.data.startLat, it.data.startLon, view, "") |
| | | makeMarker = addMarker(aMap, it.data.startLat, it.data.startLon, view, "") as Marker |
| | | } |
| | | makeMarker!!.isVisible = false |
| | | if (startMarker == null) { |
| | | val view = createView(R.layout.item_map_market, this) |
| | | view.iv_img.setImageResource(R.mipmap.starting_point) |
| | | startMarker = addMarker(aMap, it.data.startLat, it.data.startLon, view, "") |
| | | startMarker = addMarker(aMap, it.data.startLat, it.data.startLon, view, "") as Marker |
| | | } |
| | | startMarker!!.isVisible = false |
| | | if (endMarker == null) { |
| | | val view = createView(R.layout.item_map_market, this) |
| | | view.iv_img.setImageResource(R.mipmap.end_point) |
| | | endMarker = addMarker(aMap, it.data.endLat, it.data.endLon, view, "") |
| | | endMarker = addMarker(aMap, it.data.endLat, it.data.endLon, view, "") as Marker |
| | | } |
| | | endMarker?.isVisible = false |
| | | if (carMarker == null) { |
| | |
| | | MyApplication.getLocation().longitude, |
| | | carView, |
| | | "" |
| | | ) |
| | | ) as Marker |
| | | } |
| | | carMarker!!.isVisible = false |
| | | if (markerLine != null) { |
| | |
| | | if (handler != null) { |
| | | handler?.removeCallbacksAndMessages(null) |
| | | } |
| | | naviHandler?.removeCallbacksAndMessages(null) |
| | | closeTimeStart() |
| | | MyApplication.removeOrderView(this) |
| | | map_view.onDestroy() |
| | |
| | | map_view.onResume() |
| | | } |
| | | |
| | | override fun onLowMemory() { |
| | | super.onLowMemory() |
| | | map_view.onLowMemory() |
| | | } |
| | | |
| | | override fun onSaveInstanceState(outState: Bundle, outPersistentState: PersistableBundle) { |
| | | super.onSaveInstanceState(outState, outPersistentState) |
| | | map_view.onSaveInstanceState(outState) |
| | |
| | | |
| | | |
| | | |
| | | private fun addline(allLine: MutableList<LatLng>) { |
| | | private fun addline(allLine: ArrayList<LatLng>) { |
| | | closeLine() |
| | | markerLine = AMapKit.drawLine(this, aMap, allLine) |
| | | } |
| | |
| | | if (markerLine != null) { |
| | | markerLine!!.remove() |
| | | } |
| | | } |
| | | |
| | | private fun startNavi(start:LatLng,end:LatLng){ |
| | | val list = arrayListOf<BNRoutePlanNode>() |
| | | val startNode = BNRoutePlanNode.Builder() |
| | | .longitude(start.longitude) |
| | | .latitude(start.latitude) |
| | | .build() |
| | | val endNode = BNRoutePlanNode.Builder() |
| | | .longitude(end.longitude) |
| | | .latitude(end.latitude) |
| | | .build() |
| | | list.add(startNode) |
| | | list.add(endNode) |
| | | BaiduNaviManagerFactory.getRoutePlanManager().routePlan( |
| | | list, |
| | | IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT, |
| | | bundleOf(), naviHandler) |
| | | } |
| | | |
| | | |
| | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | aMap = initMap(savedInstanceState, map_view) |
| | | map_view.onCreate(savedInstanceState) |
| | | } |
| | | |
| | | override fun onEventMainThread(event: BaseEvent?) { |
| | |
| | | |
| | | class AddCarActivity : BasePhotoActivity() { |
| | | // var arrayColor = arrayListOf("黑色", "银色", "白色", "红色", "黄色", "橙色", "蓝色") |
| | | var arrayColor = arrayListOf("蓝白色", "绿色") |
| | | var arrayColor = arrayListOf("蓝白色", "绿色", "黄色") |
| | | var arrayNumStart = arrayListOf("冀","蒙","吉","沪","皖","鲁","鄂","桂","渝","藏","甘","新","晋" |
| | | ,"辽","黑", "苏", "浙", "闽", "赣", "豫", "湘", "粤", "琼", "川", "黔", "滇", "陕", "青", "宁") |
| | | var letter = arrayListOf("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T" |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | fun showTimePicker() { |
| | | var startCalendar = Calendar.getInstance() |
| | | var endCalendar = Calendar.getInstance() |
| | | startCalendar.set(1900, 1, 1) |
| | | endCalendar.time = Date() |
| | | var timePic = TimePickerBuilder(this, |
| | | OnTimeSelectListener { date, v -> |
| | | tv_time.text = DateUtil.getTime(DateUtil.TYPE0,date.time) |
| | | }) |
| | | .setTitleText("") |
| | | var timePic = TimePickerBuilder(this) { date, v -> |
| | | tv_time.text = DateUtil.getTime(DateUtil.TYPE0, date.time) |
| | | }.setTitleText("") |
| | | .setBgColor(ContextCompat.getColor(this, R.color.white)) |
| | | .setCancelColor(ContextCompat.getColor(this, R.color.black_333333)) |
| | | .setSubmitColor(ContextCompat.getColor(this, R.color.main_yellow)) |
| | |
| | | override fun initView() { |
| | | showHeader(false) |
| | | showTitle(false) |
| | | val publicKey = getSignInfo(this) |
| | | Log.e("mmp", "公钥:$publicKey") |
| | | // val publicKey = getSignInfo(this) |
| | | // Log.e("mmp", "公钥:$publicKey") |
| | | } |
| | | |
| | | @SuppressLint("SourceLockedOrientationActivity") |
| | |
| | | },2000) |
| | | } |
| | | |
| | | protected fun getSignInfo(mContext: Context): String? { |
| | | protected fun getSignInfo(mContext: Context): String{ |
| | | var signcode = "" |
| | | try { |
| | | val packageInfo: PackageInfo = mContext.packageManager.getPackageInfo( |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <com.amap.api.maps.MapView |
| | | <com.baidu.mapapi.map.MapView |
| | | android:id="@+id/map_view" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"/> |
| | |
| | | dependencies { |
| | | implementation fileTree(dir: 'libs', include: ['*.jar']) |
| | | //noinspection GradleCompatible |
| | | implementation 'androidx.appcompat:appcompat:1.1.0' |
| | | implementation 'androidx.recyclerview:recyclerview:1.1.0' |
| | | implementation 'androidx.appcompat:appcompat:1.2.0' |
| | | implementation 'androidx.recyclerview:recyclerview:1.2.1' |
| | | implementation "androidx.core:core-ktx:1.2.0" |
| | | implementation 'com.google.android.material:material:1.1.0' |
| | | //fresco |