From 59a89da95e7627c87dd01f00226d49104d1a93f3 Mon Sep 17 00:00:00 2001 From: liugl <liugl@sinata.cn> Date: 星期二, 10 十一月 2020 16:03:03 +0800 Subject: [PATCH] 11.10 添加线上线下标记 , 修改结束流程 --- app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt | 155 +++++++++++++++++++++++++++------------------------ 1 files changed, 81 insertions(+), 74 deletions(-) diff --git a/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt b/app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt index c7b5512..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,8 +103,24 @@ } } + + 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() + "次乘车" @@ -145,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 @@ -235,6 +213,7 @@ tv_to_main.visible() MyApplication.getTTsManager() .setVideoText("乘客已支付" + orderBean.data?.orderMoney.toString() + "元") + time?.cancel() time = timeOver(20000) { tv_title_slab.text = "已完成($it)" if (it == 0) { @@ -242,7 +221,7 @@ time!!.cancel() } try { - onBackPressed() + finish() } catch (e: Exception) { } } @@ -287,35 +266,12 @@ } tv_complete.clickDelay { - callComplete() { - tv_complete.gone() - tv_to_main.visible() - 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) { @@ -328,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