Skip to content

Commit

Permalink
Merge pull request #17 from vadiole/dev
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
vadiole authored Jul 16, 2023
2 parents 7f62c56 + f86a41c commit c12fb69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId = "vadiole.unicode"
minSdk = 26
targetSdk = 33
versionCode = 140
versionName = "1.4.0"
versionCode = 141
versionName = "1.4.1"
resourceConfigurations.addAll(listOf("en"))
setProperty("archivesBaseName", "unicode-v$versionName")
}
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/kotlin/vadiole/unicode/data/UnicodeStorage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class UnicodeStorage(private val context: Context) {
return@io result
}

suspend fun getCharObj(codePoint: CodePoint): CharObj = io {
suspend fun getCharObj(codePoint: CodePoint): CharObj? = io {
val args = arrayOf(codePoint.value.toString())
val result: CharObj
openDatabase().rawQuery(queryGetChar, args).use { cursor ->
Expand All @@ -90,6 +90,9 @@ class UnicodeStorage(private val context: Context) {
val charNameIndex = cursor.getColumnIndex("char_name")
val versionIndex = cursor.getColumnIndex("version")
val blockNameIndex = cursor.getColumnIndex("block_name")
if (cursor.count == 0) {
return@io null
}
cursor.moveToNext()
result = CharObj(
id = cursor.getInt(charIdIndex),
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/kotlin/vadiole/unicode/ui/UnicodeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.core.view.WindowCompat.setDecorFitsSystemWindows
import vadiole.unicode.R
import vadiole.unicode.UnicodeApp.Companion.themeManager
import vadiole.unicode.data.CodePoint
import vadiole.unicode.data.UnicodeStorage
import vadiole.unicode.ui.theme.blue_dark
import vadiole.unicode.ui.theme.blue_light
import vadiole.unicode.utils.extension.insetsController
Expand All @@ -33,7 +32,7 @@ class UnicodeActivity : Activity() {

override fun onNewIntent(intent: Intent) {
val codePointValue = intent.data?.getQueryParameter("c")?.toIntOrNull() ?: return
if (codePointValue >= 1 && codePointValue < UnicodeStorage.totalCharacters) {
if (codePointValue in 1..917999) {
val codePoint = CodePoint(codePointValue)
deepLinkHandler.invoke(codePoint)
}
Expand Down Expand Up @@ -72,4 +71,4 @@ class UnicodeActivity : Activity() {
backButtonHandler = { false }
deepLinkHandler = { _ -> }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class DetailsSheet(
// TODO: add strings to localeManager
private val infoNames: Array<String> = arrayOf("Code", "HTML", "CSS", "Version")
fun bind(codePoint: CodePoint) = launch {
val obj: CharObj = unicodeStorage.getCharObj(codePoint) //fix clipping char id=21687
val obj: CharObj = unicodeStorage.getCharObj(codePoint) ?: return@launch
title.text = obj.name
subtitle.text = obj.blockName
charView.text = obj.char
Expand Down

0 comments on commit c12fb69

Please sign in to comment.