|
|
|
|
@ -131,12 +131,20 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Returns if the animator has more steps to display |
|
|
|
|
*/ |
|
|
|
|
private val hasMoreSteps: Boolean |
|
|
|
|
get() { |
|
|
|
|
return this.currentStepIndex < this.steps.size - 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Returns if the animator has more frame to show |
|
|
|
|
*/ |
|
|
|
|
val shouldShowAdditionalFrame: Boolean |
|
|
|
|
get() { |
|
|
|
|
return this.currentFrame < this.numberOfFramesForCurrentStep |
|
|
|
|
return this.currentFrame < this.numberOfFramesForCurrentStep - 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -181,7 +189,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { |
|
|
|
|
|
|
|
|
|
val bi = this.steps.indexOfLast { it is ComputedAction && it.action.type?.isBlind == true } |
|
|
|
|
this.lastBlindIndex = max(bi, 0) // in case indexOfLast returns -1 |
|
|
|
|
this.currentStepIndex = this.lastBlindIndex + 1 // initialize at big blind |
|
|
|
|
this.currentStepIndex = this.lastBlindIndex // initialize at big blind |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -197,7 +205,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { |
|
|
|
|
* Reset the step and the frame to the start of the hand |
|
|
|
|
*/ |
|
|
|
|
fun restart() { |
|
|
|
|
this.currentStepIndex = 0 |
|
|
|
|
this.currentStepIndex = this.lastBlindIndex |
|
|
|
|
this.currentFrame = 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -643,9 +651,15 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* This method creates a bitmap for each step and frame |
|
|
|
|
* in order to create a playable video for the whole hand |
|
|
|
|
* As soon as a bitmap has been created, the [frameHandler] is called with the created |
|
|
|
|
* bitmap, and a appropriate occurrences of the bitmap to be added is passed along |
|
|
|
|
*/ |
|
|
|
|
fun frames(context: Context, frameHandler: (Bitmap, Int) -> Unit) { |
|
|
|
|
|
|
|
|
|
this.steps.forEach { _ -> |
|
|
|
|
while (this.hasMoreSteps) { |
|
|
|
|
|
|
|
|
|
while (this.shouldShowAdditionalFrame) { |
|
|
|
|
|
|
|
|
|
@ -653,9 +667,10 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { |
|
|
|
|
val canvas = Canvas(bitmap) |
|
|
|
|
TableDrawer.drawTable(this, canvas, context) |
|
|
|
|
|
|
|
|
|
Timber.d("frame drawn at step: $currentStepIndex, frame: $currentFrame") |
|
|
|
|
frameHandler(bitmap, this.visualOccurences) |
|
|
|
|
|
|
|
|
|
frameDrawn() |
|
|
|
|
// frameDrawn() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
nextStep() |
|
|
|
|
|