-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for resizing alphabetic keyboard with based on language #1177
Conversation
90743e8
to
4dc1733
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running this patch on Oculus Go, I saw the keyboard width is wrong when launching the custom keyboard at the first time. There is a grey layer upon the keyboard when choosing languages, its width is also wrong at the beginning.
// Fall back to english. | ||
mCurrentKeyboard = getKeyboardForLocale(Locale.ENGLISH); | ||
keyboard = getKeyboardForLocale(Locale.GERMAN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo? It looks like it should still be getKeyboardForLocale(Locale.ENGLISH);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, yes it was a typo (changed it for a test)
@@ -568,10 +579,20 @@ private void handleGlobeClick() { | |||
|
|||
private void handleLanguageChange(KeyboardInterface aKeyboard) { | |||
mCurrentKeyboard = aKeyboard; | |||
int width = getKeyboardWidth(mCurrentKeyboard.getAlphabeticKeyboardWidth()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to add "final" to when it is a constant.
Resources resources = aContext.getResources(); | ||
DisplayMetrics metrics = resources.getDisplayMetrics(); | ||
float px = dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT); | ||
int px = (int) Math.ceil(dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT)); | ||
return px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just return (int) Math.ceil(dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
SettingsStore.getInstance(getContext()).setSelectedKeyboard(aKeyboard.getLocale()); | ||
mKeyboardView.setKeyboard(mCurrentKeyboard.getAlphabeticKeyboard()); | ||
hideOverlays(); | ||
updateCandidates(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this newline.
4dc1733
to
9f38ea3
Compare
9f38ea3
to
604c020
Compare
I fixed all issues, I'm going to merge this because I need it for other PRs. We can test the work together when we land the next keyboard updates |
I just confirmed it works properly on Focus Plus. Good job! |
While implementing the german keyboard I had some width space problems (they have a extra letter in the same line as
enter
). I tried this as a solution but then I switched to making keys a bit smaller.I believe @daoshengmu also needs this feature for Zhuyin keybord. It may be required for russian too.