Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Zhuyin input #1161

Merged
merged 4 commits into from
May 8, 2019
Merged

Zhuyin input #1161

merged 4 commits into from
May 8, 2019

Conversation

daoshengmu
Copy link
Contributor

Per #640, we implement this for Zhuyin Keyboard.

Copy link
Contributor

@cvan cvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looking good

app/src/main/res/values/dimen.xml Outdated Show resolved Hide resolved
app/src/main/res/values/dimen.xml Outdated Show resolved Hide resolved
app/src/main/res/values/non_L10n.xml Outdated Show resolved Hide resolved
app/src/main/res/xml/keyboard_zhuyin.xml Outdated Show resolved Hide resolved
app/src/main/res/xml/keyboard_zhuyin.xml Outdated Show resolved Hide resolved

class DBWordHelper extends SQLiteAssetHelper {
private static final String DATABASE_NAME = "zhuyin_words.db";
private static final int DATABASE_VERSION = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • how do we plan to handle migrations?
  • can you file a follow-up bug to document the procedure for migrating SQLite database schemas in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cvan If we want to update the database, we can follow the instruction here. But, our dictionary only needs to be read for users instead of writing. So, I guess we can handle this at our internal process.

}

private void addExtraKeyMaps() {
addKeyCode("ㄅ", "10", "ㄅ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is there any way we can avoid duplicating the characters in the layout code?

Copy link
Contributor Author

@daoshengmu daoshengmu May 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want, we can do it, but that will make it be more difficult to be read.

    private String findLabelFromKey(int primaryCode) {
        for (Key key : mKeyboard.getKeys()) {
            if (key.codes[0] == primaryCode) {
                return "" + key.label;
            }
        }

        Log.e(LOGTAG, "Error can't find label from Zhuyin keys: " + primaryCode);
        return null;
    }

Then addKeyCode(Character.toString((char)0x3105), "10", findLabelFromKey(0x3105));

Or
addKeyCode(“ㄅ”, "10", findLabelFromKey(int(“ㄅ”));
@cvan
I would like like to choose the second one if we want.

Copy link
Contributor

@MortimerGoro MortimerGoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good,

After a rebase and fixed nits I think it's ready to land.

@@ -679,6 +679,7 @@ private void postUICommand(Runnable aRunnable) {
private void updateCandidates() {
if (mInputConnection == null || !mCurrentKeyboard.supportsAutoCompletion()) {
setAutoCompletionVisible(false);
updateSpecialKeyLabels();
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MortimerGoro . I notice we also need to update key labels for English keyboard when doing switch from SymbolKeyboard although it does not support autocompletion.

@bluemarvin
Copy link
Contributor

Landing all keyboard PRs.

@bluemarvin bluemarvin merged commit 8e891de into master May 8, 2019
@cvan cvan deleted the zhuyinInput branch May 9, 2019 00:19
@cvan cvan mentioned this pull request May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants