32 lines
917 B
Kotlin
32 lines
917 B
Kotlin
package com.sw.platecabinet.fragment
|
|
|
|
import android.os.CountDownTimer
|
|
import com.sw.platecabinet.Constants
|
|
import com.sw.platecabinet.member.databinding.FragmentPlateCabinetFullBinding
|
|
import timber.log.Timber
|
|
|
|
/**
|
|
* 餐盘柜已满
|
|
*/
|
|
class PlateCabinetFullFragment :
|
|
BaseFragment<FragmentPlateCabinetFullBinding>(FragmentPlateCabinetFullBinding::inflate) {
|
|
private var totalTimeInMillis: Long = Constants.AUTO_CLOSE_TIME * 1000
|
|
|
|
override fun initialize() {
|
|
Timber.d("initialize")
|
|
initCountTime()
|
|
}
|
|
|
|
fun initCountTime() {
|
|
object : CountDownTimer(totalTimeInMillis, 1000) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
binding.tvAutoClose.text = "${(millisUntilFinished / 1000).toInt() + 1}秒后返回主屏"
|
|
}
|
|
|
|
override fun onFinish() {
|
|
activity?.finish()
|
|
}
|
|
}.start()
|
|
}
|
|
|
|
} |