|
|
|
@ -130,7 +130,9 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
|
|
|
|
|
|
|
|
keyboard?.let { |
|
|
|
keyboard?.let { |
|
|
|
// this.animateKeyboard(true) |
|
|
|
// this.animateKeyboard(true) |
|
|
|
this.showKeyboard(it) |
|
|
|
this.showKeyboard(it) { |
|
|
|
|
|
|
|
this.scrollToPosition(selection.index) |
|
|
|
|
|
|
|
} |
|
|
|
// this.keyboard.show(it) |
|
|
|
// this.keyboard.show(it) |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
this.animateKeyboard(false) |
|
|
|
this.animateKeyboard(false) |
|
|
|
@ -139,6 +141,8 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
this.animateKeyboard(false) |
|
|
|
this.animateKeyboard(false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val observer = Observer<MutableList<RowRepresentable>> { |
|
|
|
val observer = Observer<MutableList<RowRepresentable>> { |
|
|
|
@ -254,8 +258,6 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
refreshRowAtIndexAndCurrent(oldIndex) |
|
|
|
refreshRowAtIndexAndCurrent(oldIndex) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.scrollToPosition(position) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.model.selectionLiveData.value = HHSelection(position, tag) |
|
|
|
this.model.selectionLiveData.value = HHSelection(position, tag) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
@ -437,18 +439,18 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showKeyboard(keyboard: HHKeyboard) { |
|
|
|
private fun showKeyboard(keyboard: HHKeyboard, endHandler: (() -> (Unit))? = null) { |
|
|
|
|
|
|
|
|
|
|
|
val lp = this.kbTopGuideline.layoutParams as ConstraintLayout.LayoutParams |
|
|
|
val lp = this.kbTopGuideline.layoutParams as ConstraintLayout.LayoutParams |
|
|
|
if (lp.guideEnd == 0) { |
|
|
|
if (lp.guideEnd == 0) { |
|
|
|
this.animateKeyboard(true) |
|
|
|
this.animateKeyboard(true, endHandler) |
|
|
|
} |
|
|
|
} |
|
|
|
this.keyboard.show(keyboard) |
|
|
|
this.keyboard.show(keyboard) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun animateKeyboard(show: Boolean) { |
|
|
|
private fun animateKeyboard(show: Boolean, endHandler: (() -> (Unit))? = null) { |
|
|
|
|
|
|
|
|
|
|
|
val height = 300.0f.px |
|
|
|
val height = 310.0f.px |
|
|
|
val start = if (show) 0.0f else height |
|
|
|
val start = if (show) 0.0f else height |
|
|
|
val end = if (show) height else 0.0f |
|
|
|
val end = if (show) height else 0.0f |
|
|
|
|
|
|
|
|
|
|
|
@ -464,6 +466,10 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
lp.guideEnd = (it.animatedValue as Float).toInt() |
|
|
|
lp.guideEnd = (it.animatedValue as Float).toInt() |
|
|
|
// update layout params |
|
|
|
// update layout params |
|
|
|
this.kbTopGuideline.layoutParams = lp |
|
|
|
this.kbTopGuideline.layoutParams = lp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (lp.guideEnd == end.toInt()) { |
|
|
|
|
|
|
|
endHandler?.invoke() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
valueAnimator.start() |
|
|
|
valueAnimator.start() |
|
|
|
} |
|
|
|
} |
|
|
|
|