From b1d822d6272dc33928586ffa18b9ed3247f32522 Mon Sep 17 00:00:00 2001 From: lmw <125975490@qq.com> Date: 星期五, 07 六月 2024 14:48:20 +0800 Subject: [PATCH] 修改部分bug --- app/src/main/java/com/future/driver/ui/main/TripActivity.kt | 82 ++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/com/future/driver/ui/main/TripActivity.kt b/app/src/main/java/com/future/driver/ui/main/TripActivity.kt index 3c6eeb3..b456260 100644 --- a/app/src/main/java/com/future/driver/ui/main/TripActivity.kt +++ b/app/src/main/java/com/future/driver/ui/main/TripActivity.kt @@ -102,9 +102,9 @@ MyApplication.addOrderView(object : MyApplication.OrderStatueView { override fun orderInfo(data: OrderSimpleData?) { data?.let { - when(it.orderType){ - 1,2,3 -> { - if (it.status == 10 || it.status == 12) { + when (it.orderType) { + 1, 2, 3,7 -> { + if ((it.status == 10 || it.status == 12)&&MyApplication.currentOrderId.isNotEmpty()&&it.orderId.toString() == orderId) { Handler(Looper.getMainLooper()).post { toast("用户已取消订单") MyApplication.getTTsManager().setVideoText("用户已取消订单") @@ -171,7 +171,7 @@ "orderType" to orderType ) } else { - DialogUtil.getDelAndSureDialog( + val d = DialogUtil.getDelAndSureDialog( this, "现在改派将收取" + data.data.amount + "元改派费,您是否要进行改派?", {}, @@ -183,9 +183,9 @@ "money" to data.data.amount.toString() ) }) + val view = DialogUtil.getView(d) + view.tv_view_two_base.gravity = Gravity.CENTER } - - } } iv_move.setOnClickListener { @@ -198,9 +198,9 @@ moveCamera(aMap, carMarker!!.position) } 5, 6 -> { - if (endMarker == null){ + if (endMarker == null) { moveCamera(aMap, carMarker!!.position) - }else{ + } else { moveCamera(aMap, carMarker!!.position, endMarker!!.position) } } @@ -230,9 +230,9 @@ } 5, 6 -> { - if (endMarker == null){ + if (endMarker == null) { toast("暂无终点") - }else{ + } else { startActivity<GPSNaviActivity>( "start" to carMarker!!.position, "end" to endMarker!!.position @@ -259,13 +259,13 @@ toast("只能在预约时间的半小时内出行") return@let } - if (it.data.orderState == 4&& !rxPermissions.isGranted(Manifest.permission.RECORD_AUDIO)&& !rxPermissions.isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE)){ + if (it.data.orderState == 4&& (!rxPermissions.isGranted(Manifest.permission.RECORD_AUDIO) || !rxPermissions.isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE))){ DialogUtil.getDelAndSureDialog(this,"去授权","取消","根据平台规则,为了保证司乘安全,我们将会对行程进行录音,因此需要获取录音和文件存储权限",{ }){ rxPermissions.request(Manifest.permission.RECORD_AUDIO,Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe { if (it){ - }else{ + } else { toast("请前往应用设置页面打开录音和文件存储权限") } } @@ -273,17 +273,27 @@ return@let } if (it.data.endAddress.isNullOrEmpty()&&it.data.orderState == 4){ - DialogUtil.getDelAndSureDialog(this,"去填写","取消","乘客未填写目的地,请代乘客填写目的地后开始行程",{ - }){ + val delAndSureDialog = DialogUtil.getDelAndSureDialog( + this, + "去填写", + "取消", + "乘客未填写目的地,请代乘客填写目的地后开始行程", + { + }) { byChangeEnd = true - startActivity<SearchSiteActivity>("currentCityName" to (MyApplication.aMapLocation?.city?:""),"type" to "3") + startActivity<SearchSiteActivity>( + "currentCityName" to (MyApplication.aMapLocation?.city ?: ""), + "type" to "3" + ) } + val view = DialogUtil.getView(delAndSureDialog) + view.tv_view_two_base.gravity = Gravity.CENTER return@let } it.data.orderState++ - callStatue(it.data.orderState,{ + callStatue(it.data.orderState, { showStatueMapUI(it) - if (it.data.orderState == 5){ + if (it.data.orderState == 5) { showRecordDialog() } }) { @@ -292,12 +302,12 @@ } 5, 6 -> { it.data.orderState = 6 - when(orderType){ + when (orderType) { "2" -> { showMoneyTypeDialog() } - "1" -> { - callStatue(6,{ + "1","7" -> { + callStatue(6, { startActivity<MajorSureMoneyActivity>( "orderId" to orderId, "orderType" to orderType @@ -331,7 +341,7 @@ view.tv_view_two_base.gravity = Gravity.CENTER view.view_hint_close_base.visibility = View.INVISIBLE view.tv_count_timer.visible() - val timer = object:CountDownTimer(3000,1000){ + val timer = object:CountDownTimer(3000, 1000){ override fun onTick(millisUntilFinished: Long) { view.tv_count_timer.text = "${(millisUntilFinished/1000)+1}S" } @@ -343,6 +353,7 @@ onlySureDialog.setOnDismissListener { timer.cancel() } + EventBus.getDefault().post(BaseEvent(BaseEvent.START_RECORD)) } private fun callStatue(i: Int, click: () -> Unit, clickFail: () -> Unit) { @@ -352,7 +363,7 @@ map["state"] = i map["lat"] = MyApplication.getLocation().latitude map["lon"] = MyApplication.getLocation().longitude - callNet(Api.process, map,{ + callNet(Api.process, map, { click() }) { clickFail() @@ -370,7 +381,7 @@ pop.contentView.tv_ok.setOnClickListener { pop.dismiss() if (payType == 1) { - callStatue(6,{ + callStatue(6, { startActivity<FillOutActivity>("orderId" to orderId, "orderType" to orderType) finish() }) { @@ -383,7 +394,7 @@ map["orderId"] = orderId map["orderType"] = orderType map["type"] = payType - callStatue(6,{ + callStatue(6, { callNet(Api.confirmFees, map) { finish() startActivity<OrderOverActivity>( @@ -484,6 +495,8 @@ private fun callOrder() { MyApplication.currentOrderId = orderId MyApplication.currentOrderType = orderType + MyApplication.recordOrderId = orderId + MyApplication.recordOrderType = orderType var map = getMapByAny() map["orderId"] = orderId map["orderType"] = orderType @@ -506,7 +519,7 @@ tv_end_address.text = it.data.endAddress tv_change_end.gone() } - if (orderType == "1"){ + if (orderType == "1"||orderType == "7"){ tv_red_money.gone() } tv_red_money.text = it.data.tipMoney.toString() + "元红包" @@ -532,7 +545,7 @@ view.iv_img.setImageResource(R.mipmap.end_point) endMarker = addMarker(aMap, it.data.endLat, it.data.endLon, view, "") }else if (endMarker?.position?.latitude == 0.0){ - endMarker?.position = LatLng(orderBean.data.endLat,orderBean.data.endLon) + endMarker?.position = LatLng(orderBean.data.endLat, orderBean.data.endLon) } endMarker?.isVisible = false if (carMarker == null) { @@ -572,7 +585,7 @@ val carView = createView(R.layout.item_map_market, this) carView.iv_img.setImageResource(R.mipmap.car_trip) carView.tv_hint.visible() - carView.tv_hint.setColorBuild(this,content,R.color.main_yellow_qia,4,content.length) + carView.tv_hint.setColorBuild(this, content, R.color.main_yellow_qia, 4, content.length) return carView } @@ -582,7 +595,7 @@ tv_Right.visible() when (it.data.orderState) { 2, 3 -> { - if (it.data.reassign == 1){ + if (it.data.reassign == 1) { tv_Right.gone() } iv_to_gd.visible() @@ -600,7 +613,7 @@ } 4 -> { iv_to_gd.gone() - if (it.data.reassign == 1){ + if (it.data.reassign == 1) { tv_Right.gone() } closeLine() @@ -625,6 +638,9 @@ changeCarFive(true) setTitleText("服务中") slide_btn.changeButtonText("送达该乘客") + if (!MyApplication.isRecording){ + EventBus.getDefault().post(BaseEvent(BaseEvent.START_RECORD)) + } } } } @@ -717,17 +733,17 @@ mapByAny["lon"] = lon mapByAny["endAddress"] = name mapByAny["orderId"] = orderId - callNet(Api.setEnd,mapByAny){ + callNet(Api.setEnd, mapByAny) { orderBean.data.endAddress = name orderBean.data.endLat = lat orderBean.data.endLon = lon tv_end_address.text = name tv_change_end.gone() - if (byChangeEnd){ + if (byChangeEnd) { orderBean.data.orderState++ - callStatue(orderBean.data.orderState,{ - showStatueMapUI(orderBean) + callStatue(orderBean.data.orderState, { showRecordDialog() + showStatueMapUI(orderBean) }) { orderBean.data.orderState-- } -- Gitblit v1.7.1