|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
package com.yinuo.safetywatcher.watcher.ui
|
|
|
|
|
|
|
|
|
|
import android.view.KeyEvent
|
|
|
|
|
import android.view.View
|
|
|
|
|
import com.loper7.date_time_picker.DateTimeConfig
|
|
|
|
|
import com.yinuo.safetywatcher.R
|
|
|
|
|
import com.yinuo.safetywatcher.databinding.ActivitySensorBinding
|
|
|
|
|
import com.yinuo.safetywatcher.databinding.ActivityTimeSettingBinding
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.base.NoOptionsActivity
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.LztekUtil
|
|
|
|
@ -47,6 +48,31 @@ class TimeSettingActivity : NoOptionsActivity() {
|
|
|
|
|
}
|
|
|
|
|
onBackPressed()
|
|
|
|
|
}
|
|
|
|
|
set4focus()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun set4focus() {
|
|
|
|
|
val yearPicker = mBingding.picker.getPicker(DateTimeConfig.YEAR)
|
|
|
|
|
yearPicker?.setOnKeyListener(View.OnKeyListener { _, keyCode, event ->
|
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
|
|
|
|
|
if (event.action == KeyEvent.ACTION_DOWN) {
|
|
|
|
|
tryFocusBackArea()
|
|
|
|
|
return@OnKeyListener true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return@OnKeyListener false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
val endMinPicker = mBingding.picker.getPicker(DateTimeConfig.MIN)
|
|
|
|
|
endMinPicker?.setOnKeyListener(View.OnKeyListener { _, keyCode, event ->
|
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
|
|
|
|
|
if (event.action == KeyEvent.ACTION_DOWN) {
|
|
|
|
|
mBingding.tvCancel.requestFocus()
|
|
|
|
|
return@OnKeyListener true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return@OnKeyListener false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun setShowTime(time: Long) {
|
|
|
|
|