@@ -869,7 +869,9 @@ public void onFinishInputView(boolean finishingInput) {
869
869
// Dismiss any pop-ups when the input-view is being finished and hidden.
870
870
mainKeyboardView .closing ();
871
871
performEscape ();
872
- inputFeedbackManager .releaseSoundPool ();
872
+ if (inputFeedbackManager != null ) {
873
+ inputFeedbackManager .releaseSoundPool ();
874
+ }
873
875
try {
874
876
hideCompositionView ();
875
877
} catch (Exception e ) {
@@ -1003,9 +1005,13 @@ private boolean onKeyEvent(@NonNull KeyEvent event) {
1003
1005
}
1004
1006
1005
1007
final int unicodeChar = event .getUnicodeChar ();
1006
- int mask = event .getMetaState ();
1007
- if (unicodeChar > 0 ) {
1008
- keyCode = unicodeChar ;
1008
+ final String s = String .valueOf ((char ) unicodeChar );
1009
+ final int i = Event .getClickCode (s );
1010
+ int mask = 0 ;
1011
+ if (i > 0 ) {
1012
+ keyCode = i ;
1013
+ } else { // 空格、回車等
1014
+ mask = event .getMetaState ();
1009
1015
}
1010
1016
final boolean ret = handleKey (keyCode , mask );
1011
1017
if (isComposing ()) setCandidatesViewShown (textInputManager .isComposable ()); // 藍牙鍵盤打字時顯示候選欄
@@ -1205,11 +1211,9 @@ public int updateComposing() {
1205
1211
Timber .d ("updateComposing() SymbolKeyboardType=%s" , symbolKeyboardType .toString ());
1206
1212
if (symbolKeyboardType != SymbolKeyboardType .NO_KEY
1207
1213
&& symbolKeyboardType != SymbolKeyboardType .CANDIDATE ) {
1208
- mComposition .setWindow ();
1209
- showCompositionView (false );
1210
- return 0 ;
1214
+ mComposition .getRootView ().setVisibility (View .GONE );
1211
1215
} else {
1212
- mComposition .setVisibility (View .VISIBLE );
1216
+ mComposition .getRootView (). setVisibility (View .VISIBLE );
1213
1217
startNum = mComposition .setWindow (minPopupSize , minPopupCheckSize , Integer .MAX_VALUE );
1214
1218
mCandidate .setText (startNum );
1215
1219
// if isCursorUpdated, showCompositionView will be called in onUpdateCursorAnchorInfo
0 commit comments