SwipeCodeTwoActivity.kt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. package xn.hxp.ui.verify
  2. import android.content.IntentFilter
  3. import android.hardware.usb.UsbManager
  4. import android.os.Handler
  5. import android.os.Looper
  6. import android.view.KeyEvent
  7. import android.view.MotionEvent
  8. import android.view.View
  9. import android.widget.TextView
  10. import androidx.viewbinding.ViewBinding
  11. import com.blankj.utilcode.util.LogUtils
  12. import com.bumptech.glide.Glide
  13. import com.bumptech.glide.load.engine.DiskCacheStrategy
  14. import com.bumptech.glide.request.RequestOptions
  15. import com.rc.core.ui.activity.BaseActivity
  16. import com.rc.httpcore.HttpConfig
  17. import com.rc.httpcore.bean.UserValidationBean
  18. import com.rc.httpcore.client.ApiRepository
  19. import com.rc.httpcore.exception.NetException
  20. import org.greenrobot.eventbus.EventBus
  21. import org.greenrobot.eventbus.Subscribe
  22. import org.greenrobot.eventbus.ThreadMode
  23. import retrofit2.HttpException
  24. import xn.hxp.R
  25. import xn.hxp.app.ChemicalApp
  26. import xn.hxp.comm.Constants
  27. import xn.hxp.databinding.ActivitySwipeCodeTwoBinding
  28. import xn.hxp.receiver.OnSerialScanListener
  29. import xn.hxp.receiver.PortScanHelper
  30. import xn.hxp.receiver.UhfRfidManager
  31. import xn.hxp.receiver.UsbReceiver
  32. import xn.hxp.ui.DoubleDialogBean
  33. import xn.hxp.utils.AudioPlayer
  34. import xn.hxp.utils.HandlerUtil
  35. import xn.hxp.utils.SharedPreferencesHelper
  36. import xn.hxp.utils.UiManager
  37. import xn.hxp.weidith.CustomDialog
  38. import xn.hxp.weidith.DoublePeopleDialog
  39. import java.net.ConnectException
  40. import java.net.SocketTimeoutException
  41. //双人-刷卡认证
  42. class SwipeCodeTwoActivity : BaseActivity() {
  43. private var mUsbReceiver: UsbReceiver? = null // 刷卡广播注册
  44. private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
  45. private var isLogin = false //是否是登陆人
  46. private var count = 1 //认证次数
  47. private var mDoorId: String? = null //柜门id
  48. private var mChemicalLevel: Int = 0 //管控类型
  49. private var mTag = 0 //0 新增入库 1 归还废弃空瓶等 2 待入库 3 领用认证需要换api 需要判断不同权限 进行验证通过
  50. private var mUserId: String? = null
  51. private val handlerUtil = HandlerUtil.getInstance()
  52. private var mVoiceCount = 1 //认证次数
  53. private val mDoubleDialogBean = mutableListOf<DoubleDialogBean>() //双人认证 需要显示的
  54. lateinit var viewBinding: ActivitySwipeCodeTwoBinding
  55. override fun setViewBinding(): ViewBinding {
  56. viewBinding = ActivitySwipeCodeTwoBinding.inflate(layoutInflater)
  57. return viewBinding
  58. }
  59. override fun onInit() {
  60. Constants.AUTHENTICATION = false
  61. //注册广播
  62. EventBus.getDefault().register(this)
  63. try {
  64. SharedPreferencesHelper.clearList(this)
  65. } catch (e: Exception) {
  66. }
  67. viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
  68. mTag = intent.getIntExtra("mTag", 0)
  69. val intExtra = intent.getIntExtra("hides", 0)
  70. mDoorId = intent.getStringExtra("doorId")
  71. mChemicalLevel = intent.getIntExtra("chemicalLevel", 0)
  72. if (intExtra == 4) {
  73. viewBinding.lint.visibility = View.GONE
  74. viewBinding.lintTwo.visibility = View.GONE
  75. } else if (intExtra == 2) {
  76. viewBinding.face.visibility = View.GONE
  77. viewBinding.faceTwo.visibility = View.GONE
  78. }
  79. val map = mutableMapOf<String, Any>()
  80. //跳转扫码
  81. map["chemicalLevel"] = mChemicalLevel //管控类型
  82. map["doorId"] = "$mDoorId" //柜子id
  83. map["mTag"] = mTag
  84. map["hides"] = intExtra //隐藏扫码
  85. viewBinding.face.setOnClickListener {
  86. //需要双人认证 人脸
  87. UiManager.switcher(this, map, TwoPersonActivity::class.java)
  88. finish()
  89. }
  90. viewBinding.wxScan.setOnClickListener {
  91. UiManager.switcher(this, map, ScanCodeTwoActivity::class.java)
  92. finish()
  93. }
  94. viewBinding.faceTwo.setOnClickListener {
  95. //需要双人认证 人脸
  96. UiManager.switcher(this, map, TwoPersonActivity::class.java)
  97. finish()
  98. }
  99. viewBinding.wxScanTwo.setOnClickListener {
  100. UiManager.switcher(this, map, ScanCodeTwoActivity::class.java)
  101. finish()
  102. }
  103. viewBinding.tvReturn.setOnClickListener {
  104. finish()
  105. }
  106. viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
  107. Glide.with(this)
  108. .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
  109. .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
  110. .into(viewBinding.image)
  111. AudioPlayer.getInstance().play(R.raw.first_card_verify)
  112. // customDialogView(0,"请第一个人进行认证")
  113. // 定义一个定时任务 双人-刷卡认证
  114. // val task = object : TimerTask() {
  115. // override fun run() {
  116. // if (mVoiceCount == 6) {
  117. // finish()
  118. // }
  119. // if (count == 1) {
  120. // MediaPlayerHelper.playRawMp3(
  121. // this@SwipeCodeTwoActivity,
  122. // R.raw.diyiwei_shua_ka_renzheng
  123. // )
  124. // } else {
  125. // MediaPlayerHelper.playRawMp3(
  126. // this@SwipeCodeTwoActivity,
  127. // R.raw.dierweishuakarenzheng
  128. // )
  129. // }
  130. // mVoiceCount++
  131. // }
  132. // }
  133. // 使用 schedule 方法执行任务,延迟 0 毫秒,每隔 10 秒执行一次
  134. // mTimer.schedule(task, 0, 10000)
  135. handlerUtil.startTask(task, 10000)
  136. }
  137. private val task = Runnable {
  138. if (mVoiceCount == 6) {
  139. finish()
  140. }
  141. if (count == 1) {
  142. AudioPlayer.getInstance().play(R.raw.first_card_verify)
  143. } else {
  144. AudioPlayer.getInstance().play(R.raw.second_card_verify)
  145. }
  146. mVoiceCount++
  147. }
  148. override fun onResume() {
  149. super.onResume()
  150. mPortScanHelper.onResume()
  151. registerUsbBroadcast()
  152. }
  153. override fun onBackPressed() {
  154. super.onBackPressed()
  155. finish()
  156. }
  157. override fun cdTime(cd: Int) {
  158. viewBinding.tvReturn.text = "返回${cd}s"
  159. }
  160. private val mPortScanHelper by lazy {
  161. PortScanHelper(this, object : OnSerialScanListener {
  162. override fun dispatchScanEvent(type: OnSerialScanListener.ScanType, content: String) {
  163. if (!mHandleScanEvent) {
  164. if (content.isNotBlank()) {
  165. mHandleScanEvent = true
  166. handleScanEvent(content)
  167. }
  168. }
  169. }
  170. })
  171. }
  172. //刷卡usb链接
  173. private fun registerUsbBroadcast() {
  174. if (null == mUsbReceiver) {
  175. val filter = IntentFilter().apply {
  176. addAction(UsbReceiver.ACTION_USB_PERMISSION)
  177. addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED)
  178. addAction(UsbManager.ACTION_USB_DEVICE_DETACHED)
  179. addAction(UsbReceiver.ACTION_USB_STATE) // usb连接状态广播
  180. }
  181. mUsbReceiver = UsbReceiver()
  182. registerReceiver(mUsbReceiver, filter)
  183. }
  184. }
  185. //调用刷卡信息
  186. private fun handleScanEvent(cont: String) {
  187. //只有 0 1 1代表 已经需要第二次进行验证
  188. showLoading("验证中...")
  189. val mutableMap = mutableMapOf<String, String>()
  190. mutableMap["cardNum"] = "$cont"
  191. mutableMap["subId"] = "${ChemicalApp.subjectId}"
  192. mutableMap["doorId"] = "$mDoorId"
  193. val disposable = ApiRepository.useCardVerify(mutableMap)
  194. .subscribe({ data ->
  195. dismissLoading()
  196. if (count == 1) {
  197. mUserId = data.userId
  198. LogUtils.i("第a一个人 $mUserId ${data.userId}")
  199. } else {
  200. LogUtils.i("第b一个人 $mUserId ${data.userId}")
  201. if (mUserId.equals(data.userId) && count == 2) {
  202. customDialogView(0, "不能是同一人")
  203. mHandleScanEvent = false
  204. return@subscribe
  205. }
  206. }
  207. //0 新增入库 1 领用归还废弃空瓶等 2 待入库 需要判断不同权限 进行验证通过
  208. when (mTag) {
  209. 0 -> {
  210. if (count == 1) {
  211. if (data.userId == ChemicalApp.userData!!.userId) {
  212. count++
  213. mHandleScanEvent = false
  214. isLogin = true
  215. customDialog(data.userName, data.faceImg)
  216. var bean =
  217. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  218. mDoubleDialogBean.add(bean)
  219. } else {
  220. if (mChemicalLevel == 1) {
  221. //管控 校级管理员或院级管理
  222. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  223. count++
  224. mHandleScanEvent = false
  225. if (count == 2) {
  226. customDialog(data.userName, data.faceImg)
  227. var bean = DoubleDialogBean(
  228. data.userName,
  229. data.faceImg,
  230. data.userId
  231. )
  232. mDoubleDialogBean.add(bean)
  233. } else {
  234. var bean = DoubleDialogBean(
  235. data.userName,
  236. data.faceImg,
  237. data.userId
  238. )
  239. mDoubleDialogBean.add(bean)
  240. passThrough()
  241. }
  242. } else {
  243. mHandleScanEvent = false
  244. customDialogView(0, "无权限信息")
  245. }
  246. } else {
  247. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  248. count++
  249. mHandleScanEvent = false
  250. if (count == 2) {
  251. customDialog(data.userName, data.faceImg)
  252. var bean = DoubleDialogBean(
  253. data.userName,
  254. data.faceImg,
  255. data.userId
  256. )
  257. mDoubleDialogBean.add(bean)
  258. } else {
  259. var bean = DoubleDialogBean(
  260. data.userName,
  261. data.faceImg,
  262. data.userId
  263. )
  264. mDoubleDialogBean.add(bean)
  265. passThrough()
  266. }
  267. } else {
  268. mHandleScanEvent = false
  269. customDialogView(0, "无权限信息")
  270. }
  271. }
  272. }
  273. } else if (count == 2) {
  274. if (isLogin) {
  275. //已经有登陆人
  276. if (mChemicalLevel == 1) {
  277. //管控 校级管理员或院级管理
  278. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  279. var bean = DoubleDialogBean(
  280. data.userName,
  281. data.faceImg,
  282. data.userId
  283. )
  284. mDoubleDialogBean.add(bean)
  285. passThrough()
  286. } else {
  287. mHandleScanEvent = false
  288. customDialogView(0, "无权限信息")
  289. }
  290. } else {
  291. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  292. var bean = DoubleDialogBean(
  293. data.userName,
  294. data.faceImg,
  295. data.userId
  296. )
  297. mDoubleDialogBean.add(bean)
  298. passThrough()
  299. } else {
  300. mHandleScanEvent = false
  301. customDialogView(0, "无权限信息")
  302. }
  303. }
  304. } else {
  305. if (data.userId == ChemicalApp.userData!!.userId) {
  306. var bean =
  307. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  308. mDoubleDialogBean.add(bean)
  309. passThrough()
  310. } else {
  311. mHandleScanEvent = false
  312. customDialogView(0, "无权限信息")
  313. }
  314. }
  315. }
  316. }
  317. 1 -> { //归还业务 标签管理
  318. if (count == 1) {
  319. if (data.userId == ChemicalApp.userData!!.userId) {
  320. count++
  321. mHandleScanEvent = false
  322. isLogin = true
  323. customDialog(data.userName, data.faceImg)
  324. var bean =
  325. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  326. mDoubleDialogBean.add(bean)
  327. } else {
  328. obtainCertification(data)
  329. }
  330. } else if (count == 2) {
  331. if (isLogin) {
  332. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  333. var bean =
  334. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  335. mDoubleDialogBean.add(bean)
  336. passThrough()
  337. } else {
  338. mHandleScanEvent = false
  339. customDialogView(0, "认证失败")
  340. }
  341. } else {
  342. if (data.userId == ChemicalApp.userData!!.userId) {
  343. var bean =
  344. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  345. mDoubleDialogBean.add(bean)
  346. passThrough()
  347. } else {
  348. mHandleScanEvent = false
  349. customDialogView(0, "认证失败")
  350. }
  351. }
  352. }
  353. }
  354. 2 -> {//待入库
  355. if (count == 1) {
  356. if (data.userId == ChemicalApp.userData!!.userId) {
  357. count++
  358. mHandleScanEvent = false
  359. isLogin = true
  360. customDialog(data.userName, data.faceImg)
  361. var bean =
  362. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  363. mDoubleDialogBean.add(bean)
  364. } else {
  365. toBeStored(data)
  366. }
  367. } else if (count == 2) {
  368. if (isLogin) {
  369. if (mChemicalLevel == 1) {
  370. //管控
  371. if (data.safeUser == true || data.adminUser == true || data.cabinetAdmin == true) {
  372. var bean = DoubleDialogBean(
  373. data.userName,
  374. data.faceImg,
  375. data.userId
  376. )
  377. mDoubleDialogBean.add(bean)
  378. passThrough()
  379. } else {
  380. mHandleScanEvent = false
  381. customDialogView(0, "认证失败")
  382. }
  383. } else {
  384. //非管控 实验室负责人or安全负责人or柜锁管理员
  385. if (data.safeUser == true || data.adminUser == true || data.cabinetAdmin == true) {
  386. var bean = DoubleDialogBean(
  387. data.userName,
  388. data.faceImg,
  389. data.userId
  390. )
  391. mDoubleDialogBean.add(bean)
  392. passThrough()
  393. } else {
  394. mHandleScanEvent = false
  395. customDialogView(0, "认证失败")
  396. }
  397. }
  398. } else {
  399. if (data.userId == ChemicalApp.userData!!.userId) {
  400. var bean =
  401. DoubleDialogBean(data.userName, data.faceImg, data.userId)
  402. mDoubleDialogBean.add(bean)
  403. passThrough()
  404. } else {
  405. mHandleScanEvent = false
  406. customDialogView(0, "认证失败")
  407. }
  408. }
  409. }
  410. }
  411. }
  412. }, { throwable ->
  413. dismissLoading()
  414. // showNetError(throwable)
  415. mHandleScanEvent = false
  416. throwableView(throwable)
  417. })
  418. addDisposable(disposable)
  419. }
  420. private fun obtainCertification(data: UserValidationBean) {
  421. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  422. count++
  423. mHandleScanEvent = false
  424. customDialog(data.userName, data.faceImg)
  425. var bean = DoubleDialogBean(data.userName, data.faceImg, data.userId)
  426. mDoubleDialogBean.add(bean)
  427. } else {
  428. mHandleScanEvent = false
  429. customDialogView(0, "认证失败")
  430. }
  431. }
  432. private fun toBeStored(data: UserValidationBean) {
  433. if (mChemicalLevel == 1) {
  434. //管控
  435. if (data.adminUser == true || data.safeUser == true || data.cabinetAdmin == true) {
  436. count++
  437. mHandleScanEvent = false
  438. customDialog(data.userName, data.faceImg)
  439. var bean = DoubleDialogBean(data.userName, data.faceImg, data.userId)
  440. mDoubleDialogBean.add(bean)
  441. } else {
  442. mHandleScanEvent = false
  443. customDialogView(0, "认证失败")
  444. }
  445. } else {
  446. //非管控 实验室负责人or安全负责人or柜锁管理员
  447. if (data.safeUser == true || data.adminUser == true || data.cabinetAdmin == true) {
  448. count++
  449. mHandleScanEvent = false
  450. customDialog(data.userName, data.faceImg)
  451. var bean = DoubleDialogBean(data.userName, data.faceImg, data.userId)
  452. mDoubleDialogBean.add(bean)
  453. } else {
  454. mHandleScanEvent = false
  455. customDialogView(0, "认证失败")
  456. }
  457. }
  458. }
  459. private fun customDialog(userName: String, imgUrl: String?) {
  460. // customDialogView(0,"请第二个人进行认证")
  461. viewBinding.through.visibility = View.VISIBLE
  462. viewBinding.userName.text = "$userName"
  463. Glide.with(this)
  464. .load("${HttpConfig.API_BASE_IMG_URL}$imgUrl")
  465. .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
  466. .error(R.mipmap.icon_zhan_wei)
  467. .into(viewBinding.imgView)
  468. AudioPlayer.getInstance().play(R.raw.first_card_verify)
  469. }
  470. //获取刷卡信息
  471. override fun dispatchKeyEvent(event: KeyEvent): Boolean {
  472. // 消费掉外置RFID读卡器的输入
  473. if (UhfRfidManager.isEnabled(this) && UhfRfidManager.isUhfRfidEvent(this, event)) {
  474. return true
  475. }
  476. mPortScanHelper.dispatchKeyEvent(event)
  477. return super.dispatchKeyEvent(event)
  478. }
  479. //停止 销毁广播传递
  480. override fun onPause() {
  481. mPortScanHelper.onPause()
  482. super.onPause()
  483. }
  484. override fun onDestroy() {
  485. super.onDestroy()
  486. mPortScanHelper.onPause()
  487. // 停止定时更新
  488. unregisterReceiver(mUsbReceiver)
  489. try {
  490. handlerUtil.removeCallbacks(task)
  491. handlerUtil.stopAllTasks()
  492. handlerBack.removeCallbacks(countdownRunnable)
  493. handlerBack.removeCallbacksAndMessages(null)
  494. } catch (e: Exception) {
  495. }
  496. EventBus.getDefault().unregister(this) //关闭广播
  497. }
  498. override fun cdFinish() {
  499. finish()
  500. }
  501. //必须写这个方法 防止注册失败
  502. @Subscribe(threadMode = ThreadMode.MAIN)
  503. fun onUpdateEventEvent(event: KeyEvent) {
  504. }
  505. /**
  506. * 0 没有图标 1 绿色(成功) 2红色(失败)
  507. * 失败或者成功的弹框
  508. */
  509. private fun customDialogView(types: Int, msg: String) {
  510. if (!this.isFinishing && !this.isDestroyed) {
  511. val customDialog = CustomDialog(this, types, msg)
  512. customDialog.show()
  513. }
  514. }
  515. /**
  516. * 异常处理
  517. */
  518. private fun throwableView(throwable: Throwable) {
  519. when (throwable) {
  520. is NetException -> {
  521. if (throwable.message.isNullOrEmpty()) {
  522. "接口请求失败(${throwable.code})"
  523. } else {
  524. throwable.message!!
  525. }
  526. }
  527. is SocketTimeoutException -> "请求超时,请稍后重试"
  528. is ConnectException -> "无法连接服务器,请检查网络"
  529. is HttpException -> "服务器繁忙,请稍后重试"
  530. else -> null
  531. }?.let { customDialogView(2, "$it") }
  532. }
  533. private lateinit var dialogsAut: DoublePeopleDialog
  534. private var timeLeftInSeconds = 2
  535. private var mTvView: TextView? = null
  536. private val handlerBack = Handler(Looper.getMainLooper())
  537. //验证通过
  538. private fun passThrough() {
  539. try {
  540. handlerUtil.removeCallbacks(task)
  541. handlerUtil.stopAllTasks()
  542. } catch (e: Exception) {
  543. }
  544. // 在需要时关闭定时器
  545. try {
  546. // 取消定时器,停止所有任务的执行
  547. LogUtils.i("验证通过${mDoubleDialogBean[0].name}")
  548. LogUtils.i("验证通过${mDoubleDialogBean[1].name}")
  549. } catch (e: Exception) {
  550. }
  551. Constants.AUTHENTICATION = true
  552. // 存储集合到 SharedPreferences
  553. SharedPreferencesHelper.saveList(this, mDoubleDialogBean)
  554. dialogsAut =
  555. DoublePeopleDialog(this, mDoubleDialogBean, object : DoublePeopleDialog.IClickLit {
  556. override fun onUpView(tvView: TextView) {
  557. mTvView = tvView
  558. }
  559. })
  560. dialogsAut.show()
  561. // 开始倒计时
  562. handlerBack.post(countdownRunnable)
  563. // 获取对话框的 Window 对象
  564. dialogsAut?.window?.decorView?.setOnTouchListener { _, event ->
  565. // 判断是否点击了对话框外部空白区域
  566. if (event.action == MotionEvent.ACTION_DOWN) {
  567. val x = event.x
  568. val y = event.y
  569. val dialogView = dialogsAut?.window?.decorView
  570. if (dialogView != null && (x < 0 || x > dialogView.width || y < 0 || y > dialogView.height)) {
  571. // 在此处执行点击对话框外部空白区域时的操作
  572. // 例如关闭对话框
  573. dialogsAut.dismiss()
  574. finish()
  575. return@setOnTouchListener true
  576. }
  577. }
  578. return@setOnTouchListener false
  579. }
  580. AudioPlayer.getInstance().play(R.raw.verify_success)
  581. }
  582. private val countdownRunnable = object : Runnable {
  583. override fun run() {
  584. if (timeLeftInSeconds > 0) {
  585. mTvView!!.text = "${timeLeftInSeconds}秒后自动返回首页"
  586. timeLeftInSeconds--
  587. handlerBack.postDelayed(this, 1000)
  588. } else {
  589. dialogsAut!!.dismiss()
  590. finish()
  591. }
  592. }
  593. }
  594. }