Fixes issues with frame lengthes

hh
Laurent 5 years ago
parent 8c4e297164
commit 46cff86947
  1. 22
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt
  2. 6
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/TableDrawer.kt

@ -6,6 +6,7 @@ import android.graphics.Canvas
import android.graphics.RectF
import net.pokeranalytics.android.exceptions.PAIllegalStateException
import net.pokeranalytics.android.model.handhistory.Street
import net.pokeranalytics.android.model.realm.handhistory.Action
import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.ui.modules.handhistory.model.ActionList
import net.pokeranalytics.android.ui.modules.handhistory.model.ComputedAction
@ -90,11 +91,17 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) {
*/
private val visualOccurences: Int
get() {
return if (this.currentStepIndex == this.steps.size - 1 && this.currentFrameIndex == this.numberOfFramesForCurrentStep - 1) {
FrameType.STATE.visualOccurences * 3
} else {
this.frameType.visualOccurences
val step = this.currentStep
return when {
step is ComputedAction && step.street == Street.PREFLOP && step.action.type == Action.Type.FOLD -> {
FrameType.STATE.visualOccurences / 3
}
this.currentStepIndex == this.steps.size - 1 && this.currentFrameIndex == this.numberOfFramesForCurrentStep - 1 -> {
FrameType.STATE.visualOccurences * 3
}
else -> this.frameType.visualOccurences
}
}
/***
@ -153,6 +160,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) {
this.actionList.load(handHistory)
this.steps = HandStep.createSteps(handHistory)
defineFramesForCurrentStep()
this.frameManager.defineFrameDescriptor(this.currentFrameIndex)
}
/***
@ -636,12 +644,14 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) {
(0 until this.frameManager.totalFrames).forEach { f ->
Timber.d("FRAME [$f] >> step: $currentStepIndex, frame: $currentFrameIndex")
// Timber.d("FRAME [$f] >> step: $currentStepIndex, frame: $currentFrameIndex, vo: ${this.visualOccurences}, type: ${this.frameType}")
val bitmap = Bitmap.createBitmap(this.width.toInt(), this.height.toInt(), Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
val vo = this.visualOccurences // this is needed before the call to drawTable which pass to the next frame
TableDrawer.drawTable(this, canvas, context)
frameHandler(bitmap, this.visualOccurences)
frameHandler(bitmap, vo)
}

@ -85,9 +85,6 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) {
val computedAction = step as? ComputedAction?
// draw pot
drawPot(street, computedAction, animator, canvas, context)
// draw board
drawBoardCards(street, animator, canvas, context)
@ -98,6 +95,9 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) {
drawPlayerChips(i, animator, canvas, context)
}
// draw pot
drawPot(street, computedAction, animator, canvas, context)
// draw player cards
animator.activePositions.forEach {
drawCards(it, animator, canvas, context)

Loading…
Cancel
Save