@@ -481,44 +481,49 @@ private void showCompositionView() {
481
481
}
482
482
483
483
private void loadBackground () {
484
- final Config imeConfig = getImeConfig ();
484
+ final Config mConfig = getImeConfig ();
485
485
final int orientation = getResources ().getConfiguration ().orientation ;
486
- final int [] padding =
487
- imeConfig .getKeyboardPadding (
488
- oneHandMode , orientation == Configuration .ORIENTATION_LANDSCAPE );
486
+
487
+ if (mPopupWindow != null ) {
488
+ final Drawable d =
489
+ mConfig .getDrawable (
490
+ "text_back_color" ,
491
+ "layout/border" ,
492
+ "border_color" ,
493
+ "layout/round_corner" ,
494
+ "layout/alpha" );
495
+ if (d != null ) mPopupWindow .setBackgroundDrawable (d );
496
+ if (VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP )
497
+ mPopupWindow .setElevation (mConfig .getPixel ("layout/elevation" ));
498
+ }
499
+
500
+ if (mCandidateRoot != null ) {
501
+ final Drawable d2 =
502
+ mConfig .getDrawable (
503
+ "candidate_background" ,
504
+ "candidate_border" ,
505
+ "candidate_border_color" ,
506
+ "candidate_border_round" ,
507
+ null );
508
+ if (d2 != null ) mCandidateRoot .setBackground (d2 );
509
+ }
510
+
511
+ if (inputRootBinding == null ) return ;
512
+
513
+ int [] padding =
514
+ mConfig .getKeyboardPadding (oneHandMode , orientation == Configuration .ORIENTATION_LANDSCAPE );
489
515
Timber .i ("padding= %s %s %s" , padding [0 ], padding [1 ], padding [2 ]);
490
516
mainKeyboardView .setPadding (padding [0 ], 0 , padding [1 ], padding [2 ]);
491
517
492
- final Drawable d =
493
- imeConfig .getDrawable (
494
- "text_back_color" ,
495
- "layout/border" ,
496
- "border_color" ,
497
- "layout/round_corner" ,
498
- "layout/alpha" );
499
- if (d != null ) mPopupWindow .setBackgroundDrawable (d );
500
- if (VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP )
501
- mPopupWindow .setElevation (imeConfig .getPixel ("layout/elevation" ));
502
-
503
- final Drawable d2 =
504
- imeConfig .getDrawable (
505
- "candidate_background" ,
506
- "candidate_border" ,
507
- "candidate_border_color" ,
508
- "candidate_border_round" ,
509
- null );
510
-
511
- if (d2 != null ) mCandidateRoot .setBackground (d2 );
512
-
513
- final Drawable d3 = imeConfig .getDrawable_ ("root_background" );
518
+ final Drawable d3 = mConfig .getDrawable_ ("root_background" );
514
519
if (d3 != null ) {
515
520
inputRootBinding .inputRoot .setBackground (d3 );
516
521
} else {
517
522
// 避免因为键盘整体透明而造成的异常
518
523
inputRootBinding .inputRoot .setBackgroundColor (Color .WHITE );
519
524
}
520
525
521
- tabView .reset (this );
526
+ tabView .reset (self );
522
527
}
523
528
524
529
public void resetKeyboard () {
@@ -543,6 +548,7 @@ public void resetCandidate() {
543
548
544
549
/** 重置鍵盤、候選條、狀態欄等 !!注意,如果其中調用Rime.setOption,切換方案會卡住 */
545
550
private void reset () {
551
+ if (inputRootBinding == null ) return ;
546
552
getImeConfig ().reset ();
547
553
loadConfig ();
548
554
getImeConfig ().initCurrentColors ();
@@ -1302,7 +1308,8 @@ private String getActiveText(int type) {
1302
1308
1303
1309
/** 更新Rime的中西文狀態、編輯區文本 */
1304
1310
public void updateComposing () {
1305
- final @ Nullable InputConnection ic = getCurrentInputConnection ();
1311
+ final InputConnection ic = getCurrentInputConnection ();
1312
+ if (ic == null ) return ;
1306
1313
if (inlinePreedit != InlineModeType .INLINE_NONE ) { // 嵌入模式
1307
1314
String s = "" ;
1308
1315
switch (inlinePreedit ) {
0 commit comments