diff --git a/CHANGELOG.md b/CHANGELOG.md index af71ae4..0dba7c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ patch-level version changes can be found in [commit messages](../../commits/mast ## Next_Ver --> +## 20231008 + +- Update Fastlane Metadata +- Update to use API level 34 +- Minor tweaks to readme +- Add translations from Weblate (thank you to the following!) + - German + - Ettore Atalan + - French + - J. Lavoie +- Add Android 13 Icon +- Code clean up and `ktlint` check and formatting +- Fix Bug: Keyboard has a transparent background +- Fix Bug where the keyboard forgets last 'Recent' last selected + ## 20230828 - Update app description diff --git a/README.md b/README.md index 29fb1b4..d33e572 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Follow the steps in the [Building from Source](#building-from-source) section. This app has been written in Kotlin 1.9.0 with the Android Studio IDE. -- The target SDK version is 33 (Android 13) +- The target SDK version is 34 (Android 14) - The minimum SDK version is 26 (Android 8 Oreo) ## Building From Source diff --git a/app/build.gradle.kts b/app/build.gradle.kts index cdac6ee..54f393c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -32,7 +32,7 @@ tasks.register("genDocs") { } android { - compileSdk = 33 + compileSdk = 34 buildToolsVersion = "34.0.0" namespace = "com.fredhappyface.ewesticker" @@ -47,9 +47,9 @@ android { defaultConfig { applicationId = "com.fredhappyface.ewesticker" minSdk = 26 - targetSdk = 33 - versionCode = 20230828 - versionName = "20230828" + targetSdk = 34 + versionCode = 20231008 + versionName = "20231008" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", "$applicationId-$versionName") } @@ -70,10 +70,10 @@ android { dependencies { dokkaPlugin("org.jetbrains.dokka:android-documentation-plugin:1.8.20") - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.0") - implementation("androidx.core:core-ktx:1.10.1") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.10") + implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.9.0") + implementation("com.google.android.material:material:1.10.0") implementation("androidx.preference:preference-ktx:1.2.1") implementation("io.coil-kt:coil:2.4.0") implementation("io.coil-kt:coil-gif:2.4.0") diff --git a/app/src/main/java/com/fredhappyface/ewesticker/ImageKeyboard.kt b/app/src/main/java/com/fredhappyface/ewesticker/ImageKeyboard.kt index 1c765cd..62e1e45 100644 --- a/app/src/main/java/com/fredhappyface/ewesticker/ImageKeyboard.kt +++ b/app/src/main/java/com/fredhappyface/ewesticker/ImageKeyboard.kt @@ -274,19 +274,20 @@ class ImageKeyboard : InputMethodService(), StickerClickListener { } } // Recent - val recentButton = addPackButton("__recentSticker__") + val recentPackName = "__recentSticker__" + val recentButton = addPackButton(recentPackName) recentButton.load(getDrawable(R.drawable.time)) - recentButton.setOnClickListener { switchPackLayout(it?.tag as String) } + recentButton.setOnClickListener { switchPackLayout(recentPackName) } // Packs val sortedPackNames = this.loadedPacks.keys.sorted().toTypedArray() for (sortedPackName in sortedPackNames) { val packButton = addPackButton(sortedPackName) packButton.load(this.loadedPacks[sortedPackName]?.thumbSticker) - packButton.setOnClickListener { switchPackLayout(it?.tag as String) } + packButton.setOnClickListener { switchPackLayout(sortedPackName) } } val targetPack = - if (activePack in sortedPackNames) activePack else sortedPackNames.firstOrNull() + if (activePack in sortedPackNames + recentPackName) activePack else sortedPackNames.firstOrNull() if (sortedPackNames.isNotEmpty()) { targetPack?.let { switchPackLayout(it) } @@ -340,7 +341,7 @@ class ImageKeyboard : InputMethodService(), StickerClickListener { fSticker.load(sticker) val fText = fullStickerLayout.findViewById(R.id.stickerInfo) val stickerName = trimString(sticker.name) - val packName = trimString(sticker.parent.split('/').last()) + val packName = trimString(sticker.parent?.split('/')?.last()) fText.text = getString(R.string.sticker_pack_info, stickerName, packName) // Tap to exit popup @@ -352,34 +353,19 @@ class ImageKeyboard : InputMethodService(), StickerClickListener { internal fun switchToPreviousPack() { // Get a list of sorted pack names val sortedPackNames = loadedPacks.keys.sorted() - // Find the index of the current active pack val currentIndex = sortedPackNames.indexOf(activePack) - // Calculate the index of the previous pack, considering wrap-around val previousIndex = if (currentIndex > 0) currentIndex - 1 else sortedPackNames.size - 1 - - // Get the name of the previous pack val previousPack = sortedPackNames[previousIndex] - - // Switch to the previous pack layout switchPackLayout(previousPack) } internal fun switchToNextPack() { - // Get a list of sorted pack names val sortedPackNames = loadedPacks.keys.sorted() - - // Find the index of the current active pack val currentIndex = sortedPackNames.indexOf(activePack) - - // Calculate the index of the next pack, considering wrap-around val nextIndex = (currentIndex + 1) % sortedPackNames.size - - // Get the name of the next pack val nextPack = sortedPackNames[nextIndex] - - // Switch to the next pack layout switchPackLayout(nextPack) } @@ -389,13 +375,13 @@ class ImageKeyboard : InputMethodService(), StickerClickListener { } override fun onScroll( - e1: MotionEvent, + e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float, ): Boolean { - val diffX = e2.x - e1.x - val diffY = e2.y - e1.y + val diffX = e2.x - (e1?.x ?: 0f) + val diffY = e2.y - (e1?.y ?: 0f) if ( scroll && @@ -425,7 +411,10 @@ class ImageKeyboard : InputMethodService(), StickerClickListener { * @param str: String * @return String */ -fun trimString(str: String): String { +fun trimString(str: String?): String { + if (str == null){ + return "null" + } if (str.length > 32) { return str.substring(0, 32) + "..." } diff --git a/metadata/en-US/changelogs/20231008.txt b/metadata/en-US/changelogs/20231008.txt new file mode 100644 index 0000000..acaaf96 --- /dev/null +++ b/metadata/en-US/changelogs/20231008.txt @@ -0,0 +1,22 @@ +

20231008

+