|
@@ -156,11 +156,16 @@ class PlayerViewModel(
|
|
|
override fun onNewTimer(type: Int, value: Int) {
|
|
|
Log.d("PVM", "onListen: $type , $value")
|
|
|
|
|
|
+ var rest = value
|
|
|
+ if (type == 1 && host.hasPlayModel()) {
|
|
|
+ rest -= 1
|
|
|
+ }
|
|
|
+
|
|
|
countDown = CountDown(
|
|
|
id = courseId,
|
|
|
type = type,
|
|
|
value = value,
|
|
|
- rest = value,
|
|
|
+ rest = rest,
|
|
|
datetime = SimpleDateFormat("yyyy-MM-dd").format(Date())
|
|
|
)
|
|
|
|
|
@@ -171,10 +176,18 @@ class PlayerViewModel(
|
|
|
}
|
|
|
|
|
|
override fun onResetTimer() {
|
|
|
- countDown = countDown.copyWith(
|
|
|
- rest = countDown.value,
|
|
|
- datetime = SimpleDateFormat("yyyy-MM-dd").format(Date())
|
|
|
- )
|
|
|
+ if (countDown.type == 1) {
|
|
|
+
|
|
|
+ countDown = countDown.copyWith(
|
|
|
+ rest = if (host.hasPlayModel()) countDown.value - 1 else countDown.value,
|
|
|
+ datetime = SimpleDateFormat("yyyy-MM-dd").format(Date())
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ countDown = countDown.copyWith(
|
|
|
+ rest = countDown.value,
|
|
|
+ datetime = SimpleDateFormat("yyyy-MM-dd").format(Date())
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
countDown.let {
|
|
|
setCountDown(it, true)
|