Fixes row refresh

hh
Laurent 6 years ago
parent 67caf7a125
commit 3287bdff0c
  1. 6
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt
  2. 4
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardActionView.kt
  3. 13
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardContainer.kt
  4. 1
      app/src/main/res/layout/fragment_hand_history.xml

@ -164,11 +164,11 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr
private fun findNextActionToEdit(startIndex: Int, keyboard: HHKeyboard? = null) { private fun findNextActionToEdit(startIndex: Int, keyboard: HHKeyboard? = null) {
this.model.findIndexForEdition(startIndex, keyboard)?.let { this.model.findIndexForEdition(startIndex, keyboard)?.let {
this.keyboard.show(it, this.requireActivity()) this.keyboard.show(it)
this.refreshCells(startIndex)
} ?: run { } ?: run {
this.keyboard.hide() this.keyboard.hide()
} }
this.refreshCells(startIndex)
} }
// RowRepresentableDataSource // RowRepresentableDataSource
@ -222,7 +222,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr
else -> null else -> null
} }
Timber.d("row $position selected, show keyboard = $keyboard") Timber.d("row $position selected, show keyboard = $keyboard")
keyboard?.let { this.keyboard.show(keyboard, requireActivity()) } keyboard?.let { this.keyboard.show(keyboard) }
} }

@ -38,6 +38,10 @@ class KeyboardActionView(context: Context) : AbstractKeyboardView(context),
addItemDecoration(GridSpacingItemDecoration(spanCount, spacing, includeEdge)) addItemDecoration(GridSpacingItemDecoration(spanCount, spacing, includeEdge))
} }
this.closeButton.setOnClickListener {
this.keyboardListener?.closeKeyboard()
}
} }
override fun adapterRows(): List<RowRepresentable>? { override fun adapterRows(): List<RowRepresentable>? {

@ -1,6 +1,5 @@
package net.pokeranalytics.android.ui.modules.handhistory.views package net.pokeranalytics.android.ui.modules.handhistory.views
import android.app.Activity
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
@ -35,14 +34,20 @@ class KeyboardContainer(context: Context, attrs: AttributeSet?) : FrameLayout(co
} }
private fun show() { private fun show() {
this.isVisible = true if (!this.isVisible) {
val height = this.height.toFloat()
this.translationY = height
this.visibility = View.VISIBLE
this.animate().translationY(0.0f).setDuration(250).start();
}
} }
fun hide() { fun hide() {
this.isVisible = false // animate
this.visibility = View.GONE
} }
fun show(type: HHKeyboard, activity: Activity) { fun show(type: HHKeyboard) {
// Timber.d("show keyboard : $type") // Timber.d("show keyboard : $type")
show() show()

@ -36,6 +36,7 @@
<net.pokeranalytics.android.ui.modules.handhistory.views.KeyboardContainer <net.pokeranalytics.android.ui.modules.handhistory.views.KeyboardContainer
android:id="@+id/keyboard" android:id="@+id/keyboard"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

Loading…
Cancel
Save