liugl
2020-09-10 40a8a2c243c15fe8d4eb46f4dbc42a290bd0a63a
app/src/main/java/com/okgoincar/slab/SlabOrderOverActivity.kt
@@ -28,7 +28,7 @@
        intent.getStringExtra("orderId")
    }
    var time:CountDownTimer? = null
    var time: CountDownTimer? = null
    lateinit var orderBean: OrderBean
@@ -43,50 +43,50 @@
    override fun onPause() {
        super.onPause()
        if (time != null){
        if (time != null) {
            time!!.cancel()
        }
    }
    override fun setBlackMode(b: Boolean?) {
        super.setBlackMode(b)
        if(b!!){ //晚上
        if (b!!) { //晚上
            rl_main_bg.setBackgroundResource(R.color.black)
            ll_content_web.setBackgroundResource(R.drawable.bg_slab_main_8_black)
            ll_order_top.setBackgroundResource(R.drawable.bg_slab_main_8_black_bottom)
//            ll_pay_result.setBackgroundResource(R.drawable.bg_slab_main_8_shen_black)
            iv_back_slab.setImageResource(R.mipmap.icon_back_slab)
            tv_title_slab.textColor(this,R.color.write)
            tv_name.textColor(this,R.color.write)
            tv_car_num.textColor(this,R.color.write)
            tv_phone.textColor(this,R.color.write)
            tv_time.textColor(this,R.color.write)
            tv_title_slab.textColor(this, R.color.write)
            tv_name.textColor(this, R.color.write)
            tv_car_num.textColor(this, R.color.write)
            tv_phone.textColor(this, R.color.write)
            tv_time.textColor(this, R.color.write)
            tv_time.setDrawableLeft(R.mipmap.icon_time_gray)
            tv_start_address.textColor(this,R.color.write)
            tv_end_address.textColor(this,R.color.write)
            tv_red_money.textColor(this,R.color.write)
            tv_pay_result_title.textColor(this,R.color.write)
            tv_order_type.textColor(this,R.color.write)
            tv_hive_small_money.textColor(this,R.color.write)
            tv_start_address.textColor(this, R.color.write)
            tv_end_address.textColor(this, R.color.write)
            tv_red_money.textColor(this, R.color.write)
            tv_pay_result_title.textColor(this, R.color.write)
            tv_order_type.textColor(this, R.color.write)
            tv_hive_small_money.textColor(this, R.color.write)
            tv_phone.setDrawableLeft(R.mipmap.icon_dial_slab)
        }else{
        } else {
            rl_main_bg.setBackgroundResource(R.color.write)
            ll_content_web.setBackgroundResource(R.drawable.write_top_10)
            ll_order_top.setBackgroundResource(R.drawable.write_bottom_10)
//            ll_pay_result.setBackgroundResource(R.drawable.bg_white_round5)
            iv_back_slab.setImageResource(R.mipmap.icon_back_black)
            tv_title_slab.textColor(this,R.color.black)
            tv_name.textColor(this,R.color.black)
            tv_car_num.textColor(this,R.color.black)
            tv_phone.textColor(this,R.color.black)
            tv_time.textColor(this,R.color.black)
            tv_title_slab.textColor(this, R.color.black)
            tv_name.textColor(this, R.color.black)
            tv_car_num.textColor(this, R.color.black)
            tv_phone.textColor(this, R.color.black)
            tv_time.textColor(this, R.color.black)
            tv_time.setDrawableLeft(R.mipmap.icon_time_xiao)
            tv_start_address.textColor(this,R.color.black)
            tv_end_address.textColor(this,R.color.black)
            tv_red_money.textColor(this,R.color.black)
            tv_pay_result_title.textColor(this,R.color.black)
            tv_order_type.textColor(this,R.color.black)
            tv_hive_small_money.textColor(this,R.color.black)
            tv_start_address.textColor(this, R.color.black)
            tv_end_address.textColor(this, R.color.black)
            tv_red_money.textColor(this, R.color.black)
            tv_pay_result_title.textColor(this, R.color.black)
            tv_order_type.textColor(this, R.color.black)
            tv_hive_small_money.textColor(this, R.color.black)
            tv_phone.setDrawableLeft(R.mipmap.icon_dial)
        }
    }
@@ -148,18 +148,18 @@
        MyApplication.addOrderView(object : MyApplication.OrderStatueView {
            override fun orderInfo(data: OrderSimpleData?) {
                data?.let {
                    if (it.status == 8||it.status == 7) {
                    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)
                            {
                            if (isPlay) {
                                return@post
                            }
                            isPlay = true
                            MyApplication.getTTsManager().setVideoText("乘客已支付"+orderBean?.data?.orderMoney.toString()+"元")
                            MyApplication.getTTsManager()
                                .setVideoText("乘客已支付" + orderBean?.data?.orderMoney.toString() + "元")
                            time = timeOver(20000) {
                                tv_title_slab.text = "已完成($it)"
                                if (it == 0) {
@@ -204,20 +204,20 @@
        var map = getMapByAny()
//        map["orderId"] = orderId
//        map["orderType"] = orderType
        callNet(false,Api.orderStateSocket, map) {
        callNet(false, Api.orderStateSocket, map) {
            val orderSimpleData =
                Gson().fromJson(
                    it,
                    OrderStatueBean::class.java
                )
            orderSimpleData?.data?.let {
                var currentBean:OrderStatueBean.DataBean? = null
                for (item in it){
                    if (item.orderId ==orderBean.data?.orderId ){
                var currentBean: OrderStatueBean.DataBean? = null
                for (item in it) {
                    if (item.orderId == orderBean.data?.orderId) {
                        currentBean = item
                    }
                }
                if (it.size == 0 || currentBean == null){
                if (it.size == 0 || currentBean == null) {
                    return@callNet
                }
                if (currentBean.state == 8) {
@@ -226,12 +226,12 @@
                        R.color.slab_green_over
                    )
                    Handler(Looper.getMainLooper()).post {
                        if (isPlay)
                        {
                        if (isPlay) {
                            return@post
                        }
                        isPlay = true
                        MyApplication.getTTsManager().setVideoText("乘客已支付"+ orderBean.data?.orderMoney.toString()+"元")
                        MyApplication.getTTsManager()
                            .setVideoText("乘客已支付" + orderBean.data?.orderMoney.toString() + "元")
                        time = timeOver(20000) {
                            tv_title_slab.text = "已完成($it)"
                            if (it == 0) {
@@ -282,5 +282,46 @@
        tv_to_main.clickDelay {
            onBackPressed()
        }
        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) {
                            }
                        }
                    }
                }
            }
        }
    }
    private fun callComplete(function: () -> Unit) {
        var map = getMapByAny()
        map["orderId"] = orderId
        map["orderType"] = orderType
        callNet(Api.completeOrder,map,{
            function()
        }){
        }
    }
}