Commit Graph

132 Commits (7b673c72651aa7dbfc3fc87fe2190d8cffb320c1)

Author SHA1 Message Date
Jean Chalard 3a9b2430a5 Fix many small nits.
...the interaction of which results in a very bad bug.

Bug: 11648854
Change-Id: I774489e384388f187e72b9ac091ab387c5e1a79a
2013-11-12 22:44:59 -08:00
Jean Chalard 8a1675379e Stopgap solution for a crash.
This returns the wrong string, but since it's used for getting the
previous word for bigrams, it only results in slightly worse
suggestions quality.

Bug: 11273655
Change-Id: I6ce5de2f76effc453ca691a654ab6bf17445b9e7
2013-10-22 05:23:48 -07:00
Jean Chalard 10581e68af Make the sentence separator a resource.
This will help handing correctly the armenian full stop.

Bug: 10082781
Change-Id: Id7bb219ebd89daba203216eab362d1cc26a65a36
2013-10-08 15:28:43 +09:00
Ken Wakasa f56b82f809 Fix the offdevice regression test build
Followup to If4e44eca3cdc5bb02cf2e0c8c44ecd4bf27fae57

bug: 10622489
Change-Id: If98b2c75725f8692f0c2b41c33e448086404479b
2013-09-25 19:13:47 +09:00
Jean Chalard 3d68b06662 Copy only the spans we are interested in.
The PARAGRAPH type of span is dangerous, as concatenating
CharSequences that contain it may crash. We also don't use
other spans than SuggestionSpans, so we don't copy them.

Bug: 10622489
Change-Id: If4e44eca3cdc5bb02cf2e0c8c44ecd4bf27fae57
2013-09-24 19:04:51 +09:00
Jean Chalard f1d8aa46f9 Detect cases where rotation messes with initialization
...and do a best effort to fix it.

Bug: 10323080
Bug: 10252066
Change-Id: Icb3c9fe85005406bdfce0b7bb143ba0a910a0ddb
2013-09-20 22:21:28 +09:00
Jean Chalard 8f02f1a118 Fix a bug where null would be converted to "null"
It's unclear what the concrete effects of this are, but they are not
very strong. This only happens in corner cases, when the input
connection is not active - while rotating, for example.

Change-Id: I1d22459a6e94a8ecccb53cfcbc2d301b1d502204
2013-09-20 15:45:51 +09:00
Kurt Partridge 6c94a18a28 Fix cursor state bug
InputConnection#finishComposingText() should not change the position of the cursor,
so neither should it change its internal expectation of the cursor's position.

Change-Id: Ib3d39a5743cd1e8e356f438b04a5c30279430b2a
2013-08-21 17:55:35 -07:00
Jean Chalard 522d13c302 Have double-space-to-period cancel leave a single space
Bug: 8911898
Change-Id: Ifb4bb63c14dc960d0a53f1511908830093cca012
2013-08-08 11:49:27 +09:00
Jean Chalard aa108f1d7f Clarify the expected cursor position in RichInputConnection.
Change-Id: I4d36a23567415c3a293a588b51b46006256c148f
2013-07-31 12:22:15 +09:00
Jean Chalard 0a064a5d88 Small optimization
Bug: 8864306
Change-Id: Ic8eecd64eff6a1150a90b9f5ec9ebbc5f1d2a6a9
2013-07-26 20:17:55 +09:00
Jean Chalard 8c6537edbd Use cached data for getTextBeforeCursor.
Bug: 8864306
Change-Id: Ia146f711f1de4336d7e3363208ab92eba856f5e1
2013-07-26 20:17:52 +09:00
Jean Chalard 38e9802690 Merge "Revert "Very simple refactoring"" 2013-07-26 06:58:44 +00:00
Jean Chalard c6a07e16a5 Revert "Very simple refactoring"
This reverts commit f712dc9a4f.
It turns out this refactoring is not useful after all.

Change-Id: I0145c907b3cc5ac9a30a59abcd719cb546c9bd3a
2013-07-26 06:46:56 +00:00
Jean Chalard 0dd23544ff Merge "Very simple refactoring" 2013-07-26 05:30:47 +00:00
Satoshi Kataoka ffcbbaf127 Refactor on UserHistoryDictionary
Bug: 9429906
Change-Id: I576a91643bdaf5017cc826ac2e07a74a9a275d60
2013-07-26 13:00:19 +09:00
Jean Chalard f712dc9a4f Very simple refactoring
Bug: 8864306
Change-Id: I5c9b118cb6a8eb59efc52d5534b10fcab93182d6
2013-07-26 12:57:12 +09:00
Ken Wakasa a7d2fc6bef Move settings related classes to "settings"
Change-Id: Id170dbfe2dcfc93130b7be4a84615940403ec37f
2013-07-22 16:35:44 +09:00
Tadashi G. Takaoka f87e8f7ec1 Handling key repeat by emulating key press and code input
This change also eliminates a reference of
AudioAndHapticFeedbackManager from KeyboardSwitcher and MainKeyboard.

Bug: 6522943
Change-Id: Iac42ec8ff00c66deb76a660ffc07477923a58959
2013-07-02 19:50:34 +09:00
Jean Chalard 675bcf191c Move Range out of RichInputConnection and rename it.
Range has grown a bit too big to stay an internal class.

Change-Id: Ic3fbc48a5d10776eedd7559c4d696e5926b88288
2013-07-01 15:41:13 +09:00
Jean Chalard 2f7f6257b6 Ignore spans that are not the right size.
Bug: 8839763
Bug: 8862327
Change-Id: I5d49c86edcbc0fc1b2b147856437cfbadd678377
2013-06-26 23:02:50 +09:00
Jean Chalard 7fcf304c97 Fixing follow-up to I548d899b
I548d899b introduced a new method to fix a sync miss between
the cursor position and the cached cursor position, but did not
take into account that it should also update the cached text
before and after the cursor in this case and that there was
already a method for doing this.

Change-Id: I31bd741893207c822827304e77791b1159774e1a
2013-06-26 15:28:42 +09:00
Ken Wakasa 03118a2760 Cleanup under the utils package
Change-Id: If2f7bd1346cc5085bf57645830f0faac44d017e4
2013-06-25 17:09:12 +09:00
Jean Chalard 10585620bd Merge "Fix a bug in the cached cursor pos, and simplify selection handling" 2013-06-25 05:00:11 +00:00
Ken Wakasa bc1813186d Merge "Move util classes to the latin/utils directory" 2013-06-24 08:49:06 +00:00
Ken Wakasa e28eba5074 Move util classes to the latin/utils directory
Change-Id: I1c5b27c8edf231680edb8d96f63b9d04cfc6a6fa
2013-06-24 17:04:40 +09:00
Jean Chalard e8c4b99e56 Refactor text range to be able to get spans larger than the word
This changes how the Range class stores its data, but not its
functionality. It also improves encapsulation a bit.

Bug: 8839763
Bug: 8862327
Change-Id: I5bd583b3fc96a99b93a2632882d8fd587c03ab76
2013-06-24 12:31:14 +09:00
Jean Chalard e5dee0af4a Fix a bug in the cached cursor pos, and simplify selection handling
The documentation for setComposingRegion states explicitly
that it does not move the cursor. This is just a bug.
This does not have any ill effects right now, but it will have
in later changes if not fixed.

As for the selection handling, the specific test that this code
removes used to serve a purpose, but it does not any more because
the code using the value has been much sanitized. Now the variable
can just take the obvious value, and become so self-explanatory
that the comments are unnecessary.

Change-Id: I548d899b38776bd3ab5f5361aab0d89d98f12e73
2013-06-21 18:15:07 +09:00
Jean Chalard 9f9cc03277 Optimizations and safeguards.
- Don't call finishComposingText when useless.
- Add safeguards against calling setComposingRegion when the
  data returned by the editor is inconsistent.
- Cancel pending recorrection messages when new messages arrive.

Bug: 8842941
Bug: 8845001
Change-Id: I939701033cf5c2bbd85871ecf83e329021ddeb91
2013-05-08 18:47:10 +09:00
Jean Chalard 73ec85b8ad Don't insert automatic spaces when text looks like a URL
This is about as ad-hoc as it gets, but then again, what we want
is probably as ad-hoc as it gets.
All URL boxes I know of double as search bars, and not adding
automatic spaces there sucks (e.g. in Chrome URL bar).
And in other boxes actually you don't want to add a space if
it looks like a URL. QSB isn't even a search box, and it behaves
like this.

So I think this is actually the right answer to the problem.

Bug: 7062925
Change-Id: Ib09472b34644fd5bf2dc84bb97cedeeba28bcd02
2013-04-16 18:03:49 +09:00
Jean Chalard 2995abe7aa Have Latin IME re-capitalize a selected string
Upon pressing Shift, if there is currently a selected string, have
Latin IME change its capitalization.
This does not yet have the keyboard mode follow the mode - the change
is complicated enough as is.

Bug: 7657025
Change-Id: I54fe8485f44e04efd72c71ac9feee5ce21ba06f2
2013-04-15 20:23:01 +09:00
Jean Chalard 91bcf5eb5d Merge "Restart suggestions when the cursor moves." 2013-04-12 12:27:50 +00:00
Jean Chalard 02ce3dc2d1 Fix a bug with bad application completions
Bug: 8561056
Change-Id: I91fb0ac76dabfc841bafc0e2c0ea9f63e6f604f9
2013-04-12 20:53:06 +09:00
Jean Chalard 6a114fa700 Restart suggestions when the cursor moves.
This uses the old suggestions. It does not try to recompute
new suggestions if there are no old suggestions yet: this is
coming in a later change.
If there are no suggestions, this shows the word itself
as a suggestion.

Bug: 8084810
Change-Id: I4c2e25df0ff3673be1825f57a0c19a9d23d47a48
2013-04-12 20:49:03 +09:00
Jean Chalard 740da0d8d0 Fix an NPE
Also remove an unused method and make 2 private variables
final.

Bug: 8461093
Change-Id: I676d93fda28e82eb5a6978f2e7ad5a0add2cbecf
2013-03-29 18:41:29 +09:00
Ken Wakasa 9c3860ce46 Rename ProductionFlag.IS_EXPERIMENTAL to USES_DEVELOPMENT_ONLY_DIAGNOSTICS
bug: 8393568
Change-Id: Ie5edf44a3627aca9416145aff56bf05bbf2a05f3
2013-03-18 23:15:47 +09:00
Tadashi G. Takaoka ce6bcdd1a5 Separate caps mode related utils to CapsModeUtils
Change-Id: I32700c434b296bb3fd39e040c2dda1fe90667daf
2013-02-12 18:15:42 +09:00
Tadashi G. Takaoka 8aa9963a89 Fix Apache license comment
Change-Id: Ic56167f952a7f4449da366e1e81610e72c966086
2013-01-21 22:23:37 +09:00
Jean Chalard ae3b96b26e Simplify the space-before and space-after logic.
Bug: 7889078
Bug: 7268000
Change-Id: I6c77b8c9e60ef69f02526b407124d2f5d02818ee
2013-01-17 17:52:46 +09:00
Kurt Partridge 3b95eaf70b [Rlog50] capture bigrams properly even with deletions
multi-project commit with Ia4ec213e8356897807cb6a278fccdbaa945732f0

Change-Id: Ib3fe886dc889954a31586ab81d00a21d8d55efd2
2013-01-09 16:02:37 -08:00
Kurt Partridge 9bad176ebe Merge "[Rlog32] ResearchLogger segment motion data around gestures correctly" 2013-01-08 08:10:31 -08:00
Kurt Partridge 99f3189645 [Rlog32] ResearchLogger segment motion data around gestures correctly
multi-project commit with I684ba5fed8c653777942e6b0366113ca40dfa37c

Change-Id: Id3804e6cfa97b4cdde212b8eebc413f76fa4772c
2013-01-07 20:06:29 -08:00
Ken Wakasa b6ca354431 Small code cleanups
Multi-project commit with I249d5fbe

Change-Id: Ia28c4e970992aa1299a30e604eaa5d096655c3a5
2013-01-07 12:13:42 +09:00
Jean Chalard 0abc48218e Rename some confusing variables
Change-Id: Ib0de800599ae7f12c86270a627616d5b52366414
2012-12-27 15:42:14 +09:00
Jean Chalard 5bde3a6163 Fix an old bug in getting a word from the connected view.
In this test, it's impossible that start < 0 so the test is useless.
I'm not sure what the cursor test was for, but it's very old code, and
it seems the assumption was either misled or doesn't hold any more:
testing for the absolute cursor position against the length of the
word against the cursor makes no sense.

The net result of this was that when the cursor index got large
enough, resuming suggestion would not work any more.

Bug: 7586467
Change-Id: I3462082374fe9579bec7698f4d424de6ff5f2ded
2012-12-27 15:41:10 +09:00
Kurt Partridge f763dc5915 [Rlog24] ResearchLogger detect word boundaries in callers above commitText
multi project commit with I5847d4aba97a7224ae170a7153811c5a11816449

Change-Id: Ie6fbf6f19f0193451fe6f3ddf9d4ef1637a35db1
2012-12-23 12:33:16 -08:00
Kurt Partridge c5da4365fb Merge "[Rlog2] ResearchLogging fix multi-space logging" 2012-12-17 16:33:57 -08:00
Kurt Partridge 3370dc8237 [Rlog2] ResearchLogging fix multi-space logging
multi-space logging should look like single-space logging, missing a few minor log statements
(SuggestionUpdates, SetComposingText)

multi-project commit with I2af842348c2f2b8f7271ac5b63def245e83df24d

Change-Id: Icd3187c0d0377255f82787afffea657c14345803
2012-12-17 09:53:43 -08:00
Ken Wakasa 96b22200be Privatize a few constants in BinaryDictionary.java
Change-Id: I7defaf1f577fd67e678cac83ff935e8181dd0a48
2012-12-17 17:46:57 +09:00
Ken Wakasa 8c15e91344 resolved conflicts for merge of d48d6fee to master
Change-Id: I21141956135debe737453dba87617671b1716d0a
2012-12-15 09:44:39 +09:00
Jean Chalard 18d688c94b Use the amended user dictionary word for insertion
When the user edits a word before adding it to the user
dictionary, the keyboard should replace whatever was
committed before with the amended version.

Bug: 7725834
Change-Id: I1a417be6c5a86d6a96bc2c76aca314ad8f1202a9
2012-12-14 20:28:22 +09:00
Jean Chalard 2da8866518 Remove a couple Eclipse and Android Lint warnings
Change-Id: I0c29c5d2abcbf80759b996d34b534deb083cd7d3
2012-12-06 21:30:51 +09:00
Jean Chalard 3a9f84a197 am 8c470f16: am 5dee6e69: am 187e683a: Merge "Fix a bug with some text fields" into jb-mr1.1-dev
* commit '8c470f16db291e257ac538bd0ac2a9354d34010c':
  Fix a bug with some text fields
2012-11-16 10:36:15 -08:00
Jean Chalard 00c0010ccf Fix a bug with some text fields
Not sure when this happens exactly, but it is possible that
InputConnection#getTextBeforeCursor returns null. This
happens for example upon rotating the screen with the
composing field empty in Gmail.
In this case, StringBuilder#append will convert the null
pointer into the string "null", which is sure better than a
crash, but can have a number of bad side-effects, like
auto-caps not working.

Bug: 7533034
Change-Id: Ia1cfab432c13a12ff1c2f013c59bac05a587f553
2012-11-14 12:22:40 +09:00
Tadashi G. Takaoka 240871ecaf Move code point constants from Keyboard to Constants class
Change-Id: Iee01d4d2b916d0b584531104ac865ae6e6370a3d
2012-10-29 16:04:20 +09:00
Tadashi G. Takaoka bc464e2952 Replace useless CharSequence to String
Change-Id: Idc478f901185ee1b4912acc82d0cbc54fee4e991
2012-10-22 11:03:28 -07:00
Jean Chalard e91d495c53 Have "no whitespace before cursor" upon gesture trigger phantom space
Bug: 7359291
Bug: 7357758
Bug: 7197651
Change-Id: Ia805a87e922739ae0a06978a3bf00d91c94b6c51
2012-10-17 09:36:07 +09:00
Jean Chalard 574b80aace Remove debug prints.
Bug: 7226098
Change-Id: Ibacb740022a6af56c9d555d6797dd402a89f6ca4
2012-10-01 17:03:15 +09:00
Tadashi G. Takaoka a28a05e971 Cleanup: Make some classes as final
Change-Id: I6009b3c1950ba32b7f1e205a3db2307fe0cd688e
2012-09-27 19:03:30 +09:00
Jean Chalard d461bfd660 Support the gesture + phantom space case (A13)
Bug: 6950087
Change-Id: I198699f6e687ac74c35b9edfe469dce880d9ecaf
2012-09-18 18:48:49 +09:00
Jean Chalard 90a9127244 Take space state into account for caps (A11)
Bug: 6950087
Change-Id: I8a1bca24db64b4dd54db8ac74d90cf43cbdddab6
2012-09-18 16:16:28 +09:00
Jean Chalard 252da38fcd Take locale into account for caps (A10)
Bug: 4967874
Change-Id: Ic7ce7b2de088308fa00865c81246c84c605db1e5
2012-09-14 19:42:05 +09:00
Jean Chalard d7fdc730c3 Merge "Simplify a call, and add comments (A2)" into jb-mr1-dev 2012-09-13 03:38:50 -07:00
Jean Chalard 3d54e1c1ec Simplify a call, and add comments (A2)
Since the function has to be modified heavily but does a lot
of non-trivial work, add a wealth of comments explaining what
it does and why so as to facilitate understanding the changes
to come.

Bug: 4967874
Change-Id: I6c21aea15f161d807035f279dfb7d1b98b3e9144
2012-09-13 18:59:04 +09:00
Jean Chalard 2427f578c8 Merge "Import TextUtils.getCapsMode to fix it internally (A1)" into jb-mr1-dev 2012-09-13 02:57:35 -07:00
Jean Chalard 9d1c73ffd8 Import TextUtils.getCapsMode to fix it internally (A1)
This should have on effect at all on behavior,
except an increase in performance.

Bug: 4967874
Bug: 6950087
Change-Id: Ie2b51efefe84ca767f5dc8e3b80bfef7e1faab3d
2012-09-13 17:46:39 +09:00
Jean Chalard 5ed88457bf Make onUpdateSelection much more resilient to race conditions.
This is pretty much as strong as it gets. It should be
impossible to get false positives and nearly impossible to
get true negatives with this new code.

Bug: 6981089
Change-Id: Ia32ab62f89c5943f0be169b979abab652e67bf5b
2012-09-13 17:35:26 +09:00
Jean Chalard 28d765ed90 Make Latin IME aware of its surrounding text.
This is a preparatory change for
Bug: 4967874
Bug: 6617760
Bug: 6950087

Change-Id: I3abf8e45c0d02c42491421f108370220134b9602
2012-09-12 17:54:16 +09:00
Kurt Partridge 94e7f4bef9 ResearchLogger log RichInputConnection
Move many ResearchLogger data collection points to RichInputConnection.
By collecting data here, developers do not have to remember to keep the
ResearchLog consistent with calls to the RichInputConnection.

In addition, some unnecessary log points were removed, and the ResearchLogger
is now independent of LatinImeLogger.

multi-project change with I05496cfd762e9a41c42c50099143f1efc0a3d8a2

Bug: 6188932
Change-Id: I424abb2e437901262a9620255493916b7c3ff74b
2012-08-21 17:13:36 -07:00
Kurt Partridge 35c11842a7 Revert "ResearchLogger log RichInputConnection"
This reverts commit 1964ffb3f4

Change-Id: Ie43e7ac828faa91e1824a255bb3ecf6c8222d4e8
2012-08-20 10:17:45 -07:00
Kurt Partridge 1964ffb3f4 ResearchLogger log RichInputConnection
Move many ResearchLogger data collection points to RichInputConnection.
By collecting data here, developers do not have to remember to keep the
ResearchLog consistent with calls to the RichInputConnection.

In addition, some unnecessary log points were removed, and the ResearchLogger
is now independent of LatinImeLogger.

multi-project change with Ib71f841044ec1072610ab5638a5edfce29b7c05b

DO NOT MERGE

Bug: 6188932
Change-Id: I9ec7500a5b18bfe1a5a5bb1e5bf21c43351fc59e
2012-08-17 21:44:06 -07:00
Kurt Partridge 6b966160ac ResearchLog refactor
- new package: com.android.inputmethod.research

multi-project commit with Ic0a5744f3160d13218addd589890623c0d120ffc

Bug: 6188932

Change-Id: Icf8d4a40a5725401799be6e209a640d99a5f34c4
2012-07-20 15:06:51 -07:00
Jean Chalard d579f1aefc Consolidate methods that do the same thing (A74)
Change-Id: I6e7c3aba2b40ecefa483c9680978bc806368e96e
2012-07-09 15:06:16 +09:00
Jean Chalard f254e3fec7 Fix a bug where the caps mode would not be changed
Bug: 6766059
Change-Id: I378f9d35c4904c4f373260bda5863235d833eb31
2012-07-06 11:08:20 +09:00
Jean Chalard c3ebf1a43a Refactoring and groundwork to fix a bug with older apps
This has a good, although small, impact on performance : it removes
a two-way IPC call in a most frequent case, while possibly adding
one in a rather unfrequent and less critical case.

Also, this fixes a bug with surrogate pairs. This specific branch
of code now correctly handles surrogate pairs.
Aside from this, it should have no impact on behavior.

However, since it does delay access to the previous character in
the text view by a two-way IPC call, it actually goes a long way
toward fixing bug#6668226. It is not really a fix and the race
condition still exists, but this change makes it much, much
harder to hit.

Bug: 6668226
Change-Id: Id11cc6a0b7488d6bd392227cafdcf3a8d4c62f6c
2012-06-25 16:32:25 +09:00
Jean Chalard 9d71748ba4 Fix an occurrence of nested batch edits.
This is harmless, but against policy.
Also, rework the checking code to be more readable, give more
information, and be called for all relevant methods - and not
for informative methods, which are not required to be in a
batch edit.

Change-Id: I03fa8b2e7d68a6a133f86be8a214671750c29256
2012-06-13 07:02:07 +09:00
Jean Chalard 2010aad741 Move two methods in a more appropriate place
Change-Id: I512b04e23490413a44b1ca0517102fe2d9138df3
2012-06-12 10:29:55 +09:00
Jean Chalard a32eb27213 Move an editing method to the RichInputConnection
Change-Id: Ie143ad008ca8deb1c5034cb80ec1cb28a6b0682d
2012-06-12 10:29:55 +09:00
Jean Chalard 747cf0435a Move two editing utility methods to RichInputConnection
Change-Id: If8d03bea1b6369cb3043da6321048d052995d664
2012-06-12 10:29:55 +09:00
Jean Chalard bbbdab12be Move some editing methods to RichInputConnection.
Change-Id: I8527776a4bd8236a85bb77f9791f9b76977ad181
2012-06-08 20:23:13 +09:00
Jean Chalard 02308bec63 Merge RichInputConnection with EditingUtils
Change-Id: I9982ff325bef56694402caef28a77683c52ccd71
2012-06-08 20:04:09 +09:00
Jean Chalard 5475b38328 Make a wrapper for the input connection.
The goal is to simplify the code in LatinIME.java as well as having
a handy place to put debug calls to see interaction with TextView.

Change-Id: I255227e7e7343e0c2f3dcd1f185e5020d6186732
2012-06-08 19:50:12 +09:00