Skip to content

Commit

Permalink
v.1.15.1 Fix "No interface method removeFirst" on some devices
Browse files Browse the repository at this point in the history
  • Loading branch information
yvolk committed Dec 20, 2024
1 parent 2425437 commit f6a96f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ korge {
androidCompileSdk = 35
androidTargetSdk = 35

versionCode = 43
version = "1.15.0"
versionCode = 44
version = "1.15.1"

// Optionally use Android default debug.keystore file
Result.runCatching {
Expand Down
4 changes: 2 additions & 2 deletions game2048-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {
applicationId 'org.andstatus.game2048'
minSdkVersion 24
targetSdkVersion 35
versionCode 43
versionName '1.15.0'
versionCode 44
versionName '1.15.1'

archivesBaseName = "game2048-android-$versionName"
}
Expand Down
9 changes: 5 additions & 4 deletions src/commonMain/kotlin/org/andstatus/game2048/view/AppBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import org.andstatus.game2048.view.AppBarButtonsEnum.PAUSE
import org.andstatus.game2048.view.AppBarButtonsEnum.PLAY
import org.andstatus.game2048.view.AppBarButtonsEnum.REDO
import org.andstatus.game2048.view.AppBarButtonsEnum.REDO_PLACEHOLDER
import org.andstatus.game2048.view.AppBarButtonsEnum.TRY_AGAIN
import org.andstatus.game2048.view.AppBarButtonsEnum.STOP
import org.andstatus.game2048.view.AppBarButtonsEnum.STOP_PLACEHOLDER
import org.andstatus.game2048.view.AppBarButtonsEnum.TO_CURRENT
import org.andstatus.game2048.view.AppBarButtonsEnum.TO_START
import org.andstatus.game2048.view.AppBarButtonsEnum.TRY_AGAIN
import org.andstatus.game2048.view.AppBarButtonsEnum.UNDO
import org.andstatus.game2048.view.AppBarButtonsEnum.WATCH

Expand All @@ -36,7 +36,7 @@ class AppBar private constructor(val viewData: ViewData, private val appBarButto
val (toShowAll, toRemove) = appBarButtons.partition { appBarButtonsToShow.contains(it.enum) }
toRemove.forEach { it.container.removeFromParent() }

(0 .. 1).forEach { row ->
(0..1).forEach { row ->
val toShow = toShowAll.filter { eButton -> eButton.enum.row == row }
val remainingPos = viewData.buttonXs.take(5).toMutableList()

Expand All @@ -47,7 +47,7 @@ class AppBar private constructor(val viewData: ViewData, private val appBarButto
remainingPos.firstOrNull()?.let {
eb.container.positionX(it)
.addTo(parent)
remainingPos.removeFirst()
remainingPos.removeAt(0)
}
}
// Others are Right-aligned
Expand All @@ -57,7 +57,7 @@ class AppBar private constructor(val viewData: ViewData, private val appBarButto
remainingPos.lastOrNull()?.let {
eb.container.positionX(it)
.addTo(parent)
remainingPos.removeLast()
remainingPos.removeAt(remainingPos.size - 1)
}
}
}
Expand All @@ -68,6 +68,7 @@ class AppBar private constructor(val viewData: ViewData, private val appBarButto

suspend fun AppBarButtonsEnum.button(handler: () -> Unit): EButton =
EButton(this, this@setupAppBar.barButton(this.icon, handler))

fun AppBarButtonsEnum.button(): EButton = EButton(this)

val buttons: List<EButton> = listOf(
Expand Down

0 comments on commit f6a96f1

Please sign in to comment.