添加了界面及逻辑
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.sw.platecabinet.fragment
|
||||
|
||||
import android.os.CountDownTimer
|
||||
import com.sw.platecabinet.databinding.FragmentPlateOpenBinding
|
||||
|
||||
/**
|
||||
* 餐盘柜打开界面
|
||||
*/
|
||||
class PlateOpenFragment :
|
||||
BaseFragment<FragmentPlateOpenBinding>(FragmentPlateOpenBinding::inflate) {
|
||||
private var totalTimeInMillis: Long = 5 * 1000
|
||||
|
||||
override fun initialize() {
|
||||
initCountTime()
|
||||
}
|
||||
|
||||
fun initCountTime() {
|
||||
object : CountDownTimer(totalTimeInMillis, 1000) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
binding.tvAutoClose.text = (millisUntilFinished / 1000).toInt().toString()
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
activity?.finish()
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user