diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt index 403ff443..dfa1a347 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt @@ -130,7 +130,9 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL keyboard?.let { // this.animateKeyboard(true) - this.showKeyboard(it) + this.showKeyboard(it) { + this.scrollToPosition(selection.index) + } // this.keyboard.show(it) } ?: run { this.animateKeyboard(false) @@ -139,6 +141,8 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL } ?: run { this.animateKeyboard(false) } + + } val observer = Observer> { @@ -254,8 +258,6 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL refreshRowAtIndexAndCurrent(oldIndex) } - this.scrollToPosition(position) - 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 if (lp.guideEnd == 0) { - this.animateKeyboard(true) + this.animateKeyboard(true, endHandler) } 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 end = if (show) height else 0.0f @@ -464,6 +466,10 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL lp.guideEnd = (it.animatedValue as Float).toInt() // update layout params this.kbTopGuideline.layoutParams = lp + + if (lp.guideEnd == end.toInt()) { + endHandler?.invoke() + } } valueAnimator.start() } diff --git a/app/src/main/res/layout/view_hand_keyboard_action.xml b/app/src/main/res/layout/view_hand_keyboard_action.xml index b880bd35..d0aba291 100644 --- a/app/src/main/res/layout/view_hand_keyboard_action.xml +++ b/app/src/main/res/layout/view_hand_keyboard_action.xml @@ -7,12 +7,13 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintTop_toTopOf="parent">