diff options
author | 2014-01-24 14:03:08 +0900 | |
---|---|---|
committer | 2014-01-27 18:42:29 +0900 | |
commit | f59487379e8d4153fb3a6bcd7e8aaa383454e7f2 (patch) | |
tree | 98087ec83313235367115be3cefa5a77f18d2b7d /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | |
parent | 10460441db805e78c3384cdba4fe011996221534 (diff) | |
download | latinime-f59487379e8d4153fb3a6bcd7e8aaa383454e7f2.tar.gz latinime-f59487379e8d4153fb3a6bcd7e8aaa383454e7f2.tar.xz latinime-f59487379e8d4153fb3a6bcd7e8aaa383454e7f2.zip |
[IL79] Some refactoring
Bug: 8636060
Change-Id: I931c553f68a1f15d22711a661dbffd4e5d421979
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index b81129beb..7193ab5ef 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -195,24 +195,7 @@ public final class InputLogic { final int oldSelStart, final int oldSelEnd, final int newSelStart, final int newSelEnd, final int composingSpanStart, final int composingSpanEnd) { - final boolean selectionChanged = oldSelStart != newSelStart || oldSelEnd != newSelEnd; - - // if composingSpanStart and composingSpanEnd are -1, it means there is no composing - // span in the view - we can use that to narrow down whether the cursor was moved - // by us or not. If we are composing a word but there is no composing span, then - // we know for sure the cursor moved while we were composing and we should reset - // the state. TODO: rescind this policy: the framework never removes the composing - // span on its own accord while editing. This test is useless. - final boolean noComposingSpan = composingSpanStart == -1 && composingSpanEnd == -1; - - // If the keyboard is not visible, we don't need to do all the housekeeping work, as it - // will be reset when the keyboard shows up anyway. - // TODO: revisit this when LatinIME supports hardware keyboards. - // NOTE: the test harness subclasses LatinIME and overrides isInputViewShown(). - // TODO: find a better way to simulate actual execution. - // TODO: remove the #isInputViewShown() call from here. - if (mLatinIME.isInputViewShown() && !mConnection.isBelatedExpectedUpdate(oldSelStart, - newSelStart, oldSelEnd, newSelEnd)) { + if (!mConnection.isBelatedExpectedUpdate(oldSelStart, newSelStart, oldSelEnd, newSelEnd)) { // TODO: the following is probably better done in resetEntireInputState(). // it should only happen when the cursor moved, and the very purpose of the // test below is to narrow down whether this happened or not. Likewise with @@ -221,6 +204,15 @@ public final class InputLogic { // state-related special processing to kick in. mSpaceState = SpaceState.NONE; + // if composingSpanStart and composingSpanEnd are -1, it means there is no composing + // span in the view - we can use that to narrow down whether the cursor was moved + // by us or not. If we are composing a word but there is no composing span, then + // we know for sure the cursor moved while we were composing and we should reset + // the state. TODO: rescind this policy: the framework never removes the composing + // span on its own accord while editing. This test is useless. + final boolean noComposingSpan = composingSpanStart == -1 && composingSpanEnd == -1; + final boolean selectionChanged = oldSelStart != newSelStart || oldSelEnd != newSelEnd; + // TODO: is it still necessary to test for composingSpan related stuff? final boolean selectionChangedOrSafeToReset = selectionChanged || (!mWordComposer.isComposingWord()) || noComposingSpan; |