liugl
2020-07-15 431ee316c05208b787befbd7b0b4097abe999c3f
app/src/main/java/com/okgoincar/slab/SlabGetOrderFragment.kt
@@ -34,27 +34,43 @@
        intent?.getStringExtra("orderType")
    }
    val timeDown by lazy {
        intent?.getIntExtra("time",-1)
    }
    val type by lazy {
        intent?.getIntExtra("type",-1)
    }
    lateinit var time: CountDownTimer
    @SuppressLint("SourceLockedOrientationActivity")
    @SuppressLint("SourceLockedOrientationActivity", "SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //设置竖屏显示
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        callOrderDetail()
        time = timeOver {
        var strBtn = "抢单"
        if (type == 2){
            strBtn = "确定"
        }
        time = timeOver ((timeDown!!.toLong() * 1000L)){
            if (it == 0) {
                finish()
            } else {
                tv_sure.text = "抢单" + it.toString() + "秒"
                tv_sure.text = strBtn + it.toString() + "秒"
            }
        }
        tv_close.clickDelay {
            finish()
        }
        tv_sure.clickDelay {
            if (type == 1){
            showGetOrder()
            }else if (type == 2){
                onBackPressed()
                this.startActivity<SlabTripActivity>("orderId" to orderId, "orderType" to orderType)
            }
        }
        setblack(getNowTimeBlack())
    }