|
35 | 35 | import android.os.Handler;
|
36 | 36 | import android.os.Looper;
|
37 | 37 | import android.os.Message;
|
| 38 | +import android.text.InputType; |
38 | 39 | import android.text.TextUtils;
|
39 | 40 | import android.view.Gravity;
|
40 | 41 | import android.view.KeyEvent;
|
|
96 | 97 | public class Trime extends LifecycleInputMethodService {
|
97 | 98 | private static Trime self = null;
|
98 | 99 | private LiquidKeyboard liquidKeyboard;
|
| 100 | + private boolean normalTextEditor; |
99 | 101 |
|
100 | 102 | @NonNull
|
101 | 103 | private Preferences getPrefs() {
|
@@ -697,13 +699,54 @@ public void onStartInputView(EditorInfo attribute, boolean restarting) {
|
697 | 699 | bindKeyboardToInputView();
|
698 | 700 | if (!restarting) setNavBarColor();
|
699 | 701 | setCandidatesViewShown(!Rime.isEmpty()); // 軟鍵盤出現時顯示候選欄
|
700 |
| - activeEditorInstance.cacheDraft(); |
701 |
| - addDraft(); |
| 702 | + |
| 703 | + switch (attribute.inputType & InputType.TYPE_MASK_VARIATION) { |
| 704 | + case InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: |
| 705 | + case InputType.TYPE_TEXT_VARIATION_PASSWORD: |
| 706 | + case InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: |
| 707 | + case InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: |
| 708 | + case InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD: |
| 709 | + Timber.i( |
| 710 | + "EditorInfo: private;" |
| 711 | + + " packageName" |
| 712 | + + attribute.packageName |
| 713 | + + "; fieldName" |
| 714 | + + attribute.fieldName |
| 715 | + + "; actionLabel" |
| 716 | + + attribute.actionLabel |
| 717 | + + "; inputType" |
| 718 | + + attribute.inputType |
| 719 | + + "; &v " |
| 720 | + + (attribute.inputType & InputType.TYPE_MASK_VARIATION) |
| 721 | + + "; &c " |
| 722 | + + (attribute.inputType & InputType.TYPE_MASK_CLASS)); |
| 723 | + normalTextEditor = false; |
| 724 | + break; |
| 725 | + |
| 726 | + default: |
| 727 | + Timber.i( |
| 728 | + "EditorInfo: normal;" |
| 729 | + + " packageName" |
| 730 | + + attribute.packageName |
| 731 | + + "; fieldName" |
| 732 | + + attribute.fieldName |
| 733 | + + "; actionLabel" |
| 734 | + + attribute.actionLabel |
| 735 | + + "; inputType" |
| 736 | + + attribute.inputType |
| 737 | + + "; &v " |
| 738 | + + (attribute.inputType & InputType.TYPE_MASK_VARIATION) |
| 739 | + + "; &c " |
| 740 | + + (attribute.inputType & InputType.TYPE_MASK_CLASS)); |
| 741 | + normalTextEditor = true; |
| 742 | + activeEditorInstance.cacheDraft(); |
| 743 | + addDraft(); |
| 744 | + } |
702 | 745 | }
|
703 | 746 |
|
704 | 747 | @Override
|
705 | 748 | public void onFinishInputView(boolean finishingInput) {
|
706 |
| - addDraft(); |
| 749 | + if (normalTextEditor) addDraft(); |
707 | 750 | super.onFinishInputView(finishingInput);
|
708 | 751 | // Dismiss any pop-ups when the input-view is being finished and hidden.
|
709 | 752 | mainKeyboardView.closing();
|
|
0 commit comments