Cleanup and bugs fixes

hh
Laurent 5 years ago
parent e1ff129721
commit 91b17e6897
  1. 5
      app/src/main/AndroidManifest.xml
  2. 5
      app/src/main/java/net/pokeranalytics/android/ui/modules/feed/FeedFragment.kt
  3. 25
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt

@ -66,11 +66,6 @@
android:launchMode="singleTop"
android:theme="@style/PokerAnalyticsTheme.MenuDialog" />
<activity
android:name="net.pokeranalytics.android.ui.modules.handhistory.replayer.TestActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name="net.pokeranalytics.android.ui.modules.bankroll.BankrollActivity"
android:launchMode="singleTop"

@ -22,17 +22,16 @@ import net.pokeranalytics.android.model.realm.Filter
import net.pokeranalytics.android.model.realm.Session
import net.pokeranalytics.android.model.realm.Transaction
import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.ui.activity.*
import net.pokeranalytics.android.ui.activity.BillingActivity
import net.pokeranalytics.android.ui.activity.components.RequestCode
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate
import net.pokeranalytics.android.ui.fragment.components.FilterableFragment
import net.pokeranalytics.android.ui.modules.data.EditableDataActivity
import net.pokeranalytics.android.ui.modules.datalist.DataListActivity
import net.pokeranalytics.android.ui.modules.filter.FilterActivityRequestCode
import net.pokeranalytics.android.ui.modules.filter.FilterableType
import net.pokeranalytics.android.ui.modules.datalist.DataListActivity
import net.pokeranalytics.android.ui.modules.filter.FiltersActivity
import net.pokeranalytics.android.ui.modules.handhistory.HandHistoryActivity
import net.pokeranalytics.android.ui.modules.handhistory.replayer.TestActivity
import net.pokeranalytics.android.ui.modules.session.SessionActivity
import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager

@ -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()

Loading…
Cancel
Save