Skip to content

Commit

Permalink
Bump to 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bingzheung committed Aug 15, 2024
1 parent 6ad26d3 commit fe01c70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId = "org.jyutping.jyutping"
minSdk = 29
targetSdk = 34
versionCode = 11
versionName = "0.11.0"
versionCode = 12
versionName = "0.12.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ object DatabasePreparer {
"appdb-v0.9.0-tmp.sqlite3-journal",
"appdb-v0.10.0-tmp.sqlite3",
"appdb-v0.10.0-tmp.sqlite3-journal",
"appdb-v0.11.0-tmp.sqlite3",
"appdb-v0.11.0-tmp.sqlite3-journal",
)
val databaseName: String = run {
val version = BuildConfig.VERSION_NAME
Expand All @@ -39,9 +41,9 @@ object DatabasePreparer {
private const val DATABASES_DIR = "/databases/"

fun prepare(context: Context) {
deleteOldDatabases(context)
val shouldCopyDatabase: Boolean = !(doesDatabaseExist(context))
if (shouldCopyDatabase) {
val databaseExists: Boolean = doesDatabaseExist(context)
if (!databaseExists) {
deleteOldDatabases(context)
copyDatabase(context)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class UserLexiconHelper(context: Context) : SQLiteOpenHelper(context, UserSettin
}
private fun query(text: String, input: String, mark: String? = null, isShortcut: Boolean): List<Candidate> {
val candidates: MutableList<Candidate> = mutableListOf()
val code: Int = if (isShortcut) { text.replace("y", "j").hashCode() } else text.hashCode()
val code: Int = if (isShortcut) text.replace("y", "j").hashCode() else text.hashCode()
val column: String = if (isShortcut) "shortcut" else "ping"
val command: String = "SELECT word, romanization FROM memory WHERE $column = $code ORDER BY frequency DESC LIMIT 5;"
val cursor = this.readableDatabase.rawQuery(command, null)
Expand Down

0 comments on commit fe01c70

Please sign in to comment.