From 16d807930e47fcab5a7e773046daad78e04849e2 Mon Sep 17 00:00:00 2001 From: liugl <liugl@sinata.cn> Date: 星期三, 18 十一月 2020 14:52:43 +0800 Subject: [PATCH] 11.11 修改bug2个 --- app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt | 157 ++++++++++++++++++++++++++++------------------------ 1 files changed, 84 insertions(+), 73 deletions(-) diff --git a/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt b/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt index 35dc565..0334f5e 100644 --- a/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt +++ b/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt @@ -92,7 +92,6 @@ } override fun initView() { - var map = getMapByAny() map["orderId"] = orderId map["orderType"] = orderType @@ -104,11 +103,28 @@ } } + + private fun showUi(orderBean: OrderBean?) { orderBean?.let { + MyApplication.getTTsManager() + .setVideoText("请确认乘客车内付款后,再点击返回首页") + time = timeOver(60000 * 6) { + tv_title_slab.text = "已完成($it)" + if (it == 0) { + if (time != null) { + time!!.cancel() + } + try { + finish() + } catch (e: Exception) { + } + } + } tv_title_slab.text = "待支付" tv_name.text = it.data.nickName tv_car_num.text = it.data.historyNum.toString() + "次乘车" + tv_phone.text = it.data.phone tv_phone.clickDelay { MyUtils.getInstans().CallPhone(this, it.data.phone.toString()) } @@ -144,51 +160,14 @@ } } - private fun addSocketLisener(orderBean: OrderBean?) { - MyApplication.addOrderView(object : MyApplication.OrderStatueView { - override fun orderInfo(data: OrderSimpleData?) { - data?.let { - if (it.status == 8 || it.status == 7) { - tv_pay_result_money.textColor( - this@SlabOrderOverActivity, - R.color.slab_green_over - ) - Handler(Looper.getMainLooper()).post { - if (isPlay) { - return@post - } - isPlay = true - MyApplication.getTTsManager() - .setVideoText("乘客已支付" + orderBean?.data?.orderMoney.toString() + "元") - time = timeOver(20000) { - tv_title_slab.text = "已完成($it)" - if (it == 0) { - if (time != null) { - time!!.cancel() - } - try { - onBackPressed() - } catch (e: Exception) { - } - } - } - } - -// android.os.Handler(Looper.getMainLooper()).post { -// orderBean.data.orderState = 8 -// showUi(orderBean) -// } - } - } + fun overOrder(){ + callComplete() { + Handler(Looper.getMainLooper()).post { + time?.cancel() + time?.onFinish() + finish() } - }) - -// if (handler == null) { -// handler = android.os.Handler(mainLooper) -// handler!!.postDelayed({ -// checkOrderStatue() -// }, 3000) -// } + } } var handler: Handler? = null @@ -230,8 +209,11 @@ return@post } isPlay = true + tv_complete.gone() + tv_to_main.visible() MyApplication.getTTsManager() .setVideoText("乘客已支付" + orderBean.data?.orderMoney.toString() + "元") + time?.cancel() time = timeOver(20000) { tv_title_slab.text = "已完成($it)" if (it == 0) { @@ -239,7 +221,7 @@ time!!.cancel() } try { - onBackPressed() + finish() } catch (e: Exception) { } } @@ -284,34 +266,12 @@ } tv_complete.clickDelay { - callComplete() { - tv_complete.gone() - tv_pay_result_money.textColor( - this@SlabOrderOverActivity, - R.color.slab_green_over - ) - Handler(Looper.getMainLooper()).post { - if (isPlay) { - return@post - } - isPlay = true - MyApplication.getTTsManager() - .setVideoText("乘客已支付" + orderBean.data?.orderMoney.toString() + "元") - time = timeOver(20000) { - tv_title_slab.text = "已完成($it)" - if (it == 0) { - if (time != null) { - time!!.cancel() - } - try { - onBackPressed() - } catch (e: Exception) { - } - } - } - } - } + overOrder() } + } + + override fun onBackPressed() { + overOrder() } private fun callComplete(function: () -> Unit) { @@ -324,4 +284,55 @@ } } + + + + private fun addSocketLisener(orderBean: OrderBean?) { + MyApplication.addOrderView(object : MyApplication.OrderStatueView { + override fun orderInfo(data: OrderSimpleData?) { + data?.let { + if (it.status == 8 || it.status == 7) { + tv_pay_result_money.textColor( + this@SlabOrderOverActivity, + R.color.slab_green_over + ) + Handler(Looper.getMainLooper()).post { + if (isPlay) { + return@post + } + isPlay = true + MyApplication.getTTsManager() + .setVideoText("乘客已支付" + orderBean?.data?.orderMoney.toString() + "元") + time = timeOver(20000) { + tv_title_slab.text = "已完成($it)" + if (it == 0) { + if (time != null) { + time!!.cancel() + } + try { + finish() + } catch (e: Exception) { + } + } + } + } + +// android.os.Handler(Looper.getMainLooper()).post { +// orderBean.data.orderState = 8 +// showUi(orderBean) +// } + } + } + } + }) + + +// if (handler == null) { +// handler = android.os.Handler(mainLooper) +// handler!!.postDelayed({ +// checkOrderStatue() +// }, 3000) +// } + } + } \ No newline at end of file -- Gitblit v1.7.1