From 425d05d43640ef06d1e25be06f5f9df5161c549d Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 19 Jun 2020 17:17:54 +0200 Subject: [PATCH] Fixes crash + visual improvement --- .../handhistory/replayer/FrameManager.kt | 2 -- .../handhistory/replayer/ReplayerAnimator.kt | 6 +++-- app/src/main/res/layout/fragment_replayer.xml | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/FrameManager.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/FrameManager.kt index 5a5fea57..66d8d3c6 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/FrameManager.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/FrameManager.kt @@ -41,13 +41,11 @@ class FrameManager { * */ fun frameType(frame: Int): FrameType { - this.descriptors.forEach { descriptor -> if (frame in descriptor.range) { return descriptor.type } } - throw PAIllegalStateException("frame $frame asked out of $totalAddedFrames defined frames, descriptor count = ${this.descriptors.size}") } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt index 5a5b1708..657aaa42 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt @@ -188,7 +188,9 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { * Let the animator know when a frame has been drawn */ fun frameDrawn() { - this.currentFrame += 1 + if (this.currentFrame < this.numberOfFramesForCurrentStep - 1) { + this.currentFrame += 1 + } } /*** @@ -301,7 +303,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) { this.playerItemsWidth = this.tableHPadding * 2 * this.paddingPercentage this.chipRadius = this.playerItemsHeight / 4 - val cardWPaddingWidth = this.playerItemsWidth * 1.2f / this.maxCards + val cardWPaddingWidth = this.playerItemsWidth * 1.5f / this.maxCards val cardWidth = cardWPaddingWidth * this.cardsPaddingPercentage this.cardSpecs = Size(cardWidth, cardWidth * 1.75f) this.cardRadius = cardWidth / 4 diff --git a/app/src/main/res/layout/fragment_replayer.xml b/app/src/main/res/layout/fragment_replayer.xml index 79b4c1b8..a2efda8b 100644 --- a/app/src/main/res/layout/fragment_replayer.xml +++ b/app/src/main/res/layout/fragment_replayer.xml @@ -60,8 +60,8 @@ style="@style/PokerAnalyticsTheme.ToolbarButton" android:layout_width="50dp" android:layout_height="50dp" - android:layout_marginStart="4dp" - android:layout_marginEnd="4dp" + android:layout_marginStart="2dp" + android:layout_marginEnd="2dp" /> + android:layout_marginStart="2dp" + android:layout_marginEnd="2dp"/> + android:layout_marginStart="2dp" + android:layout_marginEnd="2dp"/>