liugl
2021-06-21 0fb44d953ab25a53d228b4c1f9381df80e70ee03
app/src/main/java/com/okgoincar/slab/SlabTripActivity.kt
@@ -62,7 +62,6 @@
        MoneyBroadCastReceiver.callStatue(contexts, i)
    }
    /***
     * //    流程操作状态(3=开始出发预约点,4=到达预约点,5=开始服务,6=服务结束)
     * 页面一共4个marker 1:预约地点 2:起点 3终点 4:司机点
@@ -216,7 +215,11 @@
                        moveCamera(aMap, carMarker!!.position)
                    }
                    5, 6 -> {
                        moveCamera(aMap, carMarker!!.position, endMarker!!.position)
                        if (endMarker == null){
                            moveCamera(aMap, carMarker!!.position)
                        }else{
                            moveCamera(aMap, carMarker!!.position, endMarker!!.position)
                        }
                    }
                }
            }
@@ -233,11 +236,18 @@
                    }
                    5, 6 -> {
//                        startAMapNavi(endMarker!!)
                        startActivity<GPSNaviActivity>(
                            "start" to carMarker!!.position,
                            "end" to endMarker!!.position
                        )
                        if (endMarker == null){
                            toast("暂无终点")
                        }else{
                            startActivity<GPSNaviActivity>(
                                "start" to carMarker!!.position,
                                "end" to endMarker!!.position
                            )
                        }
                    }
                    else -> {
                    }
                }
            }
@@ -367,8 +377,11 @@
    private fun initMineLocation() {
        AMapKit.initLocation(this, AMapLocationListener {
            it?.let {
                MyApplication.aMapLocation = it
                carMarker!!.position = LatLng(it.latitude, it.longitude)
//                toast("errorCode=="+it.errorCode.toString()+"latitude=="+it.latitude.toString())
                if (it.errorCode == 0) {
                    MyApplication.aMapLocation = it
                    carMarker!!.position = LatLng(it.latitude, it.longitude)
                }
            }
            orderBean.let {
                when (it.data.orderState) {
@@ -418,7 +431,19 @@
                        }
                    }
                })
        }else{
            var view =
                creatCarView()
            carMarker?.setIcon(getIcon(view))
            if (isMove) {
                moveCamera(aMap, carMarker!!.position)
            }
        }
    }
    fun creatNullView(): View {
        val carView = createView(R.layout.view_no, this)
        return carView
    }
@@ -448,7 +473,11 @@
    private fun showDriverUI(data: UserInfoBean?) {
        data?.let {
            tv_code_num.text = "证号:" + data.taxiAptitudeCard
            if (data.taxiAptitudeCard.length > 7){
                tv_code_num.text  = "资格证号:"+data.taxiAptitudeCard.substring(0,3)+"*******"+data.taxiAptitudeCard.substring(data.taxiAptitudeCard.length-4,data.taxiAptitudeCard.length)
            }else{
                tv_code_num.text = "资格证号:" + data.taxiAptitudeCard
            }
            tv_name_car_man.text = "姓名:" + it.name
            tv_car_num_var.text = "车牌:" + it.licensePlate
            recycler_view_start.layoutManager =
@@ -475,6 +504,7 @@
            tv_time.text = it.data.travelTime
            tv_start_address.text = it.data.startAddress
            tv_end_address.text = it.data.endAddress
            tv_end_address.visibility = if (it.data.endAddress.isNullOrEmpty()) View.GONE else View.VISIBLE
            tv_red_money.text = it.data.tipMoney.toString() + "元小费"
            tv_phone.text = orderBean.data.phone
            showStatueMapUI(it)
@@ -499,7 +529,7 @@
            view.iv_img.setImageResource(R.mipmap.zhongdian)
            endMarker = addMarker(aMap, it.data.endLat, it.data.endLon, view, "")
        }
        endMarker!!.isVisible = false
        endMarker?.isVisible = false
        if (carMarker == null) {
            val carView = creatCarView("")
            carMarker = addMarker(
@@ -525,6 +555,13 @@
        carView.iv_img.setImageResource(R.mipmap.icon_car)
        carView.tv_hint.visible()
        carView.tv_hint.text = content
        return carView
    }
    fun creatCarView(): View {
        val carView = createView(R.layout.item_map_market, this)
        carView.iv_img.setImageResource(R.mipmap.icon_car)
        carView.tv_hint.gone()
        return carView
    }
@@ -636,17 +673,6 @@
        }
    }
    fun getTance(startLatLng: LatLng, endLatLng: LatLng, onclick: (tance: Float) -> Unit) {
        AMapKit.initRouteLine(
            this,
            startLatLng,
            endLatLng,
            object : (MutableList<LatLng>, Float, Long) -> Unit {
                override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) {
                    onclick(p2)
                }
            })
    }
    override fun setOnclick() {
@@ -661,11 +687,11 @@
    override fun onEventMainThread(event: BaseEvent?) {
        super.onEventMainThread(event)
        when (event!!.code) {
            BaseEvent.REAGASSIGN_SUCCESS -> {
                MyApplication.currentOrderId = ""
                MyApplication.currentOrderType = ""
                finish()
            }
//            BaseEvent.REAGASSIGN_SUCCESS -> {
//                MyApplication.currentOrderId = ""
//                MyApplication.currentOrderType = ""
//                finish()
//            }
            BaseEvent.UP_TRIP -> {
                callOrder()
            }