package com.fanghua.driver.ui.main
|
|
import android.content.Intent
|
import android.os.Bundle
|
import android.os.CountDownTimer
|
import android.os.Handler
|
import android.os.Looper
|
import cn.sinata.xldutils.utils.*
|
import com.amap.api.maps.AMap
|
import com.amap.api.maps.model.*
|
import com.amap.api.navi.AmapNaviPage
|
import com.amap.api.navi.AmapNaviParams
|
import com.amap.api.navi.AmapNaviType
|
import com.amap.api.navi.AmapPageType
|
import com.google.gson.Gson
|
import com.fanghua.driver.R
|
import com.fanghua.driver.base.BaseEvent
|
import com.fanghua.driver.base.MyApplication
|
import com.fanghua.driver.base.MyBaseActivity
|
import com.fanghua.driver.base.gaode.AMapKit
|
import com.fanghua.driver.base.gaode.AMapKit.addMarker
|
import com.fanghua.driver.base.gaode.AMapKit.initMap
|
import com.fanghua.driver.base.gaode.AMapKit.moveCamera
|
import com.fanghua.driver.netUtls.*
|
import com.fanghua.driver.ui.DialogUtil
|
import com.fanghua.driver.bean.*
|
import com.fanghua.driver.bean.BaseBean
|
import com.fanghua.driver.ui.main.add_order.SearchSiteActivity
|
import com.fanghua.driver.ui.main.major.MajorSureMoneyActivity
|
import com.fanghua.driver.utils.checkPermission
|
import kotlinx.android.synthetic.main.activity_trip.*
|
import kotlinx.android.synthetic.main.layout_maker_text.view.*
|
import kotlinx.android.synthetic.main.layout_start_maker.view.*
|
import kotlinx.android.synthetic.main.layout_start_maker.view.tv_info
|
import org.greenrobot.eventbus.EventBus
|
import org.jetbrains.anko.startActivity
|
import org.jetbrains.anko.startActivityForResult
|
import org.jetbrains.anko.toast
|
|
|
class TripActivity : MyBaseActivity() {
|
|
/***
|
* // 流程操作状态(3=开始出发预约点,4=到达预约点,5=开始服务,6=服务结束)
|
* 页面一共4个marker 1:预约地点 2:起点 3终点 4:司机点
|
*/
|
|
private val orderId by lazy {
|
intent.getStringExtra("orderId") ?: "0"
|
}
|
private val countDown by lazy { //抢单倒计时,不为0 则开启倒计时
|
intent.getIntExtra("countDown", 0)
|
}
|
|
var startMarker: Marker? = null
|
var endMarker: Marker? = null
|
var markerLine: Polyline? = null
|
lateinit var aMap: AMap
|
private var orderBean: OrderBean? = null
|
|
private var countDownTimer: CountDownTimer? = null//抢单倒计时(10s)
|
|
private var toNavigation = false //true:105状态需要触发自动跳转导航页
|
|
override fun setContentView() {
|
setContentView(R.layout.activity_trip)
|
}
|
|
override fun initView() {
|
setTitleText("芳华代驾")
|
callOrder()
|
addSockectCancel()
|
MyApplication.getInstance()!!.initUpPoint()
|
}
|
|
private fun addSockectCancel() {
|
MyApplication.addOrderView(object : MyApplication.OrderStatueView {
|
override fun orderInfo(data: OrderSimpleData?) {
|
data?.let {
|
if (it.id == orderId) {
|
if (it.status == 301) {
|
Handler(Looper.getMainLooper()).post {
|
toast("用户已取消订单")
|
MyApplication.getTTsManager().setVideoText("用户已取消订单")
|
MyApplication.currentOrderId = ""
|
MyApplication.finishRecord()
|
finish()
|
}
|
}
|
if (it.status == 401 || it.status == 105 || it.status == 104) {
|
// tv_money.text = "%.2f元".format(orderBean!!.estimatedPrice) //todo 蒲志兵说先不实时显示费用
|
tv_length.text = "%s公里".format(it.actualMileage)
|
tv_waiting.text = "%s分钟".format(it.waitTime)
|
tv_duration.text = "%s分钟".format(it.travelTime)
|
if (it.endAddress.isNotEmpty()){
|
AmapNaviPage.getInstance().exitRouteActivity()
|
// toNavigation = true
|
callOrder()
|
MyApplication.getTTsManager().setVideoText("请注意,用户已修改终点")
|
}
|
}
|
}
|
}
|
}
|
})
|
}
|
|
|
override fun onBackPressed() {
|
EventBus.getDefault().post(BaseEvent(BaseEvent.UPDATA_MAIN_CAR))
|
super.onBackPressed()
|
}
|
|
override fun finish() {
|
EventBus.getDefault().post(BaseEvent(BaseEvent.UPDATA_MAIN_CAR))
|
super.finish()
|
}
|
|
|
private fun callStatue(i: Int, click: () -> Unit, clickFail: () -> Unit) {
|
var map = getMapByAny()
|
map["orderId"] = orderId
|
map["state"] = i
|
map["endLat"] = MyApplication.getLocation().latitude
|
map["endLng"] = MyApplication.getLocation().longitude
|
map["endAddress"] = MyApplication.getLocation().address
|
callNet(Api.process, map, {
|
val bean = Gson().fromJson(it, BaseBean::class.java)
|
if (bean.resultUtil.code == 10000)
|
click()
|
else
|
clickFail()
|
}) {
|
clickFail()
|
}
|
}
|
|
|
/**
|
* 起点到终点规划
|
*/
|
private fun drawLineAll() {
|
if (startMarker != null && endMarker != null) {
|
AMapKit.initRouteLine(
|
this, true,
|
startMarker!!.position,
|
endMarker!!.position,
|
object : (MutableList<LatLng>, Float, Long) -> Unit {
|
override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) {
|
addline(p1)
|
}
|
})
|
}
|
}
|
|
/**
|
* 司机到起点规划
|
*/
|
private fun drawLineStart() {
|
AMapKit.initRouteLine(
|
this, false,
|
LatLng(MyApplication.aMapLocation!!.latitude, MyApplication.aMapLocation!!.longitude),
|
startMarker!!.position,
|
object : (MutableList<LatLng>, Float, Long) -> Unit {
|
override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) {
|
addline(p1)
|
showMarker2(p2)
|
}
|
})
|
}
|
|
/**
|
* 起点到司机规划
|
*/
|
private fun drawLineStart2() {
|
if (MyApplication.aMapLocation!=null)
|
AMapKit.initRouteLine(
|
this, false,
|
startMarker!!.position,
|
LatLng(MyApplication.aMapLocation!!.latitude, MyApplication.aMapLocation!!.longitude),
|
object : (MutableList<LatLng>, Float, Long) -> Unit {
|
override fun invoke(p1: MutableList<LatLng>, p2: Float, p3: Long) {
|
addline(p1)
|
}
|
})
|
}
|
|
|
private fun callOrder() {
|
var map = getMapByAny()
|
map["orderId"] = orderId
|
callNet(Api.queryOrderInfo, map) {
|
val resultUtil = gson.fromJson(it, OrderDetailBean::class.java).resultUtil
|
if (resultUtil.code == 10000) {
|
orderBean = resultUtil.data
|
showUi()
|
} else
|
toast(resultUtil.msg)
|
}
|
}
|
|
private fun showUi() {
|
orderBean?.apply {
|
//公共UI
|
iv_avatar.setImageURI(avatar)
|
tv_phone.text = StringUtils.hidePhoneNumber(userPhone)
|
tv_distance.text =
|
if (currentDistance > 100) "距你约%.1f公里".format(currentDistance / 1000) else "距你约%d米".format(
|
currentDistance.toInt()
|
)
|
tv_time.text = TimeUtils.getTripTime(createTime)
|
tv_start.text = startAddress
|
tv_end.text = if (endAddress.isNullOrEmpty()) "未填写" else endAddress
|
tv_creator.text = getCreator()
|
if (source == 1) { //用户创建
|
tv_order_count.apply {
|
visible()
|
text = "下单%d次".format(orderTimes)
|
}
|
tv_cancel_count.apply {
|
visible()
|
text = "取消%d次".format(cancelTimes)
|
}
|
tv_balance.apply {
|
visible()
|
text = "余额:%.2f".format(balance)
|
}
|
} else {//司机或后台
|
tv_order_count.gone()
|
tv_cancel_count.gone()
|
tv_balance.gone()
|
}
|
}
|
showStatusUI()
|
}
|
|
|
/**
|
* 根据不同状态显示地图标记
|
*/
|
private fun showMarker1() {
|
val view = createView(R.layout.layout_start_maker, this)
|
view.tv_info.text = "%d分钟|预计接驾".format(orderBean!!.orderTimes)
|
view.tv_name.text = orderBean!!.startAddress
|
startMarker = addMarker(aMap, orderBean!!.startLat, orderBean!!.startLng, view)
|
if (!orderBean?.endAddress.isNullOrEmpty()) {
|
val view1 = createView(R.layout.layout_maker_text, this)
|
val content = "%s\n全程%d公里,约行驶%s分钟".format(
|
orderBean!!.endAddress,
|
orderBean!!.estimatedMileage.toDouble().toInt(),
|
orderBean!!.estimatedTime
|
)
|
view1.tv_info.text = SpanBuilder.content(content)
|
.sizeSpan(orderBean!!.endAddress.length, content.length, 10)
|
.colorSpan(
|
this,
|
orderBean!!.endAddress.length,
|
content.length,
|
R.color.textColorHint
|
).build()
|
endMarker =
|
addMarker(aMap, orderBean!!.endLat.toDouble(), orderBean!!.endLng.toDouble(), view1)
|
}
|
}
|
|
private fun showMarker2(distance: Float) {
|
val view = createView(R.layout.layout_maker_text, this)
|
view.tv_info.text =
|
if (distance > 100) "距预约点%.1f公里".format(distance / 1000) else "距预约点%d米".format(distance.toInt())
|
view.iv_image.setImageResource(R.mipmap.start)
|
if (startMarker == null)
|
startMarker = addMarker(aMap, orderBean!!.startLat, orderBean!!.startLng, view)
|
else {
|
startMarker?.setIcon(BitmapDescriptorFactory.fromView(view))
|
}
|
endMarker?.remove()
|
}
|
|
private fun showMarker3() {
|
val view = createView(R.layout.layout_maker_text, this)
|
view.tv_info.gone()
|
view.iv_image.setImageResource(R.mipmap.start)
|
if (startMarker == null)
|
startMarker = addMarker(aMap, orderBean!!.startLat, orderBean!!.startLng, view)
|
else {
|
startMarker?.setIcon(BitmapDescriptorFactory.fromView(view))
|
}
|
endMarker?.remove()
|
}
|
|
private fun showMarker4() {
|
val view = createView(R.layout.layout_start_maker, this)
|
view.ll_info.gone()
|
if (startMarker == null)
|
startMarker = addMarker(aMap, orderBean!!.startLat, orderBean!!.startLng, view)
|
else
|
startMarker?.setIcon(BitmapDescriptorFactory.fromView(view))
|
|
if (!orderBean?.endAddress.isNullOrEmpty()) {
|
val view1 = createView(R.layout.layout_maker_text, this)
|
view1.tv_info.gone()
|
if (endMarker == null)
|
endMarker = addMarker(
|
aMap,
|
orderBean!!.endLat.toDouble(),
|
orderBean!!.endLng.toDouble(),
|
view1
|
)
|
else {
|
endMarker?.setIcon(BitmapDescriptorFactory.fromView(view1))
|
endMarker?.position =
|
LatLng(orderBean!!.endLat.toDouble(), orderBean!!.endLng.toDouble())
|
}
|
}
|
}
|
|
|
private fun showStatusUI() {
|
iv_nav.gone()
|
if (orderBean?.state ?: 0 > 101&&orderBean?.state?:0!=201) {
|
MyApplication.currentOrderId = orderId
|
tv_action.gone()
|
slide_btn.visible()
|
tv_record.visible()
|
iv_record.visible()
|
tv_order_count.gone()
|
tv_cancel_count.gone()
|
iv_call.visible()
|
tv_more.visible()
|
}
|
if (orderBean?.state?:0 > 140&&orderBean?.state?:0!=201)
|
MyApplication.startRecord()
|
when (orderBean?.state) { //订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)
|
101,201 -> {
|
showMarker1()
|
if (countDown == 0)
|
tv_action.text = "抢单"
|
else {
|
countDownTimer = object : CountDownTimer(countDown.toLong() * 1000, 1000) {
|
override fun onTick(millisUntilFinished: Long) {
|
tv_action.text = "接单(${(millisUntilFinished / 1000) + 1})"
|
}
|
|
override fun onFinish() {
|
val mapByAny = getMapByAny()
|
mapByAny["orderId"] = orderId
|
callNet(Api.rejectionOrder, mapByAny, {
|
finish()
|
}) {
|
finish()
|
}
|
}
|
}.start()
|
}
|
if (endMarker != null) {//有终点
|
moveCamera(aMap, startMarker!!.position, endMarker!!.position)
|
drawLineAll()
|
tv_money.text = "%.2f元".format(orderBean!!.estimatedPrice)
|
tv_length.text = "%d公里".format(orderBean!!.estimatedMileage.toDouble().toInt())
|
} else {
|
line1.gone()
|
tv_length.gone()
|
tv_2.gone()
|
tv_1.text = "起步价"
|
tv_money.text = "%.2f元".format(orderBean!!.startPrice)
|
moveCamera(aMap, startMarker!!.position)
|
}
|
}
|
102, 103 -> {
|
showMarker2(orderBean!!.currentDistance.toFloat())
|
line1.gone()
|
tv_length.gone()
|
tv_2.gone()
|
if (!orderBean?.endAddress.isNullOrEmpty()) {//有终点
|
tv_money.text = "%.2f元".format(orderBean!!.estimatedPrice)
|
} else {
|
tv_1.text = "起步价"
|
tv_money.text = "%.2f元".format(orderBean!!.startPrice)
|
}
|
if (MyApplication.aMapLocation!=null)
|
moveCamera(
|
aMap,
|
startMarker!!.position,
|
LatLng(
|
MyApplication.aMapLocation!!.latitude,
|
MyApplication.aMapLocation!!.longitude
|
)
|
)
|
drawLineStart()
|
if (orderBean?.state == 103) {
|
iv_nav.visible()
|
slide_btn.changeButtonText("到达预约地点")
|
countDownTimer =
|
object : CountDownTimer(24 * 60 * 60 * 1000, 5000) { //接驾途中,每5秒规划一次路径
|
override fun onTick(millisUntilFinished: Long) {
|
if (MyApplication.aMapLocation!=null)
|
moveCamera(
|
aMap,
|
startMarker!!.position,
|
LatLng(
|
MyApplication.aMapLocation!!.latitude,
|
MyApplication.aMapLocation!!.longitude
|
)
|
)
|
drawLineStart()
|
}
|
|
override fun onFinish() {
|
}
|
}.start()
|
}
|
}
|
104 -> {
|
showMarker3()
|
countDownTimer?.cancel()
|
slide_btn.changeButtonText("开始服务")
|
line1.visible()
|
tv_length.visible()
|
tv_2.visible()
|
line2.visible()
|
tv_waiting.visible()
|
tv_3.visible()
|
line3.visible()
|
tv_duration.visible()
|
tv_4.visible()
|
//菜单项显示等待按钮
|
tv_wait.visible()
|
divider_3.visible()
|
tv_end.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
R.mipmap.icon_end_point,
|
0,
|
R.mipmap.more_black,
|
0
|
)
|
//订单动态数据渲染
|
tv_1.text = "预估费用"
|
tv_money.text = "%.2f元".format(orderBean!!.estimatedPrice)
|
tv_length.text = "%s公里".format(orderBean!!.actualMileage)
|
tv_waiting.text = "%s分钟".format(orderBean!!.waitTime)
|
tv_duration.text = "%s分钟".format(orderBean!!.travelTime)
|
closeLine()
|
}
|
105, 401 -> {
|
showMarker4()
|
slide_btn.changeButtonText("到达目的地")
|
line1.visible()
|
tv_length.visible()
|
tv_2.visible()
|
line2.visible()
|
tv_waiting.visible()
|
tv_3.visible()
|
line3.visible()
|
tv_duration.visible()
|
tv_4.visible()
|
//菜单项只显示追加和等待按钮
|
tv_cancel.gone()
|
divider_1.gone()
|
tv_reassignment.gone()
|
divider_2.gone()
|
tv_wait.visible()
|
divider_3.visible()
|
tv_end.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
R.mipmap.icon_end_point,
|
0,
|
R.mipmap.more_black,
|
0
|
)
|
//订单动态数据渲染
|
tv_1.text = "预估费用"
|
tv_money.text = "%.2f元".format(orderBean!!.estimatedPrice)
|
tv_length.text = "%s公里".format(orderBean!!.actualMileage)
|
tv_waiting.text = "%s分钟".format(orderBean!!.waitTime)
|
tv_duration.text = "%s分钟".format(orderBean!!.travelTime)
|
if (endMarker != null) {//有终点
|
iv_nav.visible() //温秋红:有终点才显示导航按钮
|
moveCamera(aMap, startMarker!!.position, endMarker!!.position)
|
drawLineAll()
|
} else {
|
if (MyApplication.aMapLocation!=null)
|
moveCamera(
|
aMap,
|
startMarker!!.position,
|
LatLng(
|
MyApplication.aMapLocation!!.latitude,
|
MyApplication.aMapLocation!!.longitude
|
)
|
)
|
drawLineStart2()
|
}
|
if (orderBean?.state == 401) {
|
slide_btn.changeButtonText("开始服务")
|
}
|
if (orderBean?.state == 105&&toNavigation) {
|
iv_nav.callOnClick()
|
toNavigation = false
|
}
|
}
|
106, 107 -> {
|
startActivity<MajorSureMoneyActivity>("orderId" to orderId)
|
finish()
|
}
|
}
|
}
|
|
|
override fun onDestroy() {
|
super.onDestroy()
|
map_view.onDestroy()
|
countDownTimer?.cancel()
|
}
|
|
|
private fun addline(allLine: MutableList<LatLng>) {
|
closeLine()
|
markerLine = AMapKit.drawLine(this, aMap, allLine)
|
}
|
|
fun closeLine() {
|
if (markerLine != null) {
|
markerLine!!.remove()
|
}
|
}
|
|
|
override fun setOnclick() {
|
tv_action.setOnClickListener {
|
if (checkPermission()){
|
val map = getMapByAny()
|
map["orderId"] = orderId
|
callNet(Api.grabOrder, map) {
|
val bean = Gson().fromJson<BaseBean>(it, BaseBean::class.java)
|
if (bean.resultUtil.code == 10000) {
|
toast(if (tv_action.text == "抢单") "抢单成功" else "接单成功")
|
countDownTimer?.cancel()
|
orderBean!!.state = 102
|
showStatusUI()
|
} else
|
toast(bean.resultUtil.msg)
|
}
|
}
|
}
|
|
tv_end.setOnClickListener {
|
if (orderBean?.state ?: 0 > 103&&orderBean?.state?:0!=201)
|
startActivityForResult<SearchSiteActivity>(1, "type" to "2")
|
}
|
|
slide_btn.onSwipeListener = {
|
orderBean?.let {
|
when (it.state) {//101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)
|
102, 103, 104, 105 -> {
|
callStatue(++it.state, {
|
if (it.state == 105&&!it.endLat.isNullOrEmpty())
|
toNavigation = true
|
when (it.state) {
|
104, 105 -> callOrder()
|
106 -> {
|
MyApplication.currentOrderId = ""
|
MyApplication.finishRecord()
|
startActivity<MajorSureMoneyActivity>("orderId" to orderId)
|
finish()
|
}
|
else -> showStatusUI()
|
}
|
if (it.state == 103)
|
iv_nav.callOnClick()
|
}) {
|
it.state--
|
}
|
}
|
401 -> {
|
callStatue(105, {
|
it.state = 105
|
showStatusUI()
|
}) {
|
}
|
}
|
}
|
}
|
}
|
|
tv_Right.clickDelay {
|
var map = getMapByAny()
|
map["orderId"] = orderId
|
callNet(Api.queryReassignMoney, map) {
|
val data = gson.fromJson<RessignBean>(it, RessignBean::class.java)
|
if (data.data.amount.isNullOrEmpty()) {
|
startActivity<ReassignActivity>(
|
"orderId" to orderId
|
)
|
} else {
|
DialogUtil.getDelAndSureDialog(
|
this,
|
"现在改派将收取" + data.data.amount + "元改派费,您是否要进行改派?",
|
{},
|
{
|
//跳转改派页面
|
startActivity<ReassignActivity>(
|
"orderId" to orderId,
|
"money" to data.data.amount.toString()
|
)
|
})
|
}
|
|
|
}
|
}
|
|
|
|
iv_move.setOnClickListener {
|
moveCamera(
|
aMap,
|
LatLng(
|
MyApplication.aMapLocation?.latitude ?: 0.0,
|
MyApplication.aMapLocation?.longitude ?: 0.0
|
)
|
)
|
}
|
|
|
iv_nav.setOnClickListener {
|
when (orderBean?.state) {
|
103 -> {
|
val params = AmapNaviParams(null,null, Poi(orderBean?.startAddress,startMarker?.position!!,""),AmapNaviType.RIDE,AmapPageType.NAVI)
|
params.setBroadcastMode(applicationContext,2)
|
params.isNeedDestroyDriveManagerInstanceWhenNaviExit = true
|
AmapNaviPage.getInstance().showRouteActivity(applicationContext, params, null)
|
}
|
|
105 -> {
|
val params = AmapNaviParams(null,null, Poi(orderBean?.endAddress,endMarker?.position!!,""),AmapNaviType.DRIVER,AmapPageType.NAVI)
|
params.setBroadcastMode(applicationContext,2)
|
params.isNeedDestroyDriveManagerInstanceWhenNaviExit = true
|
AmapNaviPage.getInstance().showRouteActivity(applicationContext, params, null)
|
}
|
}
|
|
}
|
|
|
iv_call.clickDelay {
|
Utils.callPhone(this, orderBean?.userPhone)
|
}
|
|
tv_more.clickDelay {
|
tv_more.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
0,
|
0,
|
R.mipmap.icon_arrow_close,
|
0
|
)
|
ll_pop.visible()
|
bg.visible()
|
}
|
|
tv_cancel.clickDelay {
|
startActivity<CancelActivity>("orderId" to orderId)
|
closeMenu()
|
}
|
|
tv_add.clickDelay {
|
startActivity<AddOrderActivity>()
|
closeMenu()
|
}
|
|
tv_reassignment.clickDelay {
|
val mapByAny = getMapByAny()
|
callNet(Api.queryTransferOrderConfig, mapByAny) {
|
val bean = Gson().fromJson(it, StringBean::class.java)
|
if (bean.resultUtil.code == 10000) {
|
DialogUtil.getDelAndSureDialog(
|
this,
|
"现在改派将${bean.resultUtil.data}分钟内不能上线,您是否要进行改派?",
|
{},
|
{
|
startActivity<ReassignActivity>("orderId" to orderId)
|
})
|
}
|
}
|
closeMenu()
|
}
|
|
tv_wait.clickDelay {
|
callStatue(401, {
|
orderBean!!.state = 401
|
showStatusUI()
|
}) {
|
}
|
closeMenu()
|
}
|
|
bg.clickDelay {
|
closeMenu()
|
}
|
}
|
|
private fun closeMenu() {
|
tv_more.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
0,
|
0,
|
R.mipmap.icon_arrow_open_black,
|
0
|
)
|
ll_pop.gone()
|
bg.gone()
|
}
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
super.onCreate(savedInstanceState)
|
aMap = initMap(savedInstanceState, map_view)
|
}
|
|
override fun onEventMainThread(event: BaseEvent?) {
|
super.onEventMainThread(event)
|
when (event!!.code) {
|
BaseEvent.BACK_CAR_OVER -> {
|
finish()
|
}
|
}
|
}
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
super.onActivityResult(requestCode, resultCode, data)
|
if (resultCode == RESULT_OK && data != null) {
|
val map = getMapByAny()
|
map["orderId"] = orderId
|
map["endLat"] = data.getDoubleExtra("lat", 0.0)
|
map["endLng"] = data.getDoubleExtra("lon", 0.0)
|
map["endAddress"] = data.getStringExtra("name")
|
callNet(Api.setOrderEndAddress, map) {
|
val bean = Gson().fromJson(it, BaseBean::class.java)
|
if (bean.resultUtil.code == 10000) {
|
callOrder()
|
} else
|
toast(bean.resultUtil.msg)
|
}
|
}
|
}
|
}
|