Revision | f3e8c9f56aa83aa139edf63833feb8b789eaee81 (tree) |
---|---|
Zeit | 2020-07-01 08:50:03 |
Autor | Ang Iongchun <ang@iong...> |
Commiter | Ang Iongchun |
flow: Merged <release> '1.6.0' to <master> ('default').
@@ -3,9 +3,8 @@ | ||
3 | 3 | <component name="GradleSettings"> |
4 | 4 | <option name="linkedExternalProjectsSettings"> |
5 | 5 | <GradleProjectSettings> |
6 | - <compositeConfiguration> | |
7 | - <compositeBuild compositeDefinitionSource="SCRIPT" /> | |
8 | - </compositeConfiguration> | |
6 | + <option name="delegatedBuild" value="false" /> | |
7 | + <option name="testRunner" value="PLATFORM" /> | |
9 | 8 | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
10 | 9 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
11 | 10 | <option name="modules"> |
@@ -18,4 +17,4 @@ | ||
18 | 17 | </GradleProjectSettings> |
19 | 18 | </option> |
20 | 19 | </component> |
21 | -</project> | |
\ No newline at end of file | ||
20 | +</project> |
@@ -5,32 +5,36 @@ | ||
5 | 5 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
6 | 6 | <option name="myNullables"> |
7 | 7 | <value> |
8 | - <list size="10"> | |
8 | + <list size="12"> | |
9 | 9 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
10 | 10 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
11 | 11 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
12 | 12 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
13 | 13 | <item index="4" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> |
14 | 14 | <item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" /> |
15 | - <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" /> | |
16 | - <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" /> | |
17 | - <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" /> | |
18 | - <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" /> | |
15 | + <item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" /> | |
16 | + <item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" /> | |
17 | + <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" /> | |
18 | + <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" /> | |
19 | + <item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" /> | |
20 | + <item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" /> | |
19 | 21 | </list> |
20 | 22 | </value> |
21 | 23 | </option> |
22 | 24 | <option name="myNotNulls"> |
23 | 25 | <value> |
24 | - <list size="9"> | |
26 | + <list size="11"> | |
25 | 27 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
26 | 28 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
27 | 29 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
28 | 30 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
29 | 31 | <item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" /> |
30 | - <item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" /> | |
31 | - <item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" /> | |
32 | - <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" /> | |
33 | - <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" /> | |
32 | + <item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" /> | |
33 | + <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" /> | |
34 | + <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" /> | |
35 | + <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" /> | |
36 | + <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" /> | |
37 | + <item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" /> | |
34 | 38 | </list> |
35 | 39 | </value> |
36 | 40 | </option> |
@@ -56,4 +60,4 @@ | ||
56 | 60 | </state> |
57 | 61 | </states> |
58 | 62 | </component> |
59 | -</project> | |
\ No newline at end of file | ||
63 | +</project> |
@@ -2,8 +2,8 @@ | ||
2 | 2 | <project version="4"> |
3 | 3 | <component name="ProjectModuleManager"> |
4 | 4 | <modules> |
5 | - <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | |
6 | - <module fileurl="file://$PROJECT_DIR$/simsik-khipoo.iml" filepath="$PROJECT_DIR$/simsik-khipoo.iml" /> | |
5 | + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" group="simsik-khipoo/app" /> | |
6 | + <module fileurl="file://$PROJECT_DIR$/simsik-khipoo.iml" filepath="$PROJECT_DIR$/simsik-khipoo.iml" group="simsik-khipoo" /> | |
7 | 7 | </modules> |
8 | 8 | </component> |
9 | 9 | </project> |
\ No newline at end of file |
@@ -10,15 +10,15 @@ | ||
10 | 10 | } |
11 | 11 | |
12 | 12 | android { |
13 | - compileSdkVersion 28 | |
14 | - buildToolsVersion '28.0.3' | |
13 | + compileSdkVersion 29 | |
14 | + buildToolsVersion '29.0.2' | |
15 | 15 | defaultConfig { |
16 | 16 | applicationId "tw.iongchun.taigikbd" |
17 | 17 | minSdkVersion 14 |
18 | - targetSdkVersion 28 | |
19 | - versionCode 30 | |
20 | - versionName "1.5.6" | |
21 | - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | |
18 | + targetSdkVersion 29 | |
19 | + versionCode 35 | |
20 | + versionName "1.6.0" | |
21 | + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' | |
22 | 22 | vectorDrawables.useSupportLibrary = true |
23 | 23 | } |
24 | 24 | signingConfigs { |
@@ -40,20 +40,20 @@ | ||
40 | 40 | |
41 | 41 | dependencies { |
42 | 42 | api fileTree(include: ['*.jar'], dir: 'libs') |
43 | - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { | |
43 | + androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', { | |
44 | 44 | exclude group: 'com.android.support', module: 'support-annotations' |
45 | 45 | }) |
46 | - api 'com.android.support:appcompat-v7:28.0.0' | |
47 | - api 'com.android.support:support-v4:28.0.0' | |
48 | - api 'com.android.support:support-vector-drawable:28.0.0' | |
49 | - implementation 'com.android.support:design:28.0.0' | |
50 | - implementation 'com.android.support.constraint:constraint-layout:1.1.2' | |
51 | - api 'org.pcollections:pcollections:2.1.2' | |
46 | + api 'androidx.appcompat:appcompat:1.1.0' | |
47 | + api 'androidx.legacy:legacy-support-v4:1.0.0' | |
48 | + api 'androidx.vectordrawable:vectordrawable:1.1.0' | |
49 | + implementation 'com.google.android.material:material:1.1.0' | |
50 | + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | |
51 | + api 'org.pcollections:pcollections:3.1.3' | |
52 | 52 | api 'net.sf.supercsv:super-csv:2.4.0' |
53 | - testImplementation 'junit:junit:4.12' | |
54 | - testImplementation 'org.mockito:mockito-core:2.8.47' | |
53 | + testImplementation 'junit:junit:4.13' | |
54 | + testImplementation 'org.mockito:mockito-core:2.28.2' | |
55 | 55 | // AndroidJUnitRunner and JUnit Rules |
56 | - androidTestImplementation 'com.android.support.test:runner:1.0.2' | |
57 | - androidTestImplementation 'com.android.support.test:rules:1.0.2' | |
56 | + androidTestImplementation 'androidx.test.ext:junit:1.1.1' | |
57 | + androidTestImplementation 'androidx.test:rules:1.2.0' | |
58 | 58 | androidTestImplementation 'org.mockito:mockito-android:2.28.2' |
59 | 59 | } |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -19,8 +19,8 @@ | ||
19 | 19 | package tw.iongchun.taigikbd; |
20 | 20 | |
21 | 21 | import android.content.Context; |
22 | -import android.support.test.InstrumentationRegistry; | |
23 | -import android.support.test.runner.AndroidJUnit4; | |
22 | +import androidx.test.platform.app.InstrumentationRegistry; | |
23 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
24 | 24 | |
25 | 25 | import org.junit.Test; |
26 | 26 | import org.junit.runner.RunWith; |
@@ -37,7 +37,7 @@ | ||
37 | 37 | @Test |
38 | 38 | public void useAppContext() throws Exception { |
39 | 39 | // Context of the app under test. |
40 | - Context appContext = InstrumentationRegistry.getTargetContext(); | |
40 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |
41 | 41 | |
42 | 42 | String myPackage = "tw.iongchun.taigikbd"; |
43 | 43 | assertEquals(myPackage, appContext.getPackageName().substring(0, myPackage.length())); |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -21,7 +21,7 @@ | ||
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | 23 | import android.content.res.Resources; |
24 | -import android.support.test.runner.AndroidJUnit4; | |
24 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
25 | 25 | import android.text.InputType; |
26 | 26 | import android.view.inputmethod.EditorInfo; |
27 | 27 | import android.view.inputmethod.InputConnection; |
@@ -19,8 +19,8 @@ | ||
19 | 19 | package tw.iongchun.taigikbd; |
20 | 20 | |
21 | 21 | import android.content.SharedPreferences; |
22 | -import android.support.annotation.Nullable; | |
23 | -import android.support.test.runner.AndroidJUnit4; | |
22 | +import androidx.annotation.Nullable; | |
23 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
24 | 24 | |
25 | 25 | import org.junit.Before; |
26 | 26 | import org.junit.Test; |
@@ -20,7 +20,7 @@ | ||
20 | 20 | |
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.SharedPreferences; |
23 | -import android.support.test.runner.AndroidJUnit4; | |
23 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
24 | 24 | |
25 | 25 | import org.junit.Before; |
26 | 26 | import org.junit.Test; |
@@ -25,8 +25,8 @@ | ||
25 | 25 | import android.content.Intent; |
26 | 26 | import android.database.Cursor; |
27 | 27 | import android.database.sqlite.SQLiteDatabase; |
28 | -import android.support.v4.app.NotificationCompat; | |
29 | -import android.support.v4.content.LocalBroadcastManager; | |
28 | +import androidx.core.app.NotificationCompat; | |
29 | +import androidx.localbroadcastmanager.content.LocalBroadcastManager; | |
30 | 30 | |
31 | 31 | import org.supercsv.io.CsvListReader; |
32 | 32 | import org.supercsv.prefs.CsvPreference; |
@@ -39,7 +39,7 @@ | ||
39 | 39 | import java.util.StringTokenizer; |
40 | 40 | import java.util.concurrent.atomic.AtomicBoolean; |
41 | 41 | |
42 | -import static android.support.v4.app.NotificationCompat.PRIORITY_MIN; | |
42 | +import static androidx.core.app.NotificationCompat.PRIORITY_MIN; | |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Created by iongchun on 9/21/17. |
@@ -240,7 +240,8 @@ | ||
240 | 240 | String phrases = data.get(3); |
241 | 241 | if (phrases == null) |
242 | 242 | continue; |
243 | - updatePhrases(phraseId, phrases, stats); | |
243 | + String hans = data.get(2); | |
244 | + updatePhrases(phraseId, phrases, hans, stats); | |
244 | 245 | |
245 | 246 | if (alt == null) { |
246 | 247 | while (true) { |
@@ -252,14 +253,14 @@ | ||
252 | 253 | continue; |
253 | 254 | if (altPhraseId == phraseId) { |
254 | 255 | phrases = alt.get(2); |
255 | - updatePhrases(phraseId, phrases, stats); | |
256 | + updatePhrases(phraseId, phrases, hans, stats); | |
256 | 257 | alt = null; |
257 | 258 | } |
258 | 259 | break; |
259 | 260 | } |
260 | 261 | } else if (altPhraseId == phraseId) { |
261 | 262 | phrases = alt.get(2); |
262 | - updatePhrases(phraseId, phrases, stats); | |
263 | + updatePhrases(phraseId, phrases, hans, stats); | |
263 | 264 | alt = null; |
264 | 265 | } |
265 | 266 | cntWords = curWords + stats[1] + stats[2]; |
@@ -271,6 +272,8 @@ | ||
271 | 272 | notifBuilder.setContentText(getResources().getString(R.string.dict_db_cancel)); |
272 | 273 | return; |
273 | 274 | } |
275 | + migrateTable("words"); | |
276 | + migrateTable("words_poj"); | |
274 | 277 | notifBuilder.setContentText(getResources().getString(R.string.dict_db_done)); |
275 | 278 | } catch (IOException ex) { |
276 | 279 | log("read phrases error: ", ex); |
@@ -311,7 +314,7 @@ | ||
311 | 314 | broadcastDatabaseReady(); |
312 | 315 | } |
313 | 316 | |
314 | - private void updatePhrases(int phraseId, String phrases, int[] stats) { | |
317 | + private void updatePhrases(int phraseId, String phrases, String hans, int[] stats) { | |
315 | 318 | try { |
316 | 319 | //log("phrase: ", phrase); |
317 | 320 | phrases = phrases.trim(); |
@@ -321,39 +324,77 @@ | ||
321 | 324 | for (String alt : alts) { |
322 | 325 | //log(" alt: ", alt); |
323 | 326 | stats[0]++; |
324 | - updatePhrase(phraseId, alt.trim(), stats); | |
327 | + updatePhrase(phraseId, alt.trim(), hans, stats); | |
325 | 328 | } |
329 | + } else if (phrases.indexOf('(') >= 0) { | |
330 | + String[] alts = phrases.split("[()]"); | |
331 | + for (String alt : alts) { | |
332 | + stats[0]++; | |
333 | + updatePhrase(phraseId, alt.trim(), hans, stats); | |
334 | + } | |
326 | 335 | } else { |
327 | 336 | stats[0]++; |
328 | - updatePhrase(phraseId, phrases, stats); | |
337 | + updatePhrase(phraseId, phrases, hans, stats); | |
329 | 338 | } |
330 | 339 | } catch (Exception ex) { |
331 | 340 | log("process phrase error (", ex, "): ", phrases); |
332 | 341 | } |
333 | 342 | } |
334 | 343 | |
335 | - private void updatePhrase(int phraseId, String phrase, int[] stats) { | |
336 | - String[] words = phrase.split("[\\s,.]+"); | |
337 | - for (String word : words) { | |
338 | - word = word.toLowerCase(Locale.ROOT); | |
339 | - if (updateWord(phraseId, word, false)) | |
344 | + private void updatePhrase(int phraseId, String phrase, String han, int[] stats) { | |
345 | + if (phrase.startsWith("--")) | |
346 | + phrase = phrase.substring(2); | |
347 | + | |
348 | + int sep = han.indexOf("、"); | |
349 | + if (sep >= 0) | |
350 | + han = han.substring(0, sep); | |
351 | + String hanChars = ""; | |
352 | + for (String str : han.split("[,;。?—]+")) | |
353 | + hanChars += str; | |
354 | + int hanLen = hanChars.length(); | |
355 | + | |
356 | + String[] words = phrase.split("[\\s,.—]+"); | |
357 | + for (int i = 0; i < words.length; i++) { | |
358 | + String word = words[i].toLowerCase(Locale.ROOT); | |
359 | + | |
360 | + String[] syls = word.split("[\\s,.—-]+"); | |
361 | + String hanWord = null; | |
362 | + if (hanLen > 0) { | |
363 | + if (syls.length > hanLen || i == words.length - 1) { | |
364 | + hanWord = hanChars; | |
365 | + hanChars = ""; | |
366 | + hanLen = 0; | |
367 | + } else { | |
368 | + hanWord = hanChars.substring(0, syls.length); | |
369 | + hanChars = hanChars.substring(syls.length); | |
370 | + hanLen -= syls.length; | |
371 | + } | |
372 | + } else { | |
373 | + String syl = syls[0]; | |
374 | + for (int j = 1; j < syls.length; j++) | |
375 | + syl = syl + ',' + syls[j]; | |
376 | + log("syls=", syl, "(", syls.length, ") han=", hanChars, "(", hanLen, ")"); | |
377 | + } | |
378 | + | |
379 | + if (updateWord(phraseId, word, hanWord, false)) | |
340 | 380 | stats[1]++; |
341 | 381 | String wordPoj = wordTailoToPoj(word); |
342 | 382 | /* |
343 | 383 | if (!wordPoj.equals(word)) |
344 | 384 | log("tailo: ", word, ", poj: ", wordPoj); |
345 | 385 | */ |
346 | - if (updateWord(phraseId, wordPoj, true)) | |
386 | + if (updateWord(phraseId, wordPoj, hanWord, true)) | |
347 | 387 | stats[2]++; |
348 | 388 | } |
349 | 389 | } |
350 | 390 | |
351 | - private boolean updateWord(int phraseId, String word, boolean poj) { | |
391 | + private boolean updateWord(int phraseId, String word, String han, boolean poj) { | |
352 | 392 | ContentValues values = new ContentValues(); |
353 | 393 | String toneless = new String(TKComposingUtils.removeTone(word)); |
354 | 394 | values.put("word", word); |
355 | 395 | values.put("toneless", toneless); |
356 | 396 | values.put("phrase_id", phraseId); |
397 | + values.put("han", han); | |
357 | 398 | values.put("weight", 1.0d); |
358 | 399 | long id = db.insertWithOnConflict(poj ? "words_poj" : "words", null, values, SQLiteDatabase.CONFLICT_IGNORE); |
359 | 400 | return id != -1L; |
@@ -371,6 +412,15 @@ | ||
371 | 412 | db.update("words", values, "word=?", args); |
372 | 413 | } |
373 | 414 | c.close(); |
415 | + // for TL Han | |
416 | + c = db.rawQuery("select weight from words where han=?", args); | |
417 | + if (c.moveToNext()) { | |
418 | + double weight = c.getDouble(0); | |
419 | + ContentValues values = new ContentValues(); | |
420 | + values.put("weight", Math.sqrt(weight + 1.0d)); | |
421 | + db.update("words", values, "han=?", args); | |
422 | + } | |
423 | + c.close(); | |
374 | 424 | // for POJ |
375 | 425 | c = db.rawQuery("select weight from words_poj where word=?", args); |
376 | 426 | if (c.moveToNext()) { |
@@ -380,5 +430,32 @@ | ||
380 | 430 | db.update("words_poj", values, "word=?", args); |
381 | 431 | } |
382 | 432 | c.close(); |
433 | + // for POJ Han | |
434 | + c = db.rawQuery("select weight from words_poj where han=?", args); | |
435 | + if (c.moveToNext()) { | |
436 | + double weight = c.getDouble(0); | |
437 | + ContentValues values = new ContentValues(); | |
438 | + values.put("weight", Math.sqrt(weight + 1.0d)); | |
439 | + db.update("words_poj", values, "han=?", args); | |
440 | + } | |
441 | + } | |
442 | + | |
443 | + private void migrateTable(String name) { | |
444 | + String nameOrg = name + "_org"; | |
445 | + if (!TKDatabase.checkTableExist(db, nameOrg)) | |
446 | + return; | |
447 | + // migrate weights | |
448 | + String index = "idx_" + nameOrg + "_with_weight"; | |
449 | + db.execSQL("drop index if exists " + index); | |
450 | + db.execSQL("create index " + index + " on " + nameOrg + " (weight)"); | |
451 | + Cursor c = db.rawQuery("select word, weight from " + nameOrg + " where weight > 1", new String[] {}); | |
452 | + while (c.moveToNext()) { | |
453 | + String word = c.getString(0); | |
454 | + double weight = c.getDouble(1); | |
455 | + ContentValues values = new ContentValues(); | |
456 | + values.put("weight", weight); | |
457 | + db.update(name, values, "word=?", new String[] {word}); | |
458 | + } | |
459 | + db.execSQL("drop table " + nameOrg); | |
383 | 460 | } |
384 | 461 | } |
@@ -19,6 +19,7 @@ | ||
19 | 19 | package tw.iongchun.taigikbd; |
20 | 20 | |
21 | 21 | import android.content.Context; |
22 | +import android.database.Cursor; | |
22 | 23 | import android.database.sqlite.SQLiteDatabase; |
23 | 24 | import android.database.sqlite.SQLiteOpenHelper; |
24 | 25 |
@@ -28,7 +29,7 @@ | ||
28 | 29 | |
29 | 30 | public class TKDatabase extends SQLiteOpenHelper { |
30 | 31 | public static final String DATABASE_NAME = "taigikbd.db"; |
31 | - public static final int DATABASE_VERSION = 1; | |
32 | + public static final int DATABASE_VERSION = 2; | |
32 | 33 | |
33 | 34 | public TKDatabase(Context context) { |
34 | 35 | super(context, DATABASE_NAME, null, DATABASE_VERSION); |
@@ -43,6 +44,25 @@ | ||
43 | 44 | |
44 | 45 | @Override |
45 | 46 | public void onCreate(SQLiteDatabase db) { |
47 | + createVersion2(db); | |
48 | + } | |
49 | + | |
50 | + private void createVersion2(SQLiteDatabase db) { | |
51 | + // words | |
52 | + db.execSQL("create table words (word text primary key, toneless text, phrase_id int, han text, weight real)"); | |
53 | + db.execSQL("create index idx_words_with_weight on words (word, weight)"); | |
54 | + db.execSQL("create index idx_words_toneless_weight on words (toneless, weight)"); | |
55 | + db.execSQL("create index idx_words_phrase_id on words (phrase_id)"); | |
56 | + db.execSQL("create index idx_words_han on words (han)"); | |
57 | + // words_poj | |
58 | + db.execSQL("create table words_poj (word text primary key, toneless text, phrase_id int, han text, weight real)"); | |
59 | + db.execSQL("create index idx_words_poj_with_weight on words_poj (word, weight)"); | |
60 | + db.execSQL("create index idx_words_poj_toneless_weight on words_poj (toneless, weight)"); | |
61 | + db.execSQL("create index idx_words_poj_phrase_id on words_poj (phrase_id)"); | |
62 | + db.execSQL("create index idx_words_poj_han on words_poj (han)"); | |
63 | + } | |
64 | + | |
65 | + private void createVersion1(SQLiteDatabase db) { | |
46 | 66 | // words |
47 | 67 | db.execSQL("create table words (word text primary key, toneless text, phrase_id int, weight real)"); |
48 | 68 | db.execSQL("create index idx_words_with_weight on words (word, weight)"); |
@@ -55,14 +75,56 @@ | ||
55 | 75 | db.execSQL("create index idx_words_poj_phrase_id on words_poj (phrase_id)"); |
56 | 76 | } |
57 | 77 | |
78 | + static boolean checkTableExist(SQLiteDatabase db, String name) { | |
79 | + Cursor c = db.rawQuery("SELECT count(*) FROM sqlite_master WHERE type='table' AND name=?", new String[] {name}); | |
80 | + c.moveToNext(); | |
81 | + int count = c.getInt(0); | |
82 | + boolean exists = count > 0; | |
83 | + c.close(); | |
84 | + return exists; | |
85 | + } | |
86 | + | |
87 | + private void backupTable(SQLiteDatabase db, String name) { | |
88 | + if (checkTableExist(db, name)) { | |
89 | + String nameOrg = name + "_org"; | |
90 | + db.execSQL("drop table if exists " + nameOrg); | |
91 | + db.execSQL("alter table " + name + " rename to " + nameOrg); | |
92 | + db.execSQL("drop index if exists idx_" + name + "_with_weight"); | |
93 | + db.execSQL("drop index if exists idx_" + name + "_toneless_weight"); | |
94 | + db.execSQL("drop index if exists idx_" + name + "_phrase_id"); | |
95 | + } | |
96 | + } | |
97 | + | |
58 | 98 | @Override |
59 | 99 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { |
60 | - | |
100 | + if (newVersion > oldVersion) { | |
101 | + backupTable(db, "words"); | |
102 | + backupTable(db, "words_poj"); | |
103 | + } | |
104 | + switch (newVersion) { | |
105 | + case 1: | |
106 | + createVersion1(db); | |
107 | + break; | |
108 | + case 2: | |
109 | + createVersion2(db); | |
110 | + break; | |
111 | + } | |
61 | 112 | } |
62 | 113 | |
63 | 114 | @Override |
64 | 115 | public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { |
65 | - super.onDowngrade(db, oldVersion, newVersion); | |
116 | + if (newVersion < oldVersion) { | |
117 | + backupTable(db, "words"); | |
118 | + backupTable(db, "words_poj"); | |
119 | + } | |
120 | + switch (newVersion) { | |
121 | + case 1: | |
122 | + createVersion1(db); | |
123 | + break; | |
124 | + case 2: | |
125 | + createVersion2(db); | |
126 | + break; | |
127 | + } | |
66 | 128 | } |
67 | 129 | |
68 | 130 | @Override |
@@ -20,7 +20,7 @@ | ||
20 | 20 | |
21 | 21 | import android.content.Context; |
22 | 22 | import android.os.Bundle; |
23 | -import android.support.v7.app.AppCompatActivity; | |
23 | +import androidx.appcompat.app.AppCompatActivity; | |
24 | 24 | |
25 | 25 | public class TKHintActivity extends AppCompatActivity { |
26 | 26 | @Override |
@@ -33,9 +33,9 @@ | ||
33 | 33 | import android.inputmethodservice.KeyboardView; |
34 | 34 | import android.os.Build; |
35 | 35 | import android.preference.PreferenceManager; |
36 | -import android.support.graphics.drawable.VectorDrawableCompat; | |
37 | -import android.support.v4.content.LocalBroadcastManager; | |
38 | -import android.support.v4.graphics.drawable.DrawableCompat; | |
36 | +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; | |
37 | +import androidx.localbroadcastmanager.content.LocalBroadcastManager; | |
38 | +import androidx.core.graphics.drawable.DrawableCompat; | |
39 | 39 | import android.text.InputType; |
40 | 40 | import android.util.StringBuilderPrinter; |
41 | 41 | import android.view.KeyEvent; |
@@ -99,6 +99,7 @@ | ||
99 | 99 | import static tw.iongchun.taigikbd.TKInputState.DeleteAfterCluster; |
100 | 100 | import static tw.iongchun.taigikbd.TKInputState.DeleteLeadingsMode; |
101 | 101 | import static tw.iongchun.taigikbd.TKInputState.DeleteVowelsMode; |
102 | +import static tw.iongchun.taigikbd.TKInputState.DictHanji; | |
102 | 103 | import static tw.iongchun.taigikbd.TKInputState.DictSuggest; |
103 | 104 | import static tw.iongchun.taigikbd.TKInputState.Glotal; |
104 | 105 | import static tw.iongchun.taigikbd.TKInputState.GlotalReplaceGlotal; |
@@ -119,6 +120,24 @@ | ||
119 | 120 | import static tw.iongchun.taigikbd.TKInputState.ToneMarkStyle; |
120 | 121 | import static tw.iongchun.taigikbd.TKInputState.VoicelessToggle; |
121 | 122 | import static tw.iongchun.taigikbd.TKInputState.Vowels; |
123 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_ASPIRATION_TOGGLE; | |
124 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_AUTO_DASH; | |
125 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DEL_AFTER_CLUSTER; | |
126 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DEL_LEADINGS; | |
127 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DEL_MULTICHAR_VOWEL; | |
128 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DEL_VOWELS; | |
129 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DEL_VOWEL_CLUSTER; | |
130 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DICT_HANJI; | |
131 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_DICT_SUGGEST; | |
132 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_GLOTAL_REPLACE; | |
133 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_GLOTAL_TOGGLE; | |
134 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_IM_SWITCH; | |
135 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_KEYBOARD_THEME; | |
136 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_LEAD_REPLACE_LEAD; | |
137 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_PHONETIC_INPUT; | |
138 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_POJ_TONE_MARK; | |
139 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_TONE_MARK_STYLE; | |
140 | +import static tw.iongchun.taigikbd.TKSettingsActivity.PREF_VOICELESS_TOGGLE; | |
122 | 141 | import static tw.iongchun.taigikbd.TKViewState.ActionID; |
123 | 142 | import static tw.iongchun.taigikbd.TKViewState.ActionKeyIconID; |
124 | 143 | import static tw.iongchun.taigikbd.TKViewState.ActionKeyIconType; |
@@ -413,22 +432,24 @@ | ||
413 | 432 | migrateProperties(sharedPref); |
414 | 433 | // make sure the fallback values here match preference default, |
415 | 434 | // otherwise the value of new preference is unexpected |
416 | - boolean dictSuggest = sharedPref.getBoolean(TKSettingsActivity.PREF_DICT_SUGGEST, true); | |
417 | - boolean autoDash = sharedPref.getBoolean(TKSettingsActivity.PREF_AUTO_DASH, true); | |
418 | - boolean pojToneMark = sharedPref.getBoolean(TKSettingsActivity.PREF_POJ_TONE_MARK, false); | |
419 | - String toneMarkStyle = sharedPref.getString(TKSettingsActivity.PREF_TONE_MARK_STYLE, TONE_MARK_SUBTYPE); | |
420 | - boolean aspirationToggle = sharedPref.getBoolean(TKSettingsActivity.PREF_ASPIRATION_TOGGLE, true); | |
421 | - boolean voicelessToggle = sharedPref.getBoolean(TKSettingsActivity.PREF_VOICELESS_TOGGLE, false); | |
422 | - boolean phoneticInput = sharedPref.getBoolean(TKSettingsActivity.PREF_PHONETIC_INPUT, false); | |
423 | - boolean leadReplaceLead = sharedPref.getBoolean(TKSettingsActivity.PREF_LEAD_REPLACE_LEAD, false); | |
424 | - boolean glotalReplaceGlotal = sharedPref.getBoolean(TKSettingsActivity.PREF_GLOTAL_REPLACE, false); | |
425 | - boolean glotalToggleTone = sharedPref.getBoolean(TKSettingsActivity.PREF_GLOTAL_TOGGLE, false); | |
426 | - String deleteVowelsMode = sharedPref.getString(TKSettingsActivity.PREF_DEL_VOWELS, DEL_VOWELS_SINGLE); | |
427 | - String deleteLeadingsMode = sharedPref.getString(TKSettingsActivity.PREF_DEL_LEADINGS, DEL_LEADINGS_VALID); | |
428 | - boolean deleteAfterCluster = sharedPref.getBoolean(TKSettingsActivity.PREF_DEL_AFTER_CLUSTER, false); | |
429 | - String languageKey = sharedPref.getString(TKSettingsActivity.PREF_IM_SWITCH, LANGKEY_NEXT_IM); | |
430 | - kbdTheme = sharedPref.getString(TKSettingsActivity.PREF_KEYBOARD_THEME, kbdTheme); | |
435 | + boolean dictSuggest = sharedPref.getBoolean(PREF_DICT_SUGGEST, true); | |
436 | + boolean dictHanji = sharedPref.getBoolean(PREF_DICT_HANJI, true); | |
437 | + boolean autoDash = sharedPref.getBoolean(PREF_AUTO_DASH, true); | |
438 | + boolean pojToneMark = sharedPref.getBoolean(PREF_POJ_TONE_MARK, false); | |
439 | + String toneMarkStyle = sharedPref.getString(PREF_TONE_MARK_STYLE, TONE_MARK_SUBTYPE); | |
440 | + boolean aspirationToggle = sharedPref.getBoolean(PREF_ASPIRATION_TOGGLE, true); | |
441 | + boolean voicelessToggle = sharedPref.getBoolean(PREF_VOICELESS_TOGGLE, false); | |
442 | + boolean phoneticInput = sharedPref.getBoolean(PREF_PHONETIC_INPUT, false); | |
443 | + boolean leadReplaceLead = sharedPref.getBoolean(PREF_LEAD_REPLACE_LEAD, false); | |
444 | + boolean glotalReplaceGlotal = sharedPref.getBoolean(PREF_GLOTAL_REPLACE, false); | |
445 | + boolean glotalToggleTone = sharedPref.getBoolean(PREF_GLOTAL_TOGGLE, false); | |
446 | + String deleteVowelsMode = sharedPref.getString(PREF_DEL_VOWELS, DEL_VOWELS_SINGLE); | |
447 | + String deleteLeadingsMode = sharedPref.getString(PREF_DEL_LEADINGS, DEL_LEADINGS_VALID); | |
448 | + boolean deleteAfterCluster = sharedPref.getBoolean(PREF_DEL_AFTER_CLUSTER, false); | |
449 | + String languageKey = sharedPref.getString(PREF_IM_SWITCH, LANGKEY_NEXT_IM); | |
450 | + kbdTheme = sharedPref.getString(PREF_KEYBOARD_THEME, kbdTheme); | |
431 | 451 | log("Read preferences:\n dictSuggest: ", dictSuggest, |
452 | + "\n dictHanji: ", dictHanji, | |
432 | 453 | "\n autoDash: ", autoDash, |
433 | 454 | "\n pojToneMark: ", pojToneMark, |
434 | 455 | "\n aspirationToggle: ", aspirationToggle, |
@@ -459,6 +480,7 @@ | ||
459 | 480 | |
460 | 481 | initInputState(); |
461 | 482 | inputState = inputState.setBoolean(DictSuggest, dictSuggest) |
483 | + .setBoolean(DictHanji, dictHanji) | |
462 | 484 | .setBoolean(AutoDash, autoDash) |
463 | 485 | .setBoolean(PojToneMark, pojToneMark) |
464 | 486 | .setString(ToneMarkStyle, toneMarkStyle) |
@@ -496,7 +518,7 @@ | ||
496 | 518 | |
497 | 519 | protected void migrateToneMarkStyle(SharedPreferences sharedPref) { |
498 | 520 | SharedPreferences.Editor editor = sharedPref.edit(); |
499 | - if (sharedPref.contains(TKSettingsActivity.PREF_POJ_TONE_MARK)) { | |
521 | + if (sharedPref.contains(PREF_POJ_TONE_MARK)) { | |
500 | 522 | boolean hasPOJ = false; |
501 | 523 | boolean hasTL = false; |
502 | 524 | if (imMgr == null) { |
@@ -518,7 +540,7 @@ | ||
518 | 540 | } |
519 | 541 | } |
520 | 542 | } |
521 | - boolean pojToneMark = sharedPref.getBoolean(TKSettingsActivity.PREF_POJ_TONE_MARK, false); | |
543 | + boolean pojToneMark = sharedPref.getBoolean(PREF_POJ_TONE_MARK, false); | |
522 | 544 | |
523 | 545 | String style = TONE_MARK_SUBTYPE; |
524 | 546 | if (pojToneMark) { |
@@ -528,41 +550,41 @@ | ||
528 | 550 | if (hasPOJ && !hasTL) |
529 | 551 | style = TONE_MARK_TL; |
530 | 552 | } |
531 | - log("migrate deprecated property ", TKSettingsActivity.PREF_POJ_TONE_MARK, | |
553 | + log("migrate deprecated property ", PREF_POJ_TONE_MARK, | |
532 | 554 | " value ", pojToneMark, |
533 | - " to new property ", TKSettingsActivity.PREF_TONE_MARK_STYLE, | |
555 | + " to new property ", PREF_TONE_MARK_STYLE, | |
534 | 556 | " value ", style); |
535 | - editor.putString(TKSettingsActivity.PREF_TONE_MARK_STYLE, style); | |
536 | - editor.remove(TKSettingsActivity.PREF_POJ_TONE_MARK); | |
557 | + editor.putString(PREF_TONE_MARK_STYLE, style); | |
558 | + editor.remove(PREF_POJ_TONE_MARK); | |
537 | 559 | } |
538 | 560 | editor.apply(); |
539 | 561 | } |
540 | 562 | |
541 | 563 | protected void migrateDelVowels(SharedPreferences sharedPref) { |
542 | 564 | SharedPreferences.Editor editor = sharedPref.edit(); |
543 | - if (sharedPref.contains(TKSettingsActivity.PREF_DEL_MULTICHAR_VOWEL)) { | |
544 | - boolean deleteMultiCharVowel = sharedPref.getBoolean(TKSettingsActivity.PREF_DEL_MULTICHAR_VOWEL, false); | |
565 | + if (sharedPref.contains(PREF_DEL_MULTICHAR_VOWEL)) { | |
566 | + boolean deleteMultiCharVowel = sharedPref.getBoolean(PREF_DEL_MULTICHAR_VOWEL, false); | |
545 | 567 | if (deleteMultiCharVowel) { |
546 | 568 | String delVowels = DEL_VOWELS_SINGLE; |
547 | - log("migrate deprecated property ", TKSettingsActivity.PREF_DEL_MULTICHAR_VOWEL, | |
569 | + log("migrate deprecated property ", PREF_DEL_MULTICHAR_VOWEL, | |
548 | 570 | " value ", deleteMultiCharVowel, |
549 | - " to new property ", TKSettingsActivity.PREF_DEL_VOWELS, | |
571 | + " to new property ", PREF_DEL_VOWELS, | |
550 | 572 | " value ", delVowels); |
551 | - editor.putString(TKSettingsActivity.PREF_DEL_VOWELS, delVowels); | |
573 | + editor.putString(PREF_DEL_VOWELS, delVowels); | |
552 | 574 | } |
553 | - editor.remove(TKSettingsActivity.PREF_DEL_MULTICHAR_VOWEL); | |
575 | + editor.remove(PREF_DEL_MULTICHAR_VOWEL); | |
554 | 576 | } |
555 | - if (sharedPref.contains(TKSettingsActivity.PREF_DEL_VOWEL_CLUSTER)) { | |
556 | - boolean deleteVowelCluster = sharedPref.getBoolean(TKSettingsActivity.PREF_DEL_VOWEL_CLUSTER, false); | |
577 | + if (sharedPref.contains(PREF_DEL_VOWEL_CLUSTER)) { | |
578 | + boolean deleteVowelCluster = sharedPref.getBoolean(PREF_DEL_VOWEL_CLUSTER, false); | |
557 | 579 | if (deleteVowelCluster) { |
558 | 580 | String delVowels = DEL_VOWELS_WHOLE; |
559 | - log("migrate deprecated property ", TKSettingsActivity.PREF_DEL_VOWEL_CLUSTER, | |
581 | + log("migrate deprecated property ", PREF_DEL_VOWEL_CLUSTER, | |
560 | 582 | " value ", deleteVowelCluster, |
561 | - " to new property ", TKSettingsActivity.PREF_DEL_VOWELS, | |
583 | + " to new property ", PREF_DEL_VOWELS, | |
562 | 584 | " value ", delVowels); |
563 | - editor.putString(TKSettingsActivity.PREF_DEL_VOWELS, delVowels); | |
585 | + editor.putString(PREF_DEL_VOWELS, delVowels); | |
564 | 586 | } |
565 | - editor.remove(TKSettingsActivity.PREF_DEL_VOWEL_CLUSTER); | |
587 | + editor.remove(PREF_DEL_VOWEL_CLUSTER); | |
566 | 588 | } |
567 | 589 | editor.apply(); |
568 | 590 | } |
@@ -590,74 +612,109 @@ | ||
590 | 612 | TKInputState inputState = getInputState(); |
591 | 613 | if (inputState == null) // FIXME: why null? |
592 | 614 | return; |
593 | - if (key.equals(TKSettingsActivity.PREF_AUTO_DASH)) { | |
594 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_AUTO_DASH, false); | |
595 | - log("change AutoDash to ", value); | |
596 | - inputState = inputState.setBoolean(AutoDash, value); | |
597 | - } else if (key.equals(TKSettingsActivity.PREF_DICT_SUGGEST)) { | |
598 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_DICT_SUGGEST, false); | |
599 | - log("change DictSuggest to ", value); | |
600 | - inputState = inputState.setBoolean(DictSuggest, value); | |
601 | - if (value) { | |
602 | - dictReady.set(false); | |
603 | - TKBackgroundService.updateDatabase(this); | |
604 | - if (db == null) | |
605 | - db = new TKDatabase(this).getReadableDatabase(); | |
606 | - } else if (db != null) { | |
607 | - db.close(); | |
608 | - db = null; | |
609 | - TKBackgroundService.terminateDatabase(this); | |
615 | + switch (key) { | |
616 | + case PREF_AUTO_DASH: { | |
617 | + boolean value = sharedPref.getBoolean(PREF_AUTO_DASH, false); | |
618 | + log("change AutoDash to ", value); | |
619 | + inputState = inputState.setBoolean(AutoDash, value); | |
610 | 620 | } |
611 | - } else if (key.equals(TKSettingsActivity.PREF_POJ_TONE_MARK)) { | |
612 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_POJ_TONE_MARK, false); | |
613 | - log("change PojToneMark to ", value); | |
614 | - inputState = inputState.setBoolean(PojToneMark, value); | |
615 | - } else if (key.equals(TKSettingsActivity.PREF_ASPIRATION_TOGGLE)) { | |
616 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_ASPIRATION_TOGGLE, false); | |
617 | - log("change AspirationToggle to ", value); | |
618 | - inputState = inputState.setBoolean(AspirationToggle, value); | |
619 | - } else if (key.equals(TKSettingsActivity.PREF_VOICELESS_TOGGLE)) { | |
620 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_VOICELESS_TOGGLE, false); | |
621 | - log("change VoicelessToggle to ", value); | |
622 | - inputState = inputState.setBoolean(VoicelessToggle, value); | |
623 | - } else if (key.equals(TKSettingsActivity.PREF_PHONETIC_INPUT)) { | |
624 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_PHONETIC_INPUT, false); | |
625 | - log("change PhoneticInput to ", value); | |
626 | - inputState = inputState.setBoolean(PhoneticInput, value); | |
627 | - } else if (key.equals(TKSettingsActivity.PREF_LEAD_REPLACE_LEAD)) { | |
628 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_LEAD_REPLACE_LEAD, false); | |
629 | - log("change LeadReplaceLead to ", value); | |
630 | - inputState = inputState.setBoolean(LeadReplaceLead, value); | |
631 | - } else if (key.equals(TKSettingsActivity.PREF_GLOTAL_REPLACE)) { | |
632 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_GLOTAL_REPLACE, false); | |
633 | - log("change GlotalReplaceGlotal to ", value); | |
634 | - inputState = inputState.setBoolean(GlotalReplaceGlotal, value); | |
635 | - } else if (key.equals(TKSettingsActivity.PREF_GLOTAL_TOGGLE)) { | |
636 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_GLOTAL_TOGGLE, false); | |
637 | - log("change GlotalToggleTone to ", value); | |
638 | - inputState = inputState.setBoolean(GlotalToggleTone, value); | |
639 | - } else if (key.equals(TKSettingsActivity.PREF_DEL_VOWELS)) { | |
640 | - String value = sharedPref.getString(TKSettingsActivity.PREF_DEL_VOWELS, DEL_VOWELS_CHAR); | |
641 | - log("change DeleteVowelsMode to ", value); | |
642 | - inputState = inputState.setString(DeleteVowelsMode, value); | |
643 | - } else if (key.equals(TKSettingsActivity.PREF_DEL_LEADINGS)) { | |
644 | - String value = sharedPref.getString(TKSettingsActivity.PREF_DEL_LEADINGS, DEL_LEADINGS_CHAR); | |
645 | - log("change DeleteLeadingsMode to ", value); | |
646 | - inputState = inputState.setString(DeleteLeadingsMode, value); | |
647 | - } else if (key.equals(TKSettingsActivity.PREF_DEL_AFTER_CLUSTER)) { | |
648 | - boolean value = sharedPref.getBoolean(TKSettingsActivity.PREF_DEL_AFTER_CLUSTER, false); | |
649 | - log("change DeleteAfterCluster to ", value); | |
650 | - inputState = inputState.setBoolean(DeleteAfterCluster, value); | |
651 | - } else if (key.equals(TKSettingsActivity.PREF_IM_SWITCH)) { | |
652 | - String value = sharedPref.getString(TKSettingsActivity.PREF_IM_SWITCH, LANGKEY_NEXT_IM); | |
653 | - log("change LanguageKey to ", value); | |
654 | - inputState = inputState.setString(LanguageKey, value); | |
655 | - } else if (key.equals(TKSettingsActivity.PREF_KEYBOARD_THEME)) { | |
656 | - String value = sharedPref.getString(TKSettingsActivity.PREF_KEYBOARD_THEME, kbdTheme); | |
657 | - log("change KeyboardTheme to ", value); | |
658 | - kbdTheme = value; | |
659 | - if (kbdView != null) | |
660 | - updateTheme(); | |
621 | + break; | |
622 | + case PREF_DICT_SUGGEST: { | |
623 | + boolean value = sharedPref.getBoolean(PREF_DICT_SUGGEST, false); | |
624 | + log("change DictSuggest to ", value); | |
625 | + inputState = inputState.setBoolean(DictSuggest, value); | |
626 | + if (value) { | |
627 | + dictReady.set(false); | |
628 | + TKBackgroundService.updateDatabase(this); | |
629 | + if (db == null) | |
630 | + db = new TKDatabase(this).getReadableDatabase(); | |
631 | + } else if (db != null) { | |
632 | + db.close(); | |
633 | + db = null; | |
634 | + TKBackgroundService.terminateDatabase(this); | |
635 | + } | |
636 | + } | |
637 | + break; | |
638 | + case PREF_DICT_HANJI: { | |
639 | + boolean value = sharedPref.getBoolean(PREF_DICT_HANJI, false); | |
640 | + log("change DictHanji to ", value); | |
641 | + inputState = inputState.setBoolean(DictHanji, value); | |
642 | + } | |
643 | + break; | |
644 | + case PREF_POJ_TONE_MARK: { | |
645 | + boolean value = sharedPref.getBoolean(PREF_POJ_TONE_MARK, false); | |
646 | + log("change PojToneMark to ", value); | |
647 | + inputState = inputState.setBoolean(PojToneMark, value); | |
648 | + } | |
649 | + break; | |
650 | + case PREF_ASPIRATION_TOGGLE: { | |
651 | + boolean value = sharedPref.getBoolean(PREF_ASPIRATION_TOGGLE, false); | |
652 | + log("change AspirationToggle to ", value); | |
653 | + inputState = inputState.setBoolean(AspirationToggle, value); | |
654 | + } | |
655 | + break; | |
656 | + case PREF_VOICELESS_TOGGLE: { | |
657 | + boolean value = sharedPref.getBoolean(PREF_VOICELESS_TOGGLE, false); | |
658 | + log("change VoicelessToggle to ", value); | |
659 | + inputState = inputState.setBoolean(VoicelessToggle, value); | |
660 | + } | |
661 | + break; | |
662 | + case PREF_PHONETIC_INPUT: { | |
663 | + boolean value = sharedPref.getBoolean(PREF_PHONETIC_INPUT, false); | |
664 | + log("change PhoneticInput to ", value); | |
665 | + inputState = inputState.setBoolean(PhoneticInput, value); | |
666 | + } | |
667 | + break; | |
668 | + case PREF_LEAD_REPLACE_LEAD: { | |
669 | + boolean value = sharedPref.getBoolean(PREF_LEAD_REPLACE_LEAD, false); | |
670 | + log("change LeadReplaceLead to ", value); | |
671 | + inputState = inputState.setBoolean(LeadReplaceLead, value); | |
672 | + } | |
673 | + break; | |
674 | + case PREF_GLOTAL_REPLACE: { | |
675 | + boolean value = sharedPref.getBoolean(PREF_GLOTAL_REPLACE, false); | |
676 | + log("change GlotalReplaceGlotal to ", value); | |
677 | + inputState = inputState.setBoolean(GlotalReplaceGlotal, value); | |
678 | + } | |
679 | + break; | |
680 | + case PREF_GLOTAL_TOGGLE: { | |
681 | + boolean value = sharedPref.getBoolean(PREF_GLOTAL_TOGGLE, false); | |
682 | + log("change GlotalToggleTone to ", value); | |
683 | + inputState = inputState.setBoolean(GlotalToggleTone, value); | |
684 | + } | |
685 | + break; | |
686 | + case PREF_DEL_VOWELS: { | |
687 | + String value = sharedPref.getString(PREF_DEL_VOWELS, DEL_VOWELS_CHAR); | |
688 | + log("change DeleteVowelsMode to ", value); | |
689 | + inputState = inputState.setString(DeleteVowelsMode, value); | |
690 | + } | |
691 | + break; | |
692 | + case PREF_DEL_LEADINGS: { | |
693 | + String value = sharedPref.getString(PREF_DEL_LEADINGS, DEL_LEADINGS_CHAR); | |
694 | + log("change DeleteLeadingsMode to ", value); | |
695 | + inputState = inputState.setString(DeleteLeadingsMode, value); | |
696 | + } | |
697 | + break; | |
698 | + case PREF_DEL_AFTER_CLUSTER: { | |
699 | + boolean value = sharedPref.getBoolean(PREF_DEL_AFTER_CLUSTER, false); | |
700 | + log("change DeleteAfterCluster to ", value); | |
701 | + inputState = inputState.setBoolean(DeleteAfterCluster, value); | |
702 | + } | |
703 | + break; | |
704 | + case PREF_IM_SWITCH: { | |
705 | + String value = sharedPref.getString(PREF_IM_SWITCH, LANGKEY_NEXT_IM); | |
706 | + log("change LanguageKey to ", value); | |
707 | + inputState = inputState.setString(LanguageKey, value); | |
708 | + } | |
709 | + break; | |
710 | + case PREF_KEYBOARD_THEME: { | |
711 | + String value = sharedPref.getString(PREF_KEYBOARD_THEME, kbdTheme); | |
712 | + log("change KeyboardTheme to ", value); | |
713 | + kbdTheme = value; | |
714 | + if (kbdView != null) | |
715 | + updateTheme(); | |
716 | + } | |
717 | + break; | |
661 | 718 | } |
662 | 719 | setInputState(inputState); |
663 | 720 | } |
@@ -27,6 +27,7 @@ | ||
27 | 27 | private static int keyIndex = 0; |
28 | 28 | // parameters |
29 | 29 | public static final TKState.Key DictSuggest = TKState.Key.valueOf(keyIndex++); |
30 | + public static final TKState.Key DictHanji = TKState.Key.valueOf(keyIndex++); | |
30 | 31 | public static final TKState.Key AutoDash = TKState.Key.valueOf(keyIndex++); |
31 | 32 | public static final TKState.Key PojToneMark = TKState.Key.valueOf(keyIndex++); |
32 | 33 | public static final TKState.Key ToneMarkStyle = TKState.Key.valueOf(keyIndex++); |
@@ -29,7 +29,7 @@ | ||
29 | 29 | import android.graphics.drawable.Drawable; |
30 | 30 | import android.inputmethodservice.Keyboard; |
31 | 31 | import android.inputmethodservice.KeyboardView; |
32 | -import android.support.v4.graphics.drawable.DrawableCompat; | |
32 | +import androidx.core.graphics.drawable.DrawableCompat; | |
33 | 33 | import android.util.AttributeSet; |
34 | 34 | |
35 | 35 | import java.util.List; |
@@ -20,7 +20,7 @@ | ||
20 | 20 | |
21 | 21 | import android.content.Context; |
22 | 22 | import android.os.Bundle; |
23 | -import android.support.v7.app.AppCompatActivity; | |
23 | +import androidx.appcompat.app.AppCompatActivity; | |
24 | 24 | |
25 | 25 | public class TKLicenseActivity extends AppCompatActivity { |
26 | 26 | @Override |
@@ -25,10 +25,10 @@ | ||
25 | 25 | import android.os.Bundle; |
26 | 26 | import android.os.IBinder; |
27 | 27 | import android.provider.Settings; |
28 | -import android.support.design.widget.FloatingActionButton; | |
29 | -import android.support.design.widget.Snackbar; | |
30 | -import android.support.v7.app.AppCompatActivity; | |
31 | -import android.support.v7.widget.Toolbar; | |
28 | +import com.google.android.material.floatingactionbutton.FloatingActionButton; | |
29 | +import com.google.android.material.snackbar.Snackbar; | |
30 | +import androidx.appcompat.app.AppCompatActivity; | |
31 | +import androidx.appcompat.widget.Toolbar; | |
32 | 32 | import android.view.View; |
33 | 33 | import android.view.inputmethod.InputMethodInfo; |
34 | 34 | import android.view.inputmethod.InputMethodManager; |
@@ -22,7 +22,7 @@ | ||
22 | 22 | import android.content.Intent; |
23 | 23 | import android.os.Binder; |
24 | 24 | import android.os.IBinder; |
25 | -import android.support.annotation.Nullable; | |
25 | +import androidx.annotation.Nullable; | |
26 | 26 | |
27 | 27 | import java.util.Vector; |
28 | 28 |
@@ -21,11 +21,11 @@ | ||
21 | 21 | import android.content.res.Configuration; |
22 | 22 | import android.os.Bundle; |
23 | 23 | import android.preference.PreferenceActivity; |
24 | -import android.support.annotation.LayoutRes; | |
25 | -import android.support.annotation.Nullable; | |
26 | -import android.support.v7.app.ActionBar; | |
27 | -import android.support.v7.app.AppCompatDelegate; | |
28 | -import android.support.v7.widget.Toolbar; | |
24 | +import androidx.annotation.LayoutRes; | |
25 | +import androidx.annotation.Nullable; | |
26 | +import androidx.appcompat.app.ActionBar; | |
27 | +import androidx.appcompat.app.AppCompatDelegate; | |
28 | +import androidx.appcompat.widget.Toolbar; | |
29 | 29 | import android.view.MenuInflater; |
30 | 30 | import android.view.View; |
31 | 31 | import android.view.ViewGroup; |
@@ -31,6 +31,7 @@ | ||
31 | 31 | import java.util.concurrent.atomic.AtomicInteger; |
32 | 32 | |
33 | 33 | import static tw.iongchun.taigikbd.TKInputMethodService.SUBTYPE_POJ; |
34 | +import static tw.iongchun.taigikbd.TKInputState.DictHanji; | |
34 | 35 | import static tw.iongchun.taigikbd.TKInputState.Subtype; |
35 | 36 | import static tw.iongchun.taigikbd.TKViewState.Candidates; |
36 | 37 | import static tw.iongchun.taigikbd.TKViewState.ComposingText; |
@@ -61,6 +62,7 @@ | ||
61 | 62 | TKInputState inputState = param.getKey(); |
62 | 63 | TKViewState viewState = param.getValue(); |
63 | 64 | int subtype = inputState.getInteger(Subtype); |
65 | + boolean useHanji = inputState.getBoolean(DictHanji); | |
64 | 66 | String text = viewState.getString(ComposingText); |
65 | 67 | ArrayList<Boolean> ucList = new ArrayList<>(); |
66 | 68 | for (char ch : text.toCharArray()) { |
@@ -74,9 +76,9 @@ | ||
74 | 76 | // query exact prefix |
75 | 77 | String query1; |
76 | 78 | if (subtype == SUBTYPE_POJ) |
77 | - query1 = "select word from words_poj where word like ? order by weight desc, word limit " + CANDIDATE_MAX_NUM; | |
79 | + query1 = "select word, han from words_poj where word like ? order by weight desc, word limit " + CANDIDATE_MAX_NUM; | |
78 | 80 | else |
79 | - query1 = "select word from words where word like ? order by weight desc, word limit " + CANDIDATE_MAX_NUM; | |
81 | + query1 = "select word, han from words where word like ? order by weight desc, word limit " + CANDIDATE_MAX_NUM; | |
80 | 82 | c = db.rawQuery(query1, new String[] {text + '%'}); |
81 | 83 | if (queued.get() > 1) |
82 | 84 | return null; |
@@ -102,6 +104,11 @@ | ||
102 | 104 | } |
103 | 105 | word = new String(wchars); |
104 | 106 | candidates.add(word); |
107 | + if (useHanji) { | |
108 | + String han = c.getString(1); | |
109 | + if (han != null) | |
110 | + candidates.add(han); | |
111 | + } | |
105 | 112 | words.add(word); |
106 | 113 | count++; |
107 | 114 | } |
@@ -109,9 +116,9 @@ | ||
109 | 116 | // query prefix without tone |
110 | 117 | String query2; |
111 | 118 | if (subtype == SUBTYPE_POJ) |
112 | - query2 = "select word from words_poj where toneless like ? order by weight desc, word limit " + CANDIDATE_TONELESS_NUM; | |
119 | + query2 = "select word, han from words_poj where toneless like ? order by weight desc, word limit " + CANDIDATE_TONELESS_NUM; | |
113 | 120 | else |
114 | - query2 = "select word from words where toneless like ? order by weight desc, word limit " + CANDIDATE_TONELESS_NUM; | |
121 | + query2 = "select word, han from words where toneless like ? order by weight desc, word limit " + CANDIDATE_TONELESS_NUM; | |
115 | 122 | c = db.rawQuery(query2, new String[] {toneless + '%'}); |
116 | 123 | if (queued.get() > 1) { |
117 | 124 | candidates.clear(); |
@@ -138,6 +145,11 @@ | ||
138 | 145 | word = new String(wchars); |
139 | 146 | if (!words.contains(word)) { |
140 | 147 | candidates.add(word); |
148 | + if (useHanji) { | |
149 | + String han = c.getString(1); | |
150 | + if (han != null) | |
151 | + candidates.add(han); | |
152 | + } | |
141 | 153 | words.add(word); |
142 | 154 | count++; |
143 | 155 | } |
@@ -31,7 +31,7 @@ | ||
31 | 31 | import android.preference.PreferenceFragment; |
32 | 32 | import android.preference.PreferenceManager; |
33 | 33 | import android.provider.Settings; |
34 | -import android.support.v7.app.ActionBar; | |
34 | +import androidx.appcompat.app.ActionBar; | |
35 | 35 | import android.view.MenuItem; |
36 | 36 | import android.view.inputmethod.InputMethodInfo; |
37 | 37 | import android.view.inputmethod.InputMethodManager; |
@@ -51,6 +51,7 @@ | ||
51 | 51 | */ |
52 | 52 | public class TKSettingsActivity extends TKPreferenceActivity { |
53 | 53 | public static final String PREF_DICT_SUGGEST = "dict_suggest_switch"; |
54 | + public static final String PREF_DICT_HANJI = "dict_hanji_switch"; | |
54 | 55 | public static final String PREF_AUTO_DASH = "auto_dash_switch"; |
55 | 56 | public static final String PREF_POJ_TONE_MARK = "poj_tone_mark_switch"; |
56 | 57 | public static final String PREF_TONE_MARK_STYLE = "tone_mark_style"; |
@@ -17,7 +17,7 @@ | ||
17 | 17 | You should have received a copy of the GNU General Public License |
18 | 18 | along with Sim-sik ê Khí-pòo. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 | --> |
20 | -<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
20 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
21 | 21 | xmlns:app="http://schemas.android.com/apk/res-auto" |
22 | 22 | xmlns:tools="http://schemas.android.com/tools" |
23 | 23 | android:layout_width="match_parent" |
@@ -48,4 +48,4 @@ | ||
48 | 48 | android:textColor="@android:color/black"/> |
49 | 49 | </ScrollView> |
50 | 50 | |
51 | -</android.support.constraint.ConstraintLayout> | |
51 | +</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -17,7 +17,7 @@ | ||
17 | 17 | You should have received a copy of the GNU General Public License |
18 | 18 | along with Sim-sik ê Khí-pòo. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 | --> |
20 | -<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
20 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
21 | 21 | xmlns:app="http://schemas.android.com/apk/res-auto" |
22 | 22 | xmlns:tools="http://schemas.android.com/tools" |
23 | 23 | android:layout_width="match_parent" |
@@ -48,4 +48,4 @@ | ||
48 | 48 | android:textColor="@android:color/black"/> |
49 | 49 | </ScrollView> |
50 | 50 | |
51 | -</android.support.constraint.ConstraintLayout> | |
51 | +</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -17,7 +17,7 @@ | ||
17 | 17 | You should have received a copy of the GNU General Public License |
18 | 18 | along with Sim-sik ê Khí-pòo. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 | --> |
20 | -<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
20 | +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
21 | 21 | xmlns:app="http://schemas.android.com/apk/res-auto" |
22 | 22 | xmlns:tools="http://schemas.android.com/tools" |
23 | 23 | android:layout_width="match_parent" |
@@ -25,14 +25,14 @@ | ||
25 | 25 | android:fitsSystemWindows="true" |
26 | 26 | tools:context="tw.iongchun.taigikbd.TKLogActivity"> |
27 | 27 | |
28 | - <android.support.design.widget.AppBarLayout | |
28 | + <com.google.android.material.appbar.AppBarLayout | |
29 | 29 | android:id="@+id/app_bar" |
30 | 30 | android:layout_width="match_parent" |
31 | 31 | android:layout_height="@dimen/app_bar_height" |
32 | 32 | android:fitsSystemWindows="true" |
33 | 33 | android:theme="@style/AppTheme.AppBarOverlay"> |
34 | 34 | |
35 | - <android.support.design.widget.CollapsingToolbarLayout | |
35 | + <com.google.android.material.appbar.CollapsingToolbarLayout | |
36 | 36 | android:id="@+id/toolbar_layout" |
37 | 37 | android:layout_width="match_parent" |
38 | 38 | android:layout_height="match_parent" |
@@ -40,19 +40,19 @@ | ||
40 | 40 | app:contentScrim="?attr/colorPrimary" |
41 | 41 | app:layout_scrollFlags="scroll|exitUntilCollapsed"> |
42 | 42 | |
43 | - <android.support.v7.widget.Toolbar | |
43 | + <androidx.appcompat.widget.Toolbar | |
44 | 44 | android:id="@+id/toolbar" |
45 | 45 | android:layout_width="match_parent" |
46 | 46 | android:layout_height="?attr/actionBarSize" |
47 | 47 | app:layout_collapseMode="pin" |
48 | 48 | app:popupTheme="@style/AppTheme.PopupOverlay"/> |
49 | 49 | |
50 | - </android.support.design.widget.CollapsingToolbarLayout> | |
51 | - </android.support.design.widget.AppBarLayout> | |
50 | + </com.google.android.material.appbar.CollapsingToolbarLayout> | |
51 | + </com.google.android.material.appbar.AppBarLayout> | |
52 | 52 | |
53 | 53 | <include layout="@layout/content_log"/> |
54 | 54 | |
55 | - <android.support.design.widget.FloatingActionButton | |
55 | + <com.google.android.material.floatingactionbutton.FloatingActionButton | |
56 | 56 | android:id="@+id/fab" |
57 | 57 | android:layout_width="wrap_content" |
58 | 58 | android:layout_height="wrap_content" |
@@ -61,4 +61,4 @@ | ||
61 | 61 | app:layout_anchorGravity="bottom|end" |
62 | 62 | app:srcCompat="@android:drawable/ic_dialog_email"/> |
63 | 63 | |
64 | -</android.support.design.widget.CoordinatorLayout> | |
64 | +</androidx.coordinatorlayout.widget.CoordinatorLayout> |
@@ -17,7 +17,7 @@ | ||
17 | 17 | You should have received a copy of the GNU General Public License |
18 | 18 | along with Sim-sik ê Khí-pòo. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 | --> |
20 | -<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
20 | +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
21 | 21 | xmlns:app="http://schemas.android.com/apk/res-auto" |
22 | 22 | xmlns:tools="http://schemas.android.com/tools" |
23 | 23 | android:layout_width="match_parent" |
@@ -46,4 +46,4 @@ | ||
46 | 46 | |
47 | 47 | </LinearLayout> |
48 | 48 | |
49 | -</android.support.v4.widget.NestedScrollView> | |
49 | +</androidx.core.widget.NestedScrollView> |
@@ -42,6 +42,8 @@ | ||
42 | 42 | <string name="label_subtype_default">Bô tsí-tiānn (Tâi-lô)</string> |
43 | 43 | <string name="pref_title_dict_suggest">Sû-tián kiàn-gī</string> |
44 | 44 | <string name="pref_description_dict_suggest">Sú-iōng sû-tián lâi thē-kiong kiàn-gī ê sû</string> |
45 | + <string name="pref_title_dict_hanji">Hán-jī ê sû-tián</string> | |
46 | + <string name="pref_description_dict_hanji">Hán-jī hām Lô-má-jī ê sû lóng-mā ē kiàn-gī</string> | |
45 | 47 | <string name="pref_title_auto_dash">Tsū-tōng liân-jī</string> |
46 | 48 | <string name="pref_description_auto_dash">Tsū-tōng tī ln̄g ê im-tsiat tiong-kan ka liân-jī-hō</string> |
47 | 49 | <string name="pref_title_glotal_replace_glotal">Ji̍p-siann iu-sian</string> |
@@ -24,6 +24,8 @@ | ||
24 | 24 | <string name="label_subtype_tailo">台羅</string> |
25 | 25 | <string name="pref_title_dict_suggest">辭典建議</string> |
26 | 26 | <string name="pref_description_dict_suggest">使用辭典來提供建議詞</string> |
27 | + <string name="pref_title_dict_hanji">漢字辭典</string> | |
28 | + <string name="pref_description_dict_hanji">提供羅馬字連同漢字的建議詞</string> | |
27 | 29 | <string name="pref_title_auto_dash">自動連字</string> |
28 | 30 | <string name="pref_description_auto_dash">自動在兩個音節間加入連字符號</string> |
29 | 31 | <string name="pref_title_glotal_replace_glotal">入聲優先</string> |
@@ -42,6 +42,8 @@ | ||
42 | 42 | <string name="label_subtype_default">Bô tsí-tiānn (Tâi-lô)</string> |
43 | 43 | <string name="pref_title_dict_suggest">Sû-tián kiàn-gī</string> |
44 | 44 | <string name="pref_description_dict_suggest">Sú-iōng sû-tián lâi thē-kiong kiàn-gī ê sû</string> |
45 | + <string name="pref_title_dict_hanji">Hán-jī ê sû-tián</string> | |
46 | + <string name="pref_description_dict_hanji">Hán-jī hām Lô-má-jī ê sû lóng-mā ē kiàn-gī</string> | |
45 | 47 | <string name="pref_title_auto_dash">Tsū-tōng liân-jī</string> |
46 | 48 | <string name="pref_description_auto_dash">Tsū-tōng tī ln̄g ê im-tsiat tiong-kan ka liân-jī-hō</string> |
47 | 49 | <string name="pref_title_glotal_replace_glotal">Ji̍p-siann iu-sian</string> |
@@ -23,6 +23,11 @@ | ||
23 | 23 | android:key="dict_suggest_switch" |
24 | 24 | android:summary="@string/pref_description_dict_suggest" |
25 | 25 | android:title="@string/pref_title_dict_suggest"/> |
26 | + <SwitchPreference | |
27 | + android:defaultValue="true" | |
28 | + android:key="dict_hanji_switch" | |
29 | + android:summary="@string/pref_description_dict_hanji" | |
30 | + android:title="@string/pref_title_dict_hanji"/> | |
26 | 31 | |
27 | 32 | <SwitchPreference |
28 | 33 | android:defaultValue="true" |
@@ -9,7 +9,7 @@ | ||
9 | 9 | - android-sdk |
10 | 10 | script: |
11 | 11 | # download and unzip |
12 | - - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
12 | + - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip | |
13 | 13 | - unzip -o -qq android-sdk.zip -d android-sdk |
14 | 14 | # setup environment and path |
15 | 15 | - export ANDROID_HOME="/opt/atlassian/pipelines/agent/build/android-sdk" |
@@ -17,8 +17,8 @@ | ||
17 | 17 | # download packages |
18 | 18 | - yes | sdkmanager --licenses |
19 | 19 | - yes | sdkmanager "platform-tools" |
20 | - - yes | sdkmanager "platforms;android-27" | |
21 | - - yes | sdkmanager "build-tools;28.0.0" | |
20 | + - yes | sdkmanager "platforms;android-29" | |
21 | + - yes | sdkmanager "build-tools;29.0.2" | |
22 | 22 | # - yes | sdkmanager "extras;android;m2repository" |
23 | 23 | # - yes | sdkmanager "extras;google;m2repository" |
24 | 24 | # - yes | sdkmanager "extras;google;instantapps" |
@@ -6,7 +6,7 @@ | ||
6 | 6 | google() |
7 | 7 | } |
8 | 8 | dependencies { |
9 | - classpath 'com.android.tools.build:gradle:3.5.0' | |
9 | + classpath 'com.android.tools.build:gradle:4.0.0' | |
10 | 10 | |
11 | 11 | // NOTE: Do not place your application dependencies here; they belong |
12 | 12 | // in the individual module build.gradle files |
@@ -9,6 +9,8 @@ | ||
9 | 9 | |
10 | 10 | # Specifies the JVM arguments used for the daemon process. |
11 | 11 | # The setting is particularly useful for tweaking memory settings. |
12 | +android.enableJetifier=true | |
13 | +android.useAndroidX=true | |
12 | 14 | org.gradle.jvmargs=-Xmx1536m |
13 | 15 | |
14 | 16 | # When configured, Gradle will run in incubating parallel mode. |
@@ -1,6 +1,6 @@ | ||
1 | -#Sat Aug 24 20:07:25 CST 2019 | |
1 | +#Mon Jun 22 21:37:48 CST 2020 | |
2 | 2 | distributionBase=GRADLE_USER_HOME |
3 | 3 | distributionPath=wrapper/dists |
4 | 4 | zipStoreBase=GRADLE_USER_HOME |
5 | 5 | zipStorePath=wrapper/dists |
6 | -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip | |
6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip |