Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Chinese Pinyin keyboard (#1116)
* Implement Chinese Pinyin keyboard * Fix composed text while selecting. Fix some nits. * Clear composed text when the keyboard is dismissed * Fix backspace when composing text is selected * Remove spaces when finalizing text with enter key
- Loading branch information
1 parent
cf09d39
commit a555d88
Showing
20 changed files
with
1,159 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/BaseKeyboard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.mozilla.vrbrowser.ui.keyboards; | ||
|
||
import android.content.Context; | ||
import android.view.inputmethod.EditorInfo; | ||
|
||
import org.mozilla.vrbrowser.R; | ||
import org.mozilla.vrbrowser.utils.StringUtils; | ||
|
||
import java.util.Locale; | ||
|
||
public abstract class BaseKeyboard implements KeyboardInterface { | ||
protected Context mContext; | ||
BaseKeyboard(Context aContext) { | ||
mContext = aContext; | ||
} | ||
|
||
@Override | ||
public String getEnterKeyText(int aIMEOptions, String aComposingText) { | ||
Locale locale = getLocale(); | ||
switch (aIMEOptions & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { | ||
case EditorInfo.IME_ACTION_GO: | ||
return StringUtils.getStringByLocale(mContext, R.string.keyboard_go_label, locale); | ||
case EditorInfo.IME_ACTION_NEXT: | ||
return StringUtils.getStringByLocale(mContext, R.string.keyboard_next_label, locale); | ||
case EditorInfo.IME_ACTION_SEARCH: | ||
return StringUtils.getStringByLocale(mContext, R.string.keyboard_search_label, locale); | ||
case EditorInfo.IME_ACTION_SEND: | ||
return StringUtils.getStringByLocale(mContext, R.string.keyboard_send_label, locale); | ||
default: | ||
return StringUtils.getStringByLocale(mContext, R.string.keyboard_enter_label, locale); | ||
} | ||
} | ||
} |
Oops, something went wrong.