History log of /frameworks/base/core/java/android/widget/Editor.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7c8305bcfeef206e8bd00f20077f8106bb66fa6b 25-May-2016 Seigo Nonaka <nona@google.com> Merge "Use original theme for SuggestsionsPopupWindow" into nyc-dev
23cbe85610f780134cc77dd4a54732a22ed6e86e 18-May-2016 Yohei Yukawa <yukawa@google.com> Move LocaleList to avoid layering violation.

Since LocaleList needs to depend on android.os.Parcelable, we cannot let
that class belong to "android.util" package, which causes layering
violation.

Bug: 28819696
Change-Id: Ia8de2ee9df3dd0a42b1fe84574439519b680fe18
/frameworks/base/core/java/android/widget/Editor.java
e9f54bfde27327df4b1c820a97df00546cffe1e9 12-May-2016 Seigo Nonaka <nona@google.com> Use original theme for SuggestsionsPopupWindow

Some application set textColorPrimary as white, as the result the
suggestion window draws white text on white background.
To avoid this UX, always uses original theme for suggestions popup
window.

Bug: 28371168
Change-Id: I2ef41d162b63a7e277decc2065609a7d43590afe
/frameworks/base/core/java/android/widget/Editor.java
be1cd9f5ce6eb2bc37b15258c6ab22e2fc5592e1 04-May-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Show drag handles after finishing batch edit if needed." into nyc-dev
c6fad96b5926aa8861f49a7f4725dd7657322758 02-May-2016 Keisuke Kuroyanagi <ksk@google.com> Show drag handles after finishing batch edit if needed.

Drag handles are blocked from being shown if batch edit mode is active
when onPreDraw is called; however, IME can start and end batch edit
mode regardless of onPreDraw timing.
As a result, drag handles are sometimes not shown even if selection is
created and text action mode is started.

With this CL, drag handles are shown after finishing batch edit mode
if the handles were blocked from being shown in the above case.

Bug: 28366507
Change-Id: I7f099d0626bee70a63bb14bc75eefc2551a52d53
/frameworks/base/core/java/android/widget/Editor.java
e2a3b1edd938f248ca7f5e86995be951bdb3522e 27-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Adjust touch position for handles using window coordinate.

Touch position is adjusted in HandleView#onTouchEvent to snap to
ideal offset.
Previously, screen coordinate was used for input, but window
coordinate is used for the ideal offset. As a result, window adjusted touch
position will be adjusted to improper position and a handle being
dragged will get moved to unintended line.

Bug: 22308836

Change-Id: I4a5a3cc695a874c85aa341f06ffcba8b7f5e318c
/frameworks/base/core/java/android/widget/Editor.java
ab8913e364d296fdb62e6b2572d102063bff42cb 25-Apr-2016 Seigo Nonaka <nona@google.com> Merge "Fix unexpected truncation again." into nyc-dev
77972bbf2cc65a8ea961e3a1b84b4f631b87fdb8 20-Apr-2016 Seigo Nonaka <nona@google.com> Fix unexpected truncation again.

Unexpected truncation happens again after [1].
This is fixed by setting match_parent into the container LinearLayout.

For the unexpected truncation of Holo Theme is came from other but
related root cause. To calculate the window and container width,
need to add container padding in addition to the maximum width of
the text view. Otherwise the width of the container view will be
shrunk and the contents will be truncated. This only happens on
Holo Theme since the padding of the container is zero on Material
Theme.

I manually confirmed this CL doesn't revive following issues
- 28034210
- 27341560

[1]: I67886a752ef110d3433dddd6aa8447a9027f8e19
[2]: I69b258687b4bf5510d9b2c3e690c88106bf893f5

Bug: 28266493
Bug: 28281740
Change-Id: Ie6d274714ac08080dc22aeb8ecd8b7729cb634cd
/frameworks/base/core/java/android/widget/Editor.java
377c32845bffaf68d5751d8cdf6fd60b8b3f5dc3 20-Apr-2016 Vladislav Kaznacheev <kaznacheev@google.com> Rename DropPermissions to DragAndDropPermissions

Bug: 28296057
Change-Id: Ic95cb4ae9c351d903df78628e983dec2bacd0ad5
/frameworks/base/core/java/android/widget/Editor.java
64d151507601a6472f85c96d105e2555b7ad221f 07-Apr-2016 Seigo Nonaka <nona@google.com> Merge "Fix suggestion popup for RTL text on LTR layout." into nyc-dev
1d3efb6f64758e3b0c1e197e1bb259e14074e90b 07-Apr-2016 Seigo Nonaka <nona@google.com> Fix suggestion popup for RTL text on LTR layout.

By setting width to the ListView, the width of the containing text view
won't match with parent.

I locally verified this doesn't revive issue 27341560.

Bug: 28034210

Change-Id: I67886a752ef110d3433dddd6aa8447a9027f8e19
/frameworks/base/core/java/android/widget/Editor.java
03f1e026996a7665aefcda947ed97faae009735e 07-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Invalidate HandleView when handle position may have to be changed." into nyc-dev
a46be16612573ce083404e8731a96ec30eba3c48 05-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: Selection handle behavior in scrolled TextView." into nyc-dev
a1a56ed09cb3977c580098113a221c7764d31a58 05-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Stop automatically creating action mode in FS extracted mode." into nyc-dev
b1b8865017b9e8b4d06cb0f9bda0f615468292c2 05-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Fix: Selection handle behavior in scrolled TextView.

When dragging a selection handle, it moves to strange position in
scrolled TextView because scroll position isn't took into account.
This issue was introduced by rebase mistaking in
I2a7e87ad08416f4bd01a5f6.

Bug: 28008281
Change-Id: I6217483fcc0b9a7e661f02a1f276114ddd5031a4
/frameworks/base/core/java/android/widget/Editor.java
c14e1270cff7f12614af49b7f3a94299f4064438 05-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Invalidate HandleView when handle position may have to be changed.

Bug: 26499944
Change-Id: Iba539eb50df1495be7d64174de38b1e88cff9348
/frameworks/base/core/java/android/widget/Editor.java
807c3a828b97e6d619f2dfdfde2f97efc873f6fe 05-Apr-2016 Yohei Yukawa <yukawa@google.com> Merge "Unhide View#dispatch{Start,Finish}TemporaryDetach()" into nyc-dev
0fd28c9f024e780fe8d63e8090286c6eae070b8b 04-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Stop automatically creating action mode in FS extracted mode.

With Ic025c109539c3b59638, selection action mode is always started
when there is a selection. This makes it impossible to extend
selection using selection mode.
This blocks creating action mode when full screen extracted mode is
started with selection, but it's same as MNC's behavior.

Bug: 27988877
Change-Id: I9614cb16373029189bfc098b6c1d353326e6b518
/frameworks/base/core/java/android/widget/Editor.java
183fd5071ea84aab82209c827fa0e4ff84a6b590 01-Apr-2016 Keisuke Kuroyanagi <ksk@google.com> Make hasTransientState be true only if user created selection is active.

Previously, hasTransientState returned true even when TextView has a
selection that hasn't been created by the user. This unnecessarily
prevents the TextView from being recycled.
This issue was introduced by Ib454b0fbbc2c2f8d198, which fixes that
setHasTransientState(true) is not always coupled with
setHasTransientState(false).

With this CL:
hasTransientState will get true when selection action mode is started.
hasTransientState will get false when selection is removed.
Note that hasTransientState intentionally continues to be true when
selection action mode is terminated with preserving selection.

Bug: 27913323
Change-Id: I960ddfd7221caeb676c23926af06a8a415dec288
/frameworks/base/core/java/android/widget/Editor.java
24df931e9e8c708fc605cd8e76a3ffd9ce5f6c77 01-Apr-2016 Yohei Yukawa <yukawa@google.com> Unhide View#dispatch{Start,Finish}TemporaryDetach()

In order to fix Bug 18920212, we have to track when a View enters
temporarily detached state and when it exits from that state. To do
that, ListView needs to use View#dispatchStartTemporaryDetach() instead
of directly calling View#onStartTemporaryDetach() because there is no
guarantee that existing applications have internally followed Call-Super
pattern.

With this CL, we are going to expose temporary detach state and its
dispatching methods as public APIs. Major changes are:
1. ListView's indirect children will start receiving temporary
dispatch callbacks. Previously only direct children have received
View#on{Start, Finish}TemporaryDetach() callbacks.
2. TextView can no longer assume that ListView never calls
View#View#dispatchStartTemporaryDetach() but directly call
View#onStartTemporaryDetach() instead. See the commit message
of [1] for details.

This also enables us to do the following fixes, which will be handled in
subsequent CLs.
A. ViewCompat support lib is finally able to rely on temporary
dispatch mechanism without reflection.
B. InputMethodManager is now able to ignore focus-in events from
temporarily detached Views. This will be done in the next CL [2].

[1]: a440b002aa59e1455bdfa2c5a1ca51c74bbc19ac
[2]: Ia79bbd8468f768d546354382b47b39dd31ef7bb5

Bug: 18920212
Bug: 27905921
Change-Id: If8f780f8b71754f7533a65097304113ae1f5cf12
/frameworks/base/core/java/android/widget/Editor.java
f0bb87b7c40efeeaee58d4c7b767961c9800463e 08-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Improve selection handle behavior for bidi text.

A point on a direction boundary can be mapped to two offset and
one offset on a direction boundary can be mapped to two points.
Previously, paragraph's primary direction is always used for deciding
offset and coordinates; thus, handle movement around a direction
boundary is often nonintuitive.

With this CL:
1. For selection end handle, direction of character at offset - 1 is
used for deciding handle shape and position.
2. For getting offset from coordinates, previous offset is used to
minimize the offset delta and primary .
3. For getting coordinates form offset, new logic chooses primary or
secondary horizontal coordinate depending on the current run
direction and paragraph direction.
4. When a handle passes another one because it passes a direction
boundary, new logic keeps the handle at the run boundary instead of
minimizing the selection.

Bug: 19199637
Bug: 21480356
Bug: 21649994


Change-Id: I2a7e87ad08416f4bd01a5f68e006240f77d9036b
/frameworks/base/core/java/android/widget/Editor.java
987ec6588b2279891179c9eff09fc25ec14430c4 18-Feb-2016 Siyamed Sinir <siyamed@google.com> Do not use hint text for Editor cursor positioning

When hint text is used for cursor positioning, the cursor may end up
in opposite direction when the locale and the hint text directions are
different. This CL uses the main text layout and discards the hint
layout while deciding on the position of those three views. The change
also includes fix for cursor and floating popup not displaying for
some cases after the change.

Bug: 22358087
Change-Id: I083d17b06273bc1d9b67656c5e12d4ff1231219c
/frameworks/base/core/java/android/widget/Editor.java
531d8d2faee92f8ea173440b74761bd91add2dd8 15-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Re-disable drag and drop in full screen extracted mode." into nyc-dev
126fdf108297bd66da85edbfe6d1af2cef64404d 15-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Stop automatically creating selection action mode." into nyc-dev
6e0860d9596314230bb9bcbe2e82467b0251ab9a 15-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Add a check for misspelled span change.

Previously, misspelled span is directly used in AddToDicitonary's
OnClickListener. It can crash because misspelled span can have been
updated since SuggestiosPopup is shown.
Also, AddToDictionary didn't work correctly in full screen extracted
mode. Use findEquivalentSuggestionSpan to resolve it.

Bug: 27557526
Change-Id: I51d713dbdd0c44ea2c553164b81b1123a2325aa1
/frameworks/base/core/java/android/widget/Editor.java
c477b5830af5f9e87069fae4ff87a2a6b3e275fb 15-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Stop automatically creating selection action mode.

With Ic025c109539c3b5963, selection action mode is created always
when selection is made. It causes distraction in some cases.
This CL fixes this issue. This CL stops starting selection action
mode when action mode is currently not active and not intended to
restart.

Bug: 27536744
Bug: 27551819
Change-Id: I94ee66864000934a21ef0d18c1d71429c67114fa
/frameworks/base/core/java/android/widget/Editor.java
fdfc93d77022f55ac702fbb796f74b6b717314c0 15-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Re-disable drag and drop in full screen extracted mode.

Drag and drop in full screen extracted mode was disabled by
Ifff4c30919bcb04f7d and re-enabled by I90d8e9f42f395b6b52.
However, related issues have not been fixed. This CL re-disables it.

Bug: 22440907
Change-Id: I753f69e170aa7e79478a5a4a3b89e4a7ef88c9e2
/frameworks/base/core/java/android/widget/Editor.java
f8e0da2624e1f5d99a493889e789e5f533b6fe0c 14-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Show SuggestionsPopup when there is a misspelled span.

Due to I20a86c1bdeb361686, SuggestionsPopup was not shown when there
is a suggestion span that has misspelled flag and doesn't has any
suggestions. This CL makes SuggestionHelper#getSuggestionInfo return
misspelled span info separately.

Bug: 27534987

Change-Id: Ib76588f9388287a04f1f6c9d9067ae439e493a95
/frameworks/base/core/java/android/widget/Editor.java
182f5fec539127f627dfc327e21d516fe1d6f85b 11-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Fix: Context menu can contain obsolete suggestions.

When there are not enough number of suggestions, previously used
suggestions was continue to be used. This fixes it and simplifies code
by always allocating SuggestionInfo array.

Bug: 27602619
Change-Id: I9378315b8c810f126f65fade96ce9f6ff5271957
/frameworks/base/core/java/android/widget/Editor.java
01ef02d7853fd2996eae3d139f02d190f3c174a2 11-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Reset mWordIteratorWithText when SpellChecker locale is changed." into nyc-dev
e0ac5ac6f0bcf58362af1ed723fa2a7d68ddd25d 09-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Reset mWordIteratorWithText when SpellChecker locale is changed.

Bug: 27537808
Change-Id: Ic55b543456cc859673b4c17cc5bf6e4b6da21e13
/frameworks/base/core/java/android/widget/Editor.java
fae4578311970afadca8ee28a47e1e11df00eedd 25-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Make drag&drop be atomic for undo/redo.

For undo/redo, drag&drop is recorded as a 2 operations, paste and
delete. This CL makes drag&drop be atomic operation to be properly
undoed/redoed.

Bug: 27268820
Change-Id: Ia38d663f046c2c65f348985934f5cfa054b0437e
/frameworks/base/core/java/android/widget/Editor.java
713be06f7aa70288b4bf811d7cf9c0220c09e9c0 01-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Fix: Selection is not correctly used for SuggestionsPopup.

This happens because suggestions are gathered based on the
selection after setting the cursor position to the middle
of the user selected range, which means 0-width selection
at that position. As a result, SuggestionsPopup was not
shown when any suggestion spans don't overlap middle point
of the selection.

Bug: 20709442
Change-Id: I3e1cb570f451b4ab14cf36f7da23dc2bd22f4ac8
/frameworks/base/core/java/android/widget/Editor.java
40fd5fac48836aa85d45f8b6c729baed3b625b13 08-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Call View#setHasTransientState in TextView#spanChange." into nyc-dev
af4caa60064d95aeffc7ab81095a269893f5f2a1 29-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Call View#setHasTransientState in TextView#spanChange.

setHasTransientState(true) and setHasTransientState(false) have to
be coupled, but they were not always coupled in TextView. e.g. when
we fire PROCESS_TEXT intent.
With this CL, TextView calls setHasTransientState() always when
selection is created or cleared to make sure 2 setHasTransientState
calls are always coupled.

Bug: 27409041
Change-Id: Ib454b0fbbc2c2f8d19818f154f415c4a5d7e2d7e
/frameworks/base/core/java/android/widget/Editor.java
15ae7c132866d401be4cdc88ac2d16a104d54b11 07-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Try to find equivalent SuggestionsSpan when it has been updated." into nyc-dev
bd4b217a289edca382b63f2bf5d1dd2017e9cf2e 04-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Refresh action mode always when selection is modified." into nyc-dev
c1cd17f91843decf8e8ced6546cbbd634798c525 04-Mar-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Supress SuggestionPopup for original field." into nyc-dev
f47976e7b4eacafdf7229bff6433b57825d241c3 01-Mar-2016 Seigo Nonaka <nona@google.com> Fix unexpected ellipsize for long suggestion text.

Unexpected ellipsize issue happens after
Ic8445022634e9130f9462e02bfb08d4877396ba3. By setting match_parent to
ListView, the ListView does not expand to fit the suggestion item.

Thus, explicitly setting the ListView width instead of setting
match_parent or wrap_content.

I manually verified this CL does not revive Issue 27341560 or
unexpected ellipsize for shorter text.

Bug: 27341560
Change-Id: I69b258687b4bf5510d9b2c3e690c88106bf893f5
/frameworks/base/core/java/android/widget/Editor.java
d319450307fcbd1f3dd99bf647c2c0281eb18e34 27-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Try to find equivalent SuggestionsSpan when it has been updated.

Suggestion pickup was canceled when SuggestionsSpan corresponding
to the suggestion cannot be found.
This was a problem when suggestion is selected in extracted mode.
Selection is cleared just before creating SuggestionsPopup.
The selection update is reported to the original EditText and it
will invoke TextView#setExtractedText of the extracted one.
In this method, SuggestionSpans are replaced with the new
SuggestionSpans that usually have the same contents as the old
SuggestionSpans.

This CL re-enables "Replace" item in extracted mode.

Bug: 22038802

Change-Id: I74bb813b110fb2f633b8578790d14039755f2d79
/frameworks/base/core/java/android/widget/Editor.java
bec9715905c9666db2f0081fcc71abaea5b82cb0 25-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Refresh action mode always when selection is modified.

Text action mode was not correctly updated when the selection
is modified by keyboard, app or IME.
With this CL, Editor#refreshTextActionMode is called always when
selection is updated. This method properly starts, stops or
invalidates text action mode if selection was modified outside of
cursor controllers.

Bug: 10527362
Bug: 22937774

Change-Id: Ic025c109539c3b59638226be4c4c9adf5ea0c38c
/frameworks/base/core/java/android/widget/Editor.java
4a696ac7ca0d9c6e1f837cbf83ef055e6e0c9bc2 23-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Supress SuggestionPopup for original field.

Previously, popup window or insertion handle could be shouwn at
a strange position as they could be shown for the original input
field in full screen extracted mode.
This CL stops showing SuggestionPopup for the original input field
in full screen extracted mode.

Bug: 22038802
Bug: 27313458
Change-Id: I585913328182d996f0201c53c028a1991f7b435b
/frameworks/base/core/java/android/widget/Editor.java
2f229ca27bf463bb76c7b2663b90057aa25ad883 18-Feb-2016 Seigo Nonaka <nona@google.com> Show selection handles at the correct position for view transformation

The selection handles are implemented based on PopupWindow hence it is
necessary to calculate the transformed location from the TextView's
local coordinates.

This CL only addresses the selection handle locations. Many
functionalities (e.g. selection handle moving direction, handle angle)
doesn't work on transformed view since many components are calculated
on the TextView's local coordinates.

Bug: 24902578
Change-Id: Iaa5fd2812969d097e3bf3219a818ffbc67aaef54
/frameworks/base/core/java/android/widget/Editor.java
5396d7eb13893bea01f43e17c9cbcbc994b85160 20-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Make drag shadow grapheme cluster aware.

[start, min(end, DRAG_SHADOW_MAX_TEXT_LENGTH)) was used to make drag
shadow. It ignores grapheme cluster, so unexpected shadow was created for
characters that contain multiple code units.

Bug: 23097276
Change-Id: Ic7d34ec02ea04a3f17337e4253babac87ef3b03c
/frameworks/base/core/java/android/widget/Editor.java
217c0f71df8c8de5bafe6ec5ad007b4a37326682 02-Feb-2016 Siyamed Sinir <siyamed@google.com> Clamp EditText cursor in the drawable boundaries.

EditText tried to draw outside of the padding boundaries because of a
cursor positioning issue in RTL. This CL removes that fix and instead
clamps the cursor position if cursor is outside of the clipped view
boundary.

Bug: 23397961
Change-Id: Id5f1fbe2a0f571100c89b21758fbb81b14d5da57
/frameworks/base/core/java/android/widget/Editor.java
60490d1ad401eb40fef33396e87e459de842b3e7 28-Jan-2016 Seigo Nonaka <nona@google.com> Revive drop shadow of SuggestionWindow.

The drop shadow of the SuggestionWindow was accidentally gone by
I579c0cc5b7f0dd337bff54af77828b8af25b13d2.

The reason of drop shadow disappearance is setting TRANSPARENT
background to the popup window.

To revive drop shadow of SuggestionWindow, follows the way of floating
toolbar.
- Create PopupWindow and make it transparent. (already exists)
- Wrap contents with RelativeLayout and set layout_margin and elevation
to drop the shadow into the transparent PopupWindow.

The changes in Editor is for keeping this margin during re-calculation
of the contents width and position.

Bug: 15347319

Change-Id: I5a9bcbe29400d6193eb0532a5e711a78a12383cd
/frameworks/base/core/java/android/widget/Editor.java
a74e729fa991064dd6eba8c49924b2a88efdc463 27-Jan-2016 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Fix SecurityException in Editor.onDrop"
c14df8e73d093f839c4ea2585eade6ae6690d224 22-Jan-2016 Vladislav Kaznacheev <kaznacheev@google.com> Fix SecurityException in Editor.onDrop

When a content URI is dropped onto EditText, it tries making sense
of the contents, and in the process it accesses the content provider.
If this content provider requires a permission grant, SecurityException
occurs.

This fix does two things:
1. Editor.onDrop now requests DropPermissions and releases is
when it is done. This required the introduction of a new hidden method
DropPermissions.takeTransient, because the existing method required
access to an Activity instance.

2. If the drag originator neglected to allow the permission grant,
DropPermission request would not help, so a try/catch block
is added to Editor.onDrop to avoid breaking the recipient app.

Bug: 26694948
Change-Id: I714429a507e62c83a150d91fbcdee791bced3ad3
/frameworks/base/core/java/android/widget/Editor.java
dfea1a3336f1c738b24028fbb6d499b6b4a33292 26-Jan-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "TextView: start drag and drop when dragging selection by mouse."
d469f2122edf7662dbe8c9c39269064c0265b520 21-Jan-2016 Yohei Yukawa <yukawa@google.com> Clarify the purpose of EditorInfo#hintLocales.

During the initial attempt to support automatic language switching in
LatinIME, it turns out that the current EditorInfo#locales is difficult
to use and even confusing in some situations. Based on that
experience, this CL changes as follows:

* Rename EditorInfo#locales to EditorInfo#hintLocales:
This is mainly to avoid possible confusion when to set this. We want
to make it clear that having non-empty LocaleList there is a clear
signal that the user would switch to certain languages regardless of
the currently selected input method subtype.

* Make EditorInfo#hintLocales nullable:
Previously marshaling EditorInfor causes NPE when
EditorInfo#hintLocales is null. This CL relaxes such a restriction.

* Introduce TextView#{set, get}ImeHintLocales():
In the previous implementation [1], we just copied
TextView#getTextLocales() into EditorInfo. This is, however, does not
work well because it is no more or less than the default value. If
LatinIME supports automatic language switching, having the default
value in EditorInfo actually means that whenever you focus in a new
text field, the keyboard language is reset to the default locale.
In order to make this "hint" useful for IME developers, this "hint"
should be specified only when the application developers are confident
to do so.

[1]: I738ffaaf07091d8b980f8bfc6e16227fcb85a96a
0445fdf321e74044dc9f3719922fc8ff4923fdf4

Bug: 22859862
Change-Id: I0a730011874ea8d01e50624ed3f1ecd197d05f94
/frameworks/base/core/java/android/widget/Editor.java
3ed1b39f407fb7028115eb25d1adf44d5f5d95bb 19-Jan-2016 Seigo Nonaka <nona@google.com> Fix material style errors in suggestion popup window.

This CL addresses the material style errors from UX team.

- Corners should have a radius of 2dp.
To use the same way with floating toolbar, make the popup window transparent and
set floatingToolbarPopupBackgroundDrawable as the layout background. By this
change, TextSuggestionsPopupWindow style is no longer necessary, removed it.

- Background color for both sections should be #FFFFFF.
It turned out that the window default background is not white. By addressing
above item, this issue is fixed too.

- Divider line alpha=.12
This is fixed by using attr/listDivider instead of attr/dividerHorizontal.

- Remove 8dp padding below last suggestion
Removed 8dip paddingBottom from ListView.

Bug: 15347319

Change-Id: I579c0cc5b7f0dd337bff54af77828b8af25b13d2
/frameworks/base/core/java/android/widget/Editor.java
e876085b5bb530aa9214b72854341869feb45e69 21-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> TextView: start drag and drop when dragging selection by mouse.

Previously, drag and drop is started only when a long click is detected.
With this CL, drag and drop is started on drag when a mouse is used.

Bug: 19544351
Change-Id: If81f9edc6fcff5f7a810b2165c058aa36fb6caad
/frameworks/base/core/java/android/widget/Editor.java
1cd8aac4ea660e78d872e47b7a6e4cd93ea10c4b 21-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> TextView: Offer suggestions in context menu.

- Extract SuggestionInfo fetching code as SuggestionHelper and use it for
both context menu and existing suggestion popup.
- Show suggestion in "Replace..." sub menu.

Bug: 19397276

Change-Id: I20a86c1bdeb3616863b846237be55fa1a9b6ffdd
/frameworks/base/core/java/android/widget/Editor.java
d056081e502debdafe7e91d12400d19de2899a9a 17-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> TextView: Open context menu on right click.

- Construct context menu in #onCreateContextMenu.
- Ignore non-primary buttons for selection.
- Don't open context menu on long click.

Bug: 19544351
Bug: 19397276
Bug: 24872170

Change-Id: I4690e1485682be4f9b504b8fb6af936b979f13b8
/frameworks/base/core/java/android/widget/Editor.java
ff375577952dad90bfa28073c67f97db68f106db 10-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix selection expansion detection logic."
155aecb18be803122977a3fe00259924818d2983 05-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Move double tap/triple click detection to Editor.

The logic was in TextView, but it's only for Editor.
Move it to Editor and have constants for the state.

Bug: 19544351
Change-Id: I391f66753aa5cbb26fbefcba5b4e7e3d917454e2
/frameworks/base/core/java/android/widget/Editor.java
4368d05af7ba8112c5b10ee0b97cbe88ddead32d 05-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Triple click to start paragraph based selection.

- Detect triple click in TextView#onTouchEvent.
- Select paragraph on triple click.
- Extend drag accelerator to support paragraph based
selection.

Bug: 19544351
Change-Id: I0a6752a0642a2c569b69a1fc2c0f49169a72844a
/frameworks/base/core/java/android/widget/Editor.java
b2ba0605efbcef5ced690f369dc53ede8e9b9dea 05-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Remove unneeded method HandleView#showAtLocation.

Now, the handles will be shown at the proper positions in
Editor#startSelectionActionMode. No need to call
HandleView#showAtLocation.

Change-Id: I5a7fb7bc4419a49234584bd06db5acc3d23168b8
/frameworks/base/core/java/android/widget/Editor.java
97af673e1f2e33a3cc48a2ab7816bbf082a2e9f4 05-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> Move mouse selection handling logic to Editor.

- Remove mouse selection related logic from
ArrowKeyMovementMethod and Touch.
- Extend drag accelerator to support character based
selection by dragging and use it for mouse drag selection.
- Enable word based drag accelerator even if the clicked
position is not on a word.
- Disable y-coordinate adjustment for word based drag
accelerator when the user is using a mouse.

Bug: 19544351

Change-Id: I1b29a65be3d321ac472f8c5b70ab6fee4e895964
/frameworks/base/core/java/android/widget/Editor.java
26454141a8c489d84b7d486ad03869ff0f44dfdc 03-Dec-2015 Keisuke Kuroyanagi <ksk@google.com> Fix selection expansion detection logic.

The logic to detect vertical expansion is inverted on RTL
text. As a result, the selection handle cannot be moved
when it's dragged toward vertically expanding and
horizontally shrinking direction.

Bug: 25893288
Change-Id: I096595d287261b1287862c6ad27ae7f6f0a73262
/frameworks/base/core/java/android/widget/Editor.java
5d7657e99bb41d107f6bdbfe9a2430e97b740b9d 26-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Refactoring: SelectionHandleView.

Remove code duplication in SelectionStartHandleView and
SelectionEndHandleView by introducing SelectionHandleView.

Change-Id: I4486019714b13d184a72cf7ee60c346c4d8b5f5a
/frameworks/base/core/java/android/widget/Editor.java
d3c48931ea36f2d6b15dc86a1d025418ff629575 25-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Add selection handle dragging tests."
da79ee683d74f2ad7d29147a30f3da17dd0ea6e2 25-Nov-2015 Keisuke Kuroyanagi <ksk@google.com> Add selection handle dragging tests.

- Set an id for each HandleView to access the hanlde.
- Rename DragOnTextViewActions to DragAction to use it for
dragging handles.
- Introduce HandleCoordinates to provide proper coordinates
for handles.

More tests will be added in following CLs.

Bug: 25730231
Change-Id: I9276bf2f983983ec9aae0ddcf674d3dcee566892
/frameworks/base/core/java/android/widget/Editor.java
a71a244ec6c83e8627f10d3d04228ff8e7915c09 19-Jun-2015 Seigo Nonaka <nona@google.com> Make suggestion window style material.

To make suggestion window style Material, this CL does following things:
1. Introduce LinearLayout to be able to split suggestion item and menu.
Currently suggestion menus, "Add to Dictionary" and "Delete" buttons
are children of ListView. It is necessary to introduce LinearLayout
and move these two menus from ListView to this LinearLayout to have a
divider between suggestion items and menus.

2. Extract suggestion window layout definition from Java.
Currently almost all layout of suggestion popup window is done by
Editor.java. By extracting this logic from Java and move it to XML
files, it becomes easy to support both Holo and Material theme.

3. Introduce Material Design.
Suggestion window should respect the running application's theme since
suggestion window is shown as the part of the application.
This patch introduces Material themed suggestion window, and at the
same time, the old window is also kept as the Holo themed suggestion
window.

Bug: 15347319
Change-Id: Ieccea12db95c0a040b38680ae794b1cf6971736f
/frameworks/base/core/java/android/widget/Editor.java
a17d8766d481a636ad04a209d6404bdf2681d836 12-Nov-2015 Seigo Nonaka <nona@google.com> Merge "Clear suggestionSpan reference once popup window is closing."
e0ee5d9657e2a4492531b3b1595252c8cb745fe8 22-Oct-2015 Yoshiki Iguchi <yoshiki@google.com> Fix crash on calling removeSelection with showing selection handlers am: 9582e15196 am: 6649ee972b am: 6a5bb1534c
am: fb8343549a

* commit 'fb8343549a65bf65dab0fce6830b1b39ce62ddaa':
Fix crash on calling removeSelection with showing selection handlers
9582e151964be60457d4abd712857fb1e8a4586d 15-Oct-2015 Yoshiki Iguchi <yoshiki@google.com> Fix crash on calling removeSelection with showing selection handlers

A crash occured on updating after calling removeSelection with showing
selection handlers. This was because some selection-handler code didn't
consider the case the selection index was -1 (-1 means there is no selection).
This patch fixes this crash.

Bug: 23299977
Change-Id: I736d315e073f773aec597522203015205a8da42b
/frameworks/base/core/java/android/widget/Editor.java
fa7834379fe174729411165d5678dc9bca8dc9ca 21-Oct-2015 Andrei Stingaceanu <stg@google.com> Merge "Fix toolbar flickering in ExtractedMode when longpressing." into mnc-dr-dev am: ee4ab0a55b am: 24fc647e70 am: 509a74972a
am: fe622345b0

* commit 'fe622345b02656b9e049dde9936987f38984e97d':
Fix toolbar flickering in ExtractedMode when longpressing.
2aaeefec92ad70d9797b98caed4b554b982421c8 20-Oct-2015 Andrei Stingaceanu <stg@google.com> Fix toolbar flickering in ExtractedMode when longpressing.

onPreDraw starts an action mode in extract mode only which
does not consider the type of motion event and since extracted
mode never gets the focus event it never hides so it does not
need to show again.

Stop starting an action mode onPreDraw in extracted mode and
let the onTouchEvent handle starting the mode.

Also re-enabled dragging and dropping for ExtractedMode (most
of the issues were caused by starting the action mode
onPreDraw).

Bug: 25102276
Change-Id: I90d8e9f42f395b6b529e4d023ba6939e0dfb147f
/frameworks/base/core/java/android/widget/Editor.java
d0374c6b25c3ad8e638827bd8190553f80d9bf22 20-Oct-2015 John Reck <jreck@google.com> Fix a few view ctors to not call Looper.myLooper

Bug: 25116730
Change-Id: I4e394c281feef6f7987433298d66f2df11352416
/frameworks/base/core/java/android/widget/Editor.java
003cc3dec8e2a92e51086fbcd5ee1bb236efa701 16-Oct-2015 Chris Craik <ccraik@google.com> Rename DisplayListData to DisplayList

Change-Id: I25f6bb88ffdf9baf7e8e4e2a294aa8c9d2a4605b
/frameworks/base/core/java/android/widget/Editor.java
7afa67ca22a1cae7cadc8c5a1278122395a8b895 07-Oct-2015 Seigo Nonaka <nona@google.com> Clear suggestionSpan reference once popup window is closing.

Clear suggestionSpan reference since it is not necessary once the
suggestion window is closed.

suggestionSpan is kept for identifying the target text region in
onItemClick method.

This CL is a part of groundwork for Bug 15347319 and no user visible
change is intended with this CL.

Change-Id: Ie0edf215a1b90629e280ce09df4fd6f5d95fbb06
/frameworks/base/core/java/android/widget/Editor.java
f03d7994bdb2b2ff8cd0d727ebe622e77c0d54bd 30-Sep-2015 Seigo Nonaka <nona@google.com> Merge "Reduce the number of TextAppearanceSpan objects for highlighting."
a60160b30bf1b6aa27cdaf03cf9b6c245f338d84 19-Aug-2015 Seigo Nonaka <nona@google.com> Introduce simple SuggestionsPopupWindowTest.

This CL introduces very simple test case for SuggestionPopupWindow.
I'm going to introduce more test cases for complex scenario once this
approach is accepted, e.g. multiple suggestion span and misspelled flag.

This CL is a part of groundwork for Bug 15347319 and no user visible
change is intended with this CL.

Bug: 15347319
Change-Id: Idf166cbecb3e33be213e4104cf1afd827906f2ad
/frameworks/base/core/java/android/widget/Editor.java
bffbd3090a7f6a4206f13da91afaf69d9341acdf 19-Aug-2015 Seigo Nonaka <nona@google.com> Reduce the number of TextAppearanceSpan objects for highlighting.

This CL removes unnecessary TextAppearanceSpan objects creation.

The hightlight text appearance of all suggestion items in popup window
are the same, so it is not make much sense to create TextAppearanceSpan
objects for each suggestion item.

This CL is a part of groundwork for Bug 15347319 and no user visible
change is intended with this CL.

Bug: 15347319
Change-Id: Ibad2e9842a76611a34187a3c942bae4ff7ea355f
/frameworks/base/core/java/android/widget/Editor.java
9dffc27b60e7381a9ad578ef95e03c34beb4a974 17-Aug-2015 Yohei Yukawa <yukawa@google.com> Merge "Clear SuggestionsPopupWindow.mSpansLengths after it is used."
8cf6d865cfb3c05034f947b81de8ca09a92037a0 12-Aug-2015 Raph Levien <raph@google.com> am d202d15d: am cf2d44be: am 855a862f: am c98a786c: am beabcb92: Merge "Fix Insertion ActionMode not showing on RTL languages" into mnc-dev

* commit 'd202d15d9e4845537c4409c9880eb269b2b59129':
Fix Insertion ActionMode not showing on RTL languages
67af994c6cafde37483aac818c89a7482fa07ca4 12-Aug-2015 Yohei Yukawa <yukawa@google.com> Clear SuggestionsPopupWindow.mSpansLengths after it is used.

This is a no risk optimization that minimizes the time when
strong references to SuggestionSpan and Integer instances are
hold in SuggestionsPopupWindow.mSpansLengths.

SuggestionsPopupWindow.mSpansLengths are used while the given
SuggestionSpans array is being sorted. We don't need to keep
object references there after the sort is completed.

No user visible change is intended with this CL.

Change-Id: I7882d741c08d07ad7f905ad1d171c0d13da39397
/frameworks/base/core/java/android/widget/Editor.java
f95ed10d9da55c25013200fb35af63f0dac65cb4 12-Aug-2015 Clara Bayarri <clarabayarri@google.com> Fix Insertion ActionMode not showing on RTL languages

When long pressing on an empty Text field with the system language set
to RTL, the "paste" popup was not showing up.

The Floating Toolbar requires a content rect to determine where the
text is and place itself close to it. In the case of an empty field,
we create a "fake" content rect by taking the placement of the cursor
+1 pixel to the right. In RTL languages, this +1 causes the content
rect to be considered off the bounds of the view, as the cursor is
aligned to the right, and hence the Floating Toolbar is hidden.

After making the rect a 0 width rect, we ran into the issue that
it was considered out of bounds due to the calculation ignoring rects
that simply touch the edge of the view's bounds.

BUG: 22540083
Change-Id: I29c79b701f586970b2611178233eff082b802ec1
/frameworks/base/core/java/android/widget/Editor.java
62aeada1203f572d96e305853aea2c89aef20d49 08-Aug-2015 Seigo Nonaka <nona@google.com> Use TextUtils.substring instead of String.substring.

This is a small refactoring of using substring method.
Calling TextUtils.substring is more efficient than calling
toString and String.substring.

Change-Id: I0a740b2a2fdbfb6b6155c4e926e17889025082f5
/frameworks/base/core/java/android/widget/Editor.java
beb6e66817e084c8a1ac92ecaeb6f0c73d11cc49 28-Jul-2015 Mady Mellor <madym@google.com> Merge "Allow text selection handles to scroll horizontally" into mnc-dev
42390aab4601e671c929974c4233e61e08bb5b9c 24-Jul-2015 Mady Mellor <madym@google.com> Allow text selection handles to scroll horizontally

When selecting text and expanding the selection, the handles snap
to the end (or start) of words. The handles don't snap until the
user has moved halfway through the word.

In horizontally scrolling text views, where some of the text is
cut off, the user cannot be halfway through the word, this causes
the selection to get stuck unless the user scrolls the view and then
continues selecting.

This CL does two things:

1) Checks if the user is close to the edge of the view when the
view can scroll horizontally, and places the cursor at next offset
if available.

2) Moves the code to check if handles are crossing into own method
this should be done each time the cursor is placed and avoids the
need to duplicate the check throughout updatePosition code.

Bug: 22657879
Change-Id: Ic14cb0994cd202a897bf6532f3832bb93ed49bfb
/frameworks/base/core/java/android/widget/Editor.java
45794910031ce2a0e2df3d1694783da7e3c4352b 24-Jul-2015 Andrei Stingaceanu <stg@google.com> Merge "Disallow dragging text in extracted mode" into mnc-dev
b50045a5196696e707e178813c3a61ea4f3c54f7 15-Jul-2015 Andrei Stingaceanu <stg@google.com> Disallow dragging text in extracted mode

Temporary remove this ability.

Bug: 22440907
Change-Id: Ifff4c30919bcb04f7d0ab78f5e9c481381ac7a05
/frameworks/base/core/java/android/widget/Editor.java
fd3eff27bdb2592cf398d11c5f2f03ba5170f962 06-Jul-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Wrong suggestion popup position in extract mode.

Replace text was handled by the original EditText; thus, we
couldn't correctly decide popup window position.
Also, changing selection range replaces entire text of the
extracted EditText. As a result, text cannot be replaced
with the selected item when there is a selection.

This change is a workaround for this issue. This quits
offering "Replace" for selection in extract mode.

Bug: 22038802
Change-Id: I052b027cfd10eeb289f77f4c6b228acf58fea636
/frameworks/base/core/java/android/widget/Editor.java
1c277ca8cd699b15e631342775d996404a75e660 11-Jul-2015 Mady Mellor <madym@google.com> Merge "Fix: line slop shouldn't always increase / decrease by one line" into mnc-dev
a6a0f7829f070ea9f9a6a7c843e53f205630bfc2 11-Jul-2015 Mady Mellor <madym@google.com> Fix line slop issue at end of line for Thai & CJK

Previously touch slop for line movement was based on the line position
of the HandleView, not the previous line touched.

Thai and CJK languages don't have a space at the end of a line so
the handle jumps to the beginning of the next line. This meant that
when calculating the touch slop it'd be from the incorrect line.

This CL tracks the previous line touched and uses that instead to
calculate touch slop and applies it to the selection and insertion
handles.

Note this is *not* added to the drag accelerator because
it does not have the problem of the handle jumping to the next line
since it has no handles.

Bug: 21925162
Change-Id: If4b231725c06489ec780a5b5a308ceffee804c20
/frameworks/base/core/java/android/widget/Editor.java
80679071abb516bcc6470dfcc68ac4d5bc16ff96 10-Jul-2015 Mady Mellor <madym@google.com> Fix: line slop shouldn't always increase / decrease by one line

Touch slop is from the bottom (or top) of the line + line height / 2.
It only makes sense to apply touch slop if the user is within a line
from the previous line. Additionally, not doing this can cause some
undesirable behavior if the user moves very quickly and the selection
catches up with a weird line by line selection increase, potentially
even having the selection be stalled until a next move event.

This CL alters the logic so that if the user isn't within one line
of the previous selection, it'll just use whatever line the user is
currently on.

Bug: 22385003
Change-Id: I4f37988893868e5e2b7925314fe824c3da9c1b97
/frameworks/base/core/java/android/widget/Editor.java
ff66ca5038acc286a99be6001d1cde7606db8699 08-Jul-2015 Mady Mellor <madym@google.com> Use hint text to position handle / floating tool bar popups

In situations where the hint text does not match the direction of
the TextView's primary selection, when you copy text, and long press
in that EditText to paste, the cursor would use the direction of the
hint text to be placed, whereas the handle and floating tool bar
used the TextView's direction to be placed so they wouldn't match.

This CL updates the handle view and floating tool bars to use the
hint text direction when appropriate.

Bug: 21480429
Change-Id: I8090a5b2738c035522c307535ffa165ca024e811
/frameworks/base/core/java/android/widget/Editor.java
bc687f96c74bd164f5d030cebe80d38274ca336c 07-Jul-2015 Andrei Stingaceanu <stg@google.com> Merge "Drag handles persist after lost focus in extracted mode" into mnc-dev
8fbe1a0cfc0354067c10e5e788519c19f4b39349 02-Jul-2015 Abodunrinwa Toki <toki@google.com> Merge "Add accessibility actions for the PROCESS_TEXT feature." into mnc-dev
99d3bbdcbff6a37ef21f4d42845ccff0cbdf1e4c 30-Jun-2015 Andrei Stingaceanu <stg@google.com> Drag handles persist after lost focus in extracted mode

If extracted mode is to be started and we already had a
selection made do not start the action mode but only the
selection. Non-extracted mode keeps the current behavior.

Bug: 22100966
Change-Id: Iad9a95c28474a68dc4fbc7032cbab1dc6e234d45
/frameworks/base/core/java/android/widget/Editor.java
4712b8ef9e6e24e455f48e4bc74019a6b6de5656 01-Jul-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Selection handles can remain on home screen.

This happened as selection handles are shown even when
selection action mode is not active.

Bug: 22188927
Change-Id: Ifd88b91d98cc6f9b0c578e782144b6eee1bdeec9
/frameworks/base/core/java/android/widget/Editor.java
deaf0dbe49fefc20bd0ce55a958205667bd88d3f 27-Jun-2015 Abodunrinwa Toki <toki@google.com> Add accessibility actions for the PROCESS_TEXT feature.

Also refactored the code so that PROCESS_TEXT-related code is shared
by menu item actions and accessibility actions.

Bug: 21890235
Change-Id: Ie932fa9bb5cd3d8bd29f8c82695f3c7490693cbd
/frameworks/base/core/java/android/widget/Editor.java
a526683d123abdd4c2a54f8a4482c4a71a35b301 26-Jun-2015 Mady Mellor <madym@google.com> Text selection: fix snapping to words when words break across lines

Some languages do break words across lines and words can break between
lines with hyphenation. If a word has only one character on the current
line with the rest of the characters on the next line, the user would
be unable to move the cursor to the end of the word.

Rather than judging if a user is far enough into a word by using the
full word length, this CL amends the logic to only use the characters
that are on the current line of the word, if the user is far enough into
these characters the handle jumps to the next line to the end of the
word position.

Bug: 21400624
Change-Id: I8b96eb83bea08d9794d1e9db74066bcc3e168ac0
/frameworks/base/core/java/android/widget/Editor.java
29f37e15975dec1fbb519398e5e80b16d61a5d0c 26-Jun-2015 Mady Mellor <madym@google.com> Merge "Text selection: When user reaches midpoint jump to end of word" into mnc-dev
10f925173630c89239e2f42deb6cb042e9300d39 26-Jun-2015 Mady Mellor <madym@google.com> Merge "Text selection: Fix word boundaries for languages without spaces" into mnc-dev
a2861454aa287e4986e0241f5158324a4c8ef15c 25-Jun-2015 Mady Mellor <madym@google.com> Fix: Don't display the drag handles when focus is lost

The text selection handles should be hidden / shown when the window
loses / regains focus.

Additionally renames method to make more sense.

Bug: 22062480
Change-Id: I6e160234cf112ee285367637e2f1c14defd82e89
/frameworks/base/core/java/android/widget/Editor.java
838307275214cb9b51dff15a401013420aa4376a 19-Jun-2015 Andrei Stingaceanu <stg@google.com> Floating toolbar shown after rotation in extract mode

Do not start the floating toolbar action mode and
do not show the handles if after a rotation when the
extract mode will be started. This fixes an issue where
onTouch after rotate duplicates the handles in extracted
mode.

Note: if NO_EXTRACT_UI flag is set then the toolbar,
selection and handles preserve their state.

Bug: 21960251
Change-Id: I1c7881bf2f40d8877fa0ce26e27a29398edc1296
/frameworks/base/core/java/android/widget/Editor.java
e264ac392a886788ebfd1069e1d366e2b1edef72 23-Jun-2015 Mady Mellor <madym@google.com> Text selection: Fix word boundaries for languages without spaces

WordIterator's getEnd/getBeginning methods does not support the needs
for word boundary detection in text selection. Consider the words
AABB (where AA and BB are each words). If getEnd is given the offset
on the boundary between AA and BB, it would return that offset since
it is the end of AA. For text selection we always want the "next end"
if available.

This CL adds two methods to word iterator that return the next end
and previous beginning.

This CL also alters the code in Start/EndHandle to use the x value
and current / prev line positions to determine if the user is
expanding or contracting the selection.

Bug: 21305292
Change-Id: I6e7a83e53e245d71e43d78f1957f844f2ed1cdfb
/frameworks/base/core/java/android/widget/Editor.java
b1891b3fc9d07ef766978f0a39c382b217a529e0 19-Jun-2015 Andrei Stingaceanu <stg@google.com> Fix selection by double tap in Extracted mode

Select with double tap in extracted mode has suffered
a regression recently: flickers and it does not correctly
select. Found this fix after a lot of trials.

Bug: 20128047
Change-Id: I1bbe8c11982d37e5409bac2b648a31b0ca1f0bbc
/frameworks/base/core/java/android/widget/Editor.java
8fc9bed98579ed2696a89cd43472ee414e74be6b 19-Jun-2015 Mady Mellor <madym@google.com> Text selection: When user reaches midpoint jump to end of word

Adjusts the point at which the handles jump to the end of the word.
Previously it was 1 or 2 characters depending on word length, now it
will use the midpoint of the word.

Bug: 21131483
Change-Id: I0d3c1bf4672ae27781318cf2563051cc66bb9f98
/frameworks/base/core/java/android/widget/Editor.java
03709c780ae26a2b27d098782364ba722e711564 18-Jun-2015 Mady Mellor <madym@google.com> Merge "Text selection: update touch delta when moving towards handles" into mnc-dev
fe67c1ec6d0f08542fad2fc1a3fb858d99d40341 18-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: Drag handle jumps between bidi boundaries." into mnc-dev
5279d11f258a01cfdf0a16d965b5e4cd7566b8ac 17-Jun-2015 Mady Mellor <madym@google.com> Merge "Drag to select text: add some slop for moving between lines" into mnc-dev
ee3821e565496bd3dc470bb3f833a875b3650a20 05-Jun-2015 Mady Mellor <madym@google.com> Insertion cursor: add some slop for moving between lines

Applying same method to insertion cursor as the text selection drag
handles to improve moving along lines.

Basically adds some slop above / below the current line and only
allows you to change lines if you move outside of that.

Bug: 21306433
Change-Id: I6c7f3a496fbd1ea66936832f96325736cea872aa
/frameworks/base/core/java/android/widget/Editor.java
f9f8aebdc697e6ea1deff1aa82d0cec0e1ebacef 17-Jun-2015 Mady Mellor <madym@google.com> Drag to select text: add some slop for moving between lines

It's pretty easy to accidentally move to a different line when
selecting text. This CL makes an adjustment so that if the user
is on a line, they must move above the top of it + slop to move
up a line, and they must move below the bottom of it + slop to move
down a line. This applies the changes to the drag accelerator.

This CL also makes an adjustment to not apply the finger offset
to the drag accelerator until the user has moved lines, this was
causing an issue where it would immediately include the above line
when initiating the selection.

Bug: 21306433
Bug: 21303943
Change-Id: Id240136493f62524fe6445d8bd65479084fe8126
/frameworks/base/core/java/android/widget/Editor.java
cc65c37f108d916b931af2432337704696f175f0 17-Jun-2015 Mady Mellor <madym@google.com> Text selection: add some slop for moving between lines

It's pretty easy to accidentally move to a different line when
selecting text. This CL makes an adjustment so that if the user
is on a line, they must move above the top of it + slop to move
up a line, and they must move below the bottom of it + slop to move
down a line.

This CL also makes a small modification to check if the layout is
null and return early which simplifies some of the following code.

Bug: 21306433
Change-Id: I4a854e644faafaf1e159201ae1f2838862f16b25
/frameworks/base/core/java/android/widget/Editor.java
f444b5c3ae46f8790c8f2a8481fb688b00a42d3b 16-Jun-2015 Abodunrinwa Toki <toki@google.com> Fix floating toolbar flickers.

-Flicker was a side effect the delay in hiding the toolbar when
there is a down press on a TextView handle. The timing clashed
with the time it takes for the FloatingActionMode to release a
hide lock on a changing content rect. Extra flickers also happened
if the ActionMode happened to be invalidated at about the same time.
Since there was no longer a hide lock, the toolbar refreshed, getting
rid of the "Select all" menu item.
FIX. I believe we don't need the delayed hide on down press on a
TextView handle. I've removed this.

-I've also updated FloatingActionMode to ensure that hide locks
overlap one another if necessary. The toolbar can only be visible if
all locks are off.

Bug: 21793687
Change-Id: I290ea45ab17d5862b453cb319afb4c8ffe084cd0
/frameworks/base/core/java/android/widget/Editor.java
f4e347d6aec7f1ff09c23aea8f3378d0b390eac6 11-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Reset drag accelerator state in Editor#sendOnTextChanged.

This fixes a crash that happened because mStartOffset
could point to an invalid offset after changing the text.

Bug: 21178876
Change-Id: I2fbb5ea3d6b8c5a97ca7248116b58ead673a8b0a
/frameworks/base/core/java/android/widget/Editor.java
89124000c618f24b948505cd79f654aacbdff957 10-Jun-2015 Clara Bayarri <clarabayarri@google.com> Merge "Fix Floating tool bar flickers after long pressing on empty region." into mnc-dev
136a462c8bb35bdd21258f03f3f9adca06990701 10-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Revert "Fix: Crash when modifying text while using drag accelerator."" into mnc-dev
eac4556e55ad6dda26a1c0172947c5df2a771ad7 10-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Revert "Fix: Crash when modifying text while using drag accelerator."

This reverts commit 259292ff3de5b9a64e8e3bb4a62a533aef4125b7.

This introduced another bug (Bug: 21687602) and this is no longer useful
for the original one (Bug: 21178876).


Change-Id: I59acc161e7d8cba633718a3d17292e68740ef79e
/frameworks/base/core/java/android/widget/Editor.java
b71ddddfd3d950a723fc8a3e996e6c32f214fad7 05-Jun-2015 Clara Bayarri <clarabayarri@google.com> Fix Floating tool bar flickers after long pressing on empty region.

Bug: 21452427
Change-Id: Icc70b85279fde1aa9d5c10bd89bb886797a49235
/frameworks/base/core/java/android/widget/Editor.java
43fd2f426a0c9f562a7b3809718563086a0f79ff 08-Jun-2015 Mady Mellor <madym@google.com> Text selection: update touch delta when moving towards handles

When the text selection drag handles jump to the end / start of a
word, the delta between the current touch position and where the
handle jumps to is tracked. Previously this value was not updated
if the handle jumped and then the finger moved towards the handle.

This CL adjusts the logic to update the delta in this situation.

Bug: 21131483
Change-Id: I331f53191103e1a3fc08e34b5df5cd6cbc177af6
/frameworks/base/core/java/android/widget/Editor.java
7184c8aaf1c1bae4f6b1e31125342c6d023e1ec5 05-Jun-2015 Clara Bayarri <clarabayarri@google.com> Remove insertion action mode runnable on selection start

This was in a previous change and accidentally got reverted on a rebase.
When going from an Insertion to a Selection/Drag Mode we want to make
sure no insertion modes are started by pending requests.

Previous change with accidental rebase:
I91bcd0d9c3e68d9c736698fe0bec010b4c9f5cf3

Bug: 21647271
Change-Id: I32c152494d236b693a489ea97448904163c9620a
/frameworks/base/core/java/android/widget/Editor.java
7d3b8833df5857f5cc70d6c101abe7501fa22b49 08-Jun-2015 Abodunrinwa Toki <toki@google.com> Merge "Fix ActionMode.snooze API" into mnc-dev
3e85c1ed0cce70164dfe6f8ffa4bf3695c4ce0ba 05-Jun-2015 Clara Bayarri <clarabayarri@google.com> Merge "Fix Select All should not be shown when everything is already selected" into mnc-dev
9e211282d3ee54c9840947951593554c3bd5a77c 05-Jun-2015 Abodunrinwa Toki <toki@google.com> Fix ActionMode.snooze API

Bug: 21572677
Change-Id: If9fdb8ace3773b983418b0148082712644fd1fa5
/frameworks/base/core/java/android/widget/Editor.java
01243ac57e7be3c409c1238eff352c0e8acbe9ef 03-Jun-2015 Clara Bayarri <clarabayarri@google.com> Fix Toolbar is not refreshed after Select All

Bug: 21361248
Change-Id: Iab913bd610c208e5881d3d0eb5574efdf9eb5d92
/frameworks/base/core/java/android/widget/Editor.java
3b69fd81df89896cdd6c2903c79da744bd1eabfd 03-Jun-2015 Clara Bayarri <clarabayarri@google.com> Fix Select All should not be shown when everything is already selected

Condition Select All on whether the full text is already selected,
and add/remove this item when needed on ActionMode invalidation.

Bug: 21608943
Change-Id: Iad5f8a77a03b98024f7dcf355b2f7f0d1338b94a
/frameworks/base/core/java/android/widget/Editor.java
c1f28bc97d2f88f839269ce701c7fe68c4f1615a 05-Jun-2015 Clara Bayarri <clarabayarri@google.com> Merge "Separate the SelectionActionMode into Insertion and Selection." into mnc-dev
7938cdbf985f88017f994e69cfe517970cb65b4d 02-Jun-2015 Clara Bayarri <clarabayarri@google.com> Separate the SelectionActionMode into Insertion and Selection.

When we got rid of the paste popup, we merged it into the Selection
ActionMode and moved all its invocations to the ActionMode. Some apps
actually want the paste popup without the Selection ActionMode, hence
separating them again allows them to cancel the one they want.

Bug: 21571422
Change-Id: I91bcd0d9c3e68d9c736698fe0bec010b4c9f5cf3
/frameworks/base/core/java/android/widget/Editor.java
4186b1d4d833544f007009e437eecebb037677f2 04-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Stop offering "Replace..." when there are no suggestions." into mnc-dev
eb665337162416c4754a9f11005004a8d936775e 04-Jun-2015 Clara Bayarri <clarabayarri@google.com> Merge "Fix Floating tool bar covers text during long press + drag" into mnc-dev
95753e2f4b423bd914d6087c1847fc851080cae9 03-Jun-2015 Mady Mellor <madym@google.com> Merge "Ensure to reset state of selecting by word/char for new selections" into mnc-dev
dfac443516118631091124dfba271194fcaf5076 15-May-2015 Clara Bayarri <clarabayarri@google.com> Fix Floating tool bar covers text during long press + drag

The existing implementation started the ActionMode even when knowing
a drag would start. Moved this logic to once the drag is complete,
to avoid the toolbar popping up while the user is still dragging.

Since the existing method selected the initial word when no other
selection existed, refactored that logic so it is also performed at
the start of the drag. Otherwise, the user sees no selection until
he drags over 2 or more words.

Bug: 21144634

Change-Id: I97cf89b1c4c3ebdbbd1af50bd1ce5aa4af72164b
/frameworks/base/core/java/android/widget/Editor.java
36d5a7b22500ec8c3d754e9caf1728dda168ad92 22-May-2015 Mady Mellor <madym@google.com> Ensure to reset state of selecting by word/char for new selections

Previously this value was only updated when interacting with the
selection handles, so if you started a selection, entered by-char mode,
and then started another selection you would still be in by-char mode.
This resulted in incorrect behavior.

This CL alters the logic to update the handle state whenever the cursor
is placed which will included the initial long press to select a word.

Bug: 21301589
Change-Id: I15dbe6f2b76c7edd8ea4b3ba53e7107c47bc48fa
/frameworks/base/core/java/android/widget/Editor.java
a447937dd38003f09a27c578ec2899777348ca7f 21-May-2015 Clara Bayarri <clarabayarri@google.com> Fix TextView ActionMode overflow finishes the ActionMode

stopSelectionActionMode() was called within hideCursors, and this
gets called in many scenarios. One of them is onWindowFocusChanged,
which is triggered when the user clicks the overflow icon in the
action bar. Removed the action mode call from this use case.

Bug: 21267270
Change-Id: I1cd359e87de67141627e25d2ec520fc91303a48d
/frameworks/base/core/java/android/widget/Editor.java
aee243b825d57ba3e1b7893e86f5bdad74796c6b 18-May-2015 Clara Bayarri <clarabayarri@google.com> Make Text Selection Action Mode secondary items IF_ROOM

The fact that they were all ALWAYS caused the ActionBar version
of the ActionMode to show truncated text to try and fit them all.

In an ideal case we will always have a Floating ActionMode, but
the client can explicitely change this and hence we should fallback
gracefully.

Additionally, remove the SHOW_AS_ACTION_WITH_TEXT flags as we
removed the icons from the items anyway.

Bug: 21264711
Change-Id: I13a9aafd0fc6f6642d3a4a3399f71e739a1dce8d
/frameworks/base/core/java/android/widget/Editor.java
373816ef1f7ab9954889ed02a6b2b39fe4aa4f44 28-May-2015 Andrei Stingaceanu <stg@google.com> Stop showing both the floating toolbar and suggestions

The selection mode without selection (PASTE|SELECT_ALL)
pops up along the suggestion popup if we tap on a word
within 15sec of the most recent cut/copy/textChanged
operation. Fix this by making suggestion popup take
precedence.

Also moved the invalidation of the text changed time
into the handleTextChanged() which fixes the selection
mode starting once after the text has changed.

NOTE: Subsequent clicks on non-suggestion spans will
still trigger the selection mode without selection if
within the defined timeframe.

Bug: 20443325
Change-Id: If2726e2c965e77e82ef7b847cf352d4426205bdc
/frameworks/base/core/java/android/widget/Editor.java
dbe2c293e113b35b43abdb5733311782f9afe11c 27-May-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Drag handle jumps between bidi boundaries.

mHotspotX and mHorizontalGravity was updated even when the
handle is dragging. As a result, updatePosition() can be
called with the adjusted coordinate for the updated text
direction.

Bug: 21131463
Change-Id: Ie3c2215a0d978db655d55693ee484f04ce5b35fa
/frameworks/base/core/java/android/widget/Editor.java
7e4fbe03899a2c278ffdf1e36fb4a16dc8cc204c 22-May-2015 Keisuke Kuroyanagi <ksk@google.com> Stop offering "Replace..." when there are no suggestions.

Suggestions in a suggestion span can be empty. When all
suggestion spans don't have any suggestions, we shouldn't
offer to show suggestions.

Bug: 21046505
Change-Id: I48a1e19b176769743ad14c5109e4cb3fc9416393
/frameworks/base/core/java/android/widget/Editor.java
1733bd3defde7818940d72dac95bb18fb8d70b22 22-May-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: Insertion handle can be moved just by tapping." into mnc-dev
27a63612343a3b4afb4deca6a992615855510963 21-May-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: Crash when modifying text while using drag accelerator." into mnc-dev
b300d31bf1cb138f0a7c4c484459cc6a2ce2f69c 20-May-2015 Mady Mellor <madym@google.com> Merge "Text selection: fix some issues with drag accelerator" into mnc-dev
3244a6633680cf98fa7a55534e3ebf2dea7389ee 20-May-2015 Mady Mellor <madym@google.com> Merge "Fix selection handles on older API versions" into mnc-dev
7a93644d5e2a783207b547713b861e55b21324c4 20-May-2015 Mady Mellor <madym@google.com> Text selection: fix some issues with drag accelerator

Couple of overlapping issues that this CL fixes. The major change is to
offset the selection vertically this is similar to how the handles work
already (i.e. touch target is below what's being selected), and still
allows the user to see the selection start / end without covering it with
their finger.

This change fixes multiple issues:
1) Previously to ensure the finger wasn't covering the selection a
preceding or following offset was taken, this made it difficult to
select certain words and it made text on the edge of the screen hard
to select (b/21098345 and b/19965619)
2) The use of preceding and following on the word iterator was not correct
allowing grapheme clusters to be split, now the offset is calculated
with getWordStart/End which respect grapheme clusters (b/21045116)

Bug: 21098345
Bug: 21045116
Bug: 19965619
Change-Id: Id8392426cce20ad0ff47a4279c92f6ed1b0ad30e
/frameworks/base/core/java/android/widget/Editor.java
8c44e74524a43ad7cb41b1641bb2dac75cf9c7e8 20-May-2015 Andrei Stingaceanu <stg@google.com> Merge "Landscape extracted mode - floating toolbar interference" into mnc-dev
975a8d0f4d6b5c2ec954c4db11d95de1a553227e 19-May-2015 Andrei Stingaceanu <stg@google.com> Landscape extracted mode - floating toolbar interference

In landscape do not allow starting selection modes if the
extracted mode has not yet started. Also remove the single
tap selection delayed runnable.

This allows for a smooth transition (as in no floating
toolbar artifacts) into extracted mode. Also fixes
(more as in hides) the double selections.

Bug: 20930071
Change-Id: Idb9c375dc25777761b11ca17ccfd9f5eedc642b4
/frameworks/base/core/java/android/widget/Editor.java
fd3a3a1163c5096821cef351309fcdd9a4f48002 05-May-2015 Abodunrinwa Toki <toki@google.com> Hide floating toolbar when user interacts with screen.

- Adds an ActionMode.snooze(int) API.
- Clients call this to hide the floating toolbar on DOWN touch event.
- This is called repeatedly as a snooze timeout will re-show the
toolbar.
- ActionMode.snooze(0) will "wake" the toolbar, reshowing it.
- Clients call this to re-show the toolbar on UP touch event.
- This CL also adds code to hide the toolbar when the "content rect"
is changing.

Bug: 20148125
Change-Id: If5a9a15f72c73cad8ca01a4328a58570b3e29f66
/frameworks/base/core/java/android/widget/Editor.java
bc89a5ce34c676b6baa37253589989b772010f35 18-May-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Insertion handle can be moved just by tapping.

Horizontal poistion is passed to updatePosition() without
adding getHorizontalOffset(). The position is wrong for the
insertion handle; thus, the handle is moved just by tapping
on it.

Bug: 20923263
Change-Id: Ie867ebd9e6b682057b73373fefb7b2baf45caef9
/frameworks/base/core/java/android/widget/Editor.java
259292ff3de5b9a64e8e3bb4a62a533aef4125b7 15-May-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Crash when modifying text while using drag accelerator.

Drag accelerator state was not cleared when the text was
modified; thus, mStartOffset could point to an invalid offset.

Bug: 21178876
Change-Id: Ic9b47375bab321fbc573e8a81e3fadf60309da78
/frameworks/base/core/java/android/widget/Editor.java
e20b22feb32d82a50a933141ecb8d03457a66f11 18-May-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: Drag handle isn't updated after crossing bidi boundary." into mnc-dev
33f81ac108bd4d0ec709107e5ba1748221fc39e8 14-May-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Drag handle isn't updated after crossing bidi boundary.

mDrawable is updated, but it was not re-drawn properly.
postInvalidate() should be called when the drawable is
updated.

Bug: 21141841
Change-Id: Icb3ddf18d05285ffa8758a9be256482d594ab8ed
/frameworks/base/core/java/android/widget/Editor.java
709386f501c5a496c8bbfa0336af03f3e09e5484 14-May-2015 Mady Mellor <madym@google.com> Fix selection handles on older API versions

The new assets didn't have the same padding on the edges as assets on older
versions. The adjustments to the getHotspotX code for the new assets broke
how the handles on older API versions were placed.

This CL updates the assets to have the same padding (i.e. handleWidth / 2
on each side of the handle and changes the getHotspotX methods for this.

Bug: 20829391
Change-Id: If7e466d200ef7757831bc763c3c3ce4a8bbf63fc
/frameworks/base/core/java/android/widget/Editor.java
21417a0d50891e2d9d07c9c68f09da4931f053ff 15-May-2015 Mady Mellor <madym@google.com> Merge "Text selection: Fix moving by character when should move by word" into mnc-dev
c25d6c22bbb2b8d6efbe4b4ab5252ca8f266889f 15-May-2015 Mady Mellor <madym@google.com> Merge "Fix difficulty grabbing handles for small selections" into mnc-dev
81fa3e89668c498d5314a64dfff71d0553f8c5f7 14-May-2015 Mady Mellor <madym@google.com> Text selection: Fix moving by character when should move by word

The code to restrict handles from crossing did not respect moving by
word or by character. This CL checks the offset to see if it's crossing,
and if it is, it restricts it to the line of the other handle and proceeds
with determining the "actual" offset based on the activated
mode by word / by char).

There is also still a check to ensure that one character is selected
after the mode as adjusted the offset.

Bug: 21114827
Change-Id: Idac699ef2eb5d313e77d44b5064c03ff84e0fb88
/frameworks/base/core/java/android/widget/Editor.java
fae270c108f774d48f5b8f122d46c533ad4ef2f5 29-Apr-2015 Andrei Stingaceanu <stg@google.com> Editor: enable double tap for selection after cut/copy.

* detect double tap in the TextView and pass it to Editor.
* add a timer (with getDoubleTapTimeout) for executing the
single tap job in Editor.
* if double tap is detected then cancel the single tap job.

This way one tap shows the toolbar if within the timeframe
and two taps select the word and show the toolbar.

Bug: 20442587
Change-Id: I0a117939c896fcb13669346e30c9c48d319576dd
/frameworks/base/core/java/android/widget/Editor.java
35c550c854a99ae890d7cffcee4491e68c71a09d 07-May-2015 Andrei Stingaceanu <stg@google.com> Fix: text selection bubbles move along with the text

Always hide the selection cursor when showing the
insertion cursor.

Bug: 19857679
Change-Id: I549552fa5026e60f94900364b8194217e0de4b4a
/frameworks/base/core/java/android/widget/Editor.java
c398adf81c5167fc4b9b9cefd1550bc8fd4a54e6 14-May-2015 Andrei Stingaceanu <stg@google.com> Merge "Fix floating toolbar popping frequently after Replace/Copy" into mnc-dev
78e2f07e81ee9040a4ecca331411123ef35d81c2 14-May-2015 Andrei Stingaceanu <stg@google.com> Merge "Fix: replace terminates extract mode (floating toolbar)" into mnc-dev
0138e4c7f8b7a9b04b021e12c6bf08bedb42e42f 11-May-2015 Keisuke Kuroyanagi <ksk@google.com> Track difference between touch and word in x coordinate.

After a handle is snapped to the word, the difference was
tracked in offset. It can break grapheme clusters, ignores
character width, and makes it difficult to select text near
line breaks.

Bug: 21005599
Change-Id: I42402a377670c7e3c6d6e6583744d085ae52bba2
/frameworks/base/core/java/android/widget/Editor.java
21623faa449496d68bd102ddda5874f572b9c55a 13-May-2015 Mady Mellor <madym@google.com> Merge "Fix issue where handle is in front of word rather than end of word" into mnc-dev
2e577d2e1c19c6fe9f22e0abbef9b35c6f627e27 13-May-2015 Mady Mellor <madym@google.com> Fix difficulty grabbing handles for small selections

The gravity for the handles pushes them to the outside of the touch target
square, causing the touch target to overlap for both of them when close
together. This CL swaps the gravity so that the touch target does not
overlap when the handles are close.

Bug: 20065564
Change-Id: I4d14e7076ac779c5f4a0a603d6348ba6dc7c7b4c
/frameworks/base/core/java/android/widget/Editor.java
58c9087137989da8411ffd212072f630d3fac4f3 12-May-2015 Mady Mellor <madym@google.com> Fix issue where handle is in front of word rather than end of word

Previous getWordEnd and getWordStart functions would return a boundary
rather than a word end / start boundary in some cases. This behavior is
most evident when moving between short lines -- the handle would go to
the next boundary rather than the word end on the next line (and the
start handle would go to the word end rather than the word start on
the prev line).

This CL ensures that word or punctuation boundaries are returned and moves
most of the punctuation boundary logic into WordIterator since it makes
a bit more sense there.

Bug: 21030788
Change-Id: I96c6aff7f2c213aa3c4f66ac87ca913ca16fd347
/frameworks/base/core/java/android/widget/Editor.java
6a49ddef62865c1b245ad60a13c334f0ffaf1a5f 12-May-2015 Chris Craik <ccraik@google.com> Revert "Fix build - Revert "Revert "Use default constructor to get anti-aliasing"""

Fix import

This reverts commit 7ed1431c83286abc83b9e5afc45fbd21ecb777b1.

Change-Id: Id93eba3ed1d47a90384ba20dea6f74d78755792b
/frameworks/base/core/java/android/widget/Editor.java
7ed1431c83286abc83b9e5afc45fbd21ecb777b1 12-May-2015 Chris Craik <ccraik@google.com> Fix build - Revert "Revert "Use default constructor to get anti-aliasing""

This reverts commit dfe0a66ceca530e0777ebfab20f81103baa18f14.

Change-Id: I58a1bae649a284f3d3b6213064d903ea7fcf185a
/frameworks/base/core/java/android/widget/Editor.java
dfe0a66ceca530e0777ebfab20f81103baa18f14 12-May-2015 Chris Craik <ccraik@google.com> Revert "Use default constructor to get anti-aliasing"

bug:20948129

This reverts commit 58fc522a69e8ddf9ac8530ce88e9c2c92da1dd14.

Change-Id: Iddeccb4ad15b843bb3e610bd3673a0c7abc1bf46
/frameworks/base/core/java/android/widget/Editor.java
eeb9afc78f5f0770b5a311f97d7b0702fdf81e28 12-May-2015 Andrei Stingaceanu <stg@google.com> Fix: replace terminates extract mode (floating toolbar)

Moved the replace action to be triggered from the TextView
rather than the Editor. Previously the ExtractedEditText
was calling the TextView.onTextContextMenuItem which did
not hold an entry for replace and thus was returning
false.

Note: this CL does not fix the extracted mode being
(randomly) terminated when edit actions are pressed. This
is still under investigation.

Bug: 20930071
Change-Id: I71f87418f040f6860fe7723e4cd731c298cf3c5f
/frameworks/base/core/java/android/widget/Editor.java
1baed51603b1a26277b759d3b23db9b93b710a4e 11-May-2015 Clara Bayarri <clarabayarri@google.com> Fix Floating toolbar is not refreshed when dragging insertion handle

Bug: 20922753
Change-Id: Iaee310ee0b8593df4d7846c2676e2c70011d0657
/frameworks/base/core/java/android/widget/Editor.java
f659a56c3062392d6b6020d148553ce49797eb5a 09-May-2015 Alan Viverette <alanv@google.com> Merge "Replace usages of deprecated version of TextView.setTextAppearance()" into mnc-dev
bb98ebd6b15f4cf942b156892988801c95601f2f 09-May-2015 Alan Viverette <alanv@google.com> Replace usages of deprecated version of TextView.setTextAppearance()

Change-Id: Ie501affe2e3a275d3172ce8ed584ba1cd5494da8
/frameworks/base/core/java/android/widget/Editor.java
50a927cdd14db7a99a7444ffb7c85f1882c9f43a 07-May-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Hard to modify multi-line selection.

mTouchWordOffset was not appropriately updated when a
selection is modified across multiple lines.

Bug: 20650838
Change-Id: I46f5393970dc8d806719467bac489feac0fbe1a5
/frameworks/base/core/java/android/widget/Editor.java
a18df8d6c7f7eb7c2cd6cff3dfe8decd177752fa 07-May-2015 Mady Mellor <madym@google.com> Merge "Consider punctuation treatment when selecting text." into mnc-dev
636a0da80533eff7fa8b67afb07277b0ba065d7c 07-May-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: A part of grapheme cluster can be selected." into mnc-dev
6c7b4ad690fe5c22c01ad79a232e567e835f676d 15-Apr-2015 Mady Mellor <madym@google.com> Consider punctuation treatment when selecting text.

This treats punctuation as "words", so groups of punctuation will be
selected together, i.e. "Hmm... yay!!!" would be treated as four words:
Hmm-...-yay-!!!

Bug: 19950062
Change-Id: Ic9514c524092734fad1abdf19a736bfa1406157b
/frameworks/base/core/java/android/widget/Editor.java
6a6126834e15c7bf6df9c5c0a3fe997e533b8583 07-May-2015 Mady Mellor <madym@google.com> Revert "Text selection - Don't select vertical white space"

This reverts commit b9bbbb1d97adb8ffdda2af14921401aabcec8cdd.

Bug: 20653654
Change-Id: Id96409ac17783bd1e7055913f14de8741d0f9caf
/frameworks/base/core/java/android/widget/Editor.java
77b9c388c9e1d34fedcd08c5c227fb072bd06786 06-May-2015 Andrei Stingaceanu <stg@google.com> Fix floating toolbar popping frequently after Replace/Copy

Invalidate the LAST_CUT_OR_COPY_TIME when text changes. Reflect
this in the variable names. Fixes the selection mode without
selection (PASTE|SELECT_ALL) toggling when changing text in the
15 sec window this mode has to show.

Bug: 20440790
Change-Id: Ie7ea55916e1633ed4981654c6d80168b1247bc35
/frameworks/base/core/java/android/widget/Editor.java
4d5c20c613a6716b14bd8ca3f178672c356a89e5 06-May-2015 Alan Viverette <alanv@google.com> Merge "ListPopupWindow should use window layout type SUB_PANEL" into mnc-dev
d1808401ca3bfd6b6b9a975c1e739b194d18f849 05-May-2015 Prerepa Viswanadham <dham@google.com> Merge changes from topic 'mwd-merge-050415' into mnc-dev

* changes:
Merge commit 'b6f59f4' into master_merge
Merge commit 'f6db0ce' into master_merge
Merge commit '17455a3' into master_merge
Merge commit 'b4d5b32' into master_merge
Merge commit 'a1a2fa7' into master_merge
Merge commit '8dfdb98' into master_merge
Merge commit 'eba66c3' into master_merge
b6bec1a403fd3efc59acb2c2206aaf6b6840c2f1 02-May-2015 Yohei Yukawa <yukawa@google.com> Remove unused methods/variables/fields from Editor.java.

This CL does nothing but remove unused code.

Change-Id: Ibe7c7aa1b9bdfd4117e27cb198082e307f4d68a4
/frameworks/base/core/java/android/widget/Editor.java
85d08f1bf859297bcd22b53ed777ea4cccd071cc 30-Apr-2015 Yohei Yukawa <yukawa@google.com> Suggestions popup must be dismissed before device rotation.

This is a follow up CL for Ia515fc576ddf2127b2f9863cc2652aeb619fff6e
for Bug 5420741, which had basically the same goal to Bug 20158984.

The goal here is to dismiss any popup window opened by the TextView
when the device is about to be rotated. This is important because
Window Manager and Input Method Manager Service are really sensitive
about which window is focused before and after the device is rotated.

In Ia515fc576ddf2127b2f9863cc2652aeb619fff6e, we tried to distinguish
two kinds of focus-lost. One is the true focus lost where suggestions
pop-up (if any) should be dismissed, and the other is an side effect
of showing the suggestions pop-up itself. We have used isShowingUp()
to distinguish distinguish one from the other. In short, it
indicates whether onWindowFocusChanged() is not called yet or is
called at least once.

In extract edit mode, however, it turned out that
onWindowFocusChanged() is never called (at least in recent builds).
As a result, the popup window is not dismissed when it should be.
One of the smallest solution would checking isShowingUp() only when
the target TextView is not ExtractEditText.

Adding unit test would be handled as Issue #20703391.

BUG: 5420741
BUG: 20158984
BUG: 20703391
Change-Id: I1706cf2ea0b0bdfe8894ab57fc3caa8ff12d8aab
/frameworks/base/core/java/android/widget/Editor.java
80ebe0d4ecb36d0e82dce499ccc0810cf3a0ec89 01-May-2015 Alan Viverette <alanv@google.com> ListPopupWindow should use window layout type SUB_PANEL

Look down, back up, where are you? You're in a dialog with an
AutoCompleteTextView. What's on your screen? I have it, it's the
auto-completion results you could be seeing. Look again. The window
layout type is now TYPE_APPLICATION_SUB_PANEL and the auto-completion
results are visible.

Also adds API on ListPopupWindow to specify the window layout type
and changes the text editing handle to be type ABOVE_SUB_PANEL.

Bug: 18530738
Change-Id: Id5577c4892729920de5b73411e580e6b2b2401d0
/frameworks/base/core/java/android/widget/Editor.java
47ea8b3d6bcef193a2d0ec9f0141525c83a0bcda 29-Apr-2015 Abodunrinwa Toki <toki@google.com> Merge "DO NOT MERGE: Update floatingtoolbar position when cursor moves." into mnc-dev
eea5a9e0de5825bf3629ad52a51a0dcf5f064fe5 29-Apr-2015 Andrei Stingaceanu <stg@google.com> Merge "DO NOT MERGE - Minor clean up: redundant functionality in Editor and TextView." into mnc-dev
2ceea2160e4ca89c426c2fcf9c77029ecf15e3e1 29-Apr-2015 Alan Viverette <alanv@google.com> am 9c36ee9b: am 2ddfcc4a: Merge "Context leaks in EditText causes out of memory"

* commit '9c36ee9b4f42909c1a425322e4e2d3e86dd6edc5':
Context leaks in EditText causes out of memory
9c36ee9b4f42909c1a425322e4e2d3e86dd6edc5 29-Apr-2015 Alan Viverette <alanv@google.com> am 2ddfcc4a: Merge "Context leaks in EditText causes out of memory"

* commit '2ddfcc4ade5d6db69808a340ae54280872559ec1':
Context leaks in EditText causes out of memory
3f3839bad034d3586804f784452a782e1a7bd8ed 29-Apr-2015 Chris Craik <ccraik@google.com> am e01d4b35: am 4f66e48d: am 2f1d09c3: Merge "Use default constructor to get anti-aliasing" into mnc-dev

* commit 'e01d4b35664070953adc28e8cc77c579579d41a6':
Use default constructor to get anti-aliasing
c7850626e41d3f53afc086d87014355f06d59849 29-Apr-2015 Chris Craik <ccraik@google.com> am 4527289b: am 0e7d1432: am ff623a5a: Merge "Remove unused flags and dirty rects" into mnc-dev

* commit '4527289b767865053ef6fa6aaa0a836ecba29dbb':
Remove unused flags and dirty rects
2f1d09c3c5e80e875f588d77bc1e47d317491fa8 29-Apr-2015 Chris Craik <ccraik@google.com> Merge "Use default constructor to get anti-aliasing" into mnc-dev
58fc522a69e8ddf9ac8530ce88e9c2c92da1dd14 28-Apr-2015 Chris Craik <ccraik@google.com> Use default constructor to get anti-aliasing

Change-Id: I3e078a3bc91a2fd703984ba18b5e7e98069b32f1
/frameworks/base/core/java/android/widget/Editor.java
bcdf0ab13df0bb19ec897cd614f117b4b1da74f7 25-Apr-2015 Abodunrinwa Toki <toki@google.com> DO NOT MERGE: Update floatingtoolbar position when cursor moves.

NOTE: This is only done on ACTION_UP event since the toolbar is
going to be hidden while one is dragging the handles.

Change-Id: Id09fc076edb0117ebceb26395ac91ee4d2283c2d
/frameworks/base/core/java/android/widget/Editor.java
47f82ae811e0036c005837c649dee5f1bb6d2595 28-Apr-2015 Andrei Stingaceanu <stg@google.com> DO NOT MERGE - Minor clean up: redundant functionality in Editor and TextView.

This is a no-op.

Change-Id: I28ec363a256d3d1a94e378d428897cc67c77d578
/frameworks/base/core/java/android/widget/Editor.java
956f340aacc7d8fc2d10f776551f13fde2d8d3ab 28-Apr-2015 Chris Craik <ccraik@google.com> Remove unused flags and dirty rects

bug:17209071

Also update DisplayList->RenderNode naming in Editor

Change-Id: I1d505640ba7388a0b0042d9c787f859e45a24da5
/frameworks/base/core/java/android/widget/Editor.java
dda59d7ebf801f1e22f8173c7ed7c9947c657e7b 28-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> am 716a5690: am a3a411ec: am d2b9bd80: Merge "Fix: End handle disappears when the selection is short." into mnc-dev

* commit '716a569053e9a58caad7a0ca68797dad786713ad':
Fix: End handle disappears when the selection is short.
9c68b29c22a95270879f1552dec4182e8e118411 24-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: A part of grapheme cluster can be selected.

Previously, when a selection handle is about to pass the other
handle, the offset of the handle was computed with +1 or -1 to
the offset, without considering UTF-16 surrogate pairs or grapheme
clusters. This patch consistently uses grapheme clusters to compute
the new offset in such cases.

Bug: 20112392
Change-Id: I2b5e206d20886ca7ceb9f4375ee0d66f2328f99d
/frameworks/base/core/java/android/widget/Editor.java
d2b9bd80a20e5339bd2555d83d11a5cd88a20034 28-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Fix: End handle disappears when the selection is short." into mnc-dev
f6a78de10fd6bf507b1df82ac1cf8496942b359c 27-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> am 838a99e9: am bde00321: am 28b5b144: Fix: Selection handles are wrongly shown.

* commit '838a99e9adcdd065582956cac5150483535da4ae':
Fix: Selection handles are wrongly shown.
0fe6ab7960607bd459e58af24c991f482541610b 27-Apr-2015 Abodunrinwa Toki <toki@google.com> Merge "Update floatingtoolbar position when cursor moves."
28b5b1444965fcdb471a8c2ff09f6f2eb53b337b 22-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Selection handles are wrongly shown.

Selection handles were always shown when selection action
mode is started at first time. When the action mode is
started without a selection, only insertion handle must be
shown.

Bug: 20264980
Bug: 20407551

Change-Id: I630804e007f795d28f87e3fa6cba0de5bf588c78
/frameworks/base/core/java/android/widget/Editor.java
6cda1e28e3fc753d5e55a857bf827da87233a107 22-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: End handle disappears when the selection is short.

HandleView#isVisible didn't use getHorizontalOffset; thus,
the position is always computed as if Gravity.LEFT is set.
As a result, isVisible can be wrongly false for the end
handle and the handle is dismissed.

Bug: 20480054
Change-Id: Ib3242000bb98ae28e0cb37bf5b05069754abbfc6
/frameworks/base/core/java/android/widget/Editor.java
78214c90dbe88b0847fe293a1b64f7463ccc9f16 24-Apr-2015 Andrei Stingaceanu <stg@google.com> Minor clean up: redundant functionality in Editor and TextView.

This is a no-op.

Change-Id: I948ba8a5857fbbd58b656e6af0a8f590a00345d9
/frameworks/base/core/java/android/widget/Editor.java
6e5c51b744f0a8032c5d480a1a7d08c26824b158 25-Apr-2015 Abodunrinwa Toki <toki@google.com> Update floatingtoolbar position when cursor moves.

NOTE: This is only done on ACTION_UP event since the toolbar is
going to be hidden while one is dragging the handles.

Change-Id: Id09fc076edb0117ebceb26395ac91ee4d2283c2d
/frameworks/base/core/java/android/widget/Editor.java
0591651a62e605ee326720900f754226fe66085c 23-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Quit showing "SELECT ALL" for inappropriate fields.

This blocks showing "SELECT ALL" in FloatingToolBar when
the input is empty or the field is a password field.

Bug: 20407551
Change-Id: Ia25700bbee4f78445776af46eb1369af6600d946
/frameworks/base/core/java/android/widget/Editor.java
56195db6c444ca888a556dffffe3668aafea34c6 22-Apr-2015 Abodunrinwa Toki <toki@google.com> TextView: Invalidate ActionMode content rect on scroll.

Bug: 20470464
Change-Id: I1a9178903db00d1cef5a835d055939b2ce138290
/frameworks/base/core/java/android/widget/Editor.java
e72e94767c63924f93c9ddf6e5fb78576c18c99c 23-Apr-2015 Andrei Stingaceanu <stg@google.com> Merge "Introduce "Share" option to the floating text selection toolbar."
08f7fd4d79140ba743fc3d4827f1c581411a80f3 23-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Wrong condition to detect selection shrink.

In the old logic, vertical selection shrink is detected
when the offset decreases and line number of the end handle
position increases. This never happens.

Bug: 20482453
Change-Id: I9e51742fcab4abe939f72130c51be773818aec62
/frameworks/base/core/java/android/widget/Editor.java
c649dae8e0c78bc9f0194befe44279f3ea0012c9 22-Apr-2015 Andrei Stingaceanu <stg@google.com> Merge "Cleanup unused icons on the floating toolbar."
05fd8d50b2ec89c760e19794b9fd2a14421009ae 16-Mar-2015 Keisuke Kuroyanagi <ksk@google.com> Stop showing "Replace" when selection isn't inside spans.

Currently, "Replace" is shown when any spans intersects
the selection. It causes confusing behavior when multiple
words are selected. "Replace" is in the ActionBar, but it's
unclear which word will be replaced. It can happen when
text is selected using long tap + drag, unig keyboard, or
using a mouse.

Bug: 19396964
Change-Id: I512f5f566d4060cd0aa7b28594054bf4f6bf7458
/frameworks/base/core/java/android/widget/Editor.java
fbafc786482d61444da984aea26d6d8fe58ee031 21-Apr-2015 Andrei Stingaceanu <stg@google.com> Cleanup unused icons on the floating toolbar.

Floating toolbars move to a text based actionMode.

Bug: 20212703
Change-Id: Id94599487c2c70712f20d7044cd7ba1248813945
/frameworks/base/core/java/android/widget/Editor.java
7f0c5bd543df4a699118d43e3db883efa4d463c5 14-Apr-2015 Andrei Stingaceanu <stg@google.com> Introduce "Share" option to the floating text selection toolbar.

Change-Id: I04b564224847eeb4e5f2a61f6a41f6046a1969a1
/frameworks/base/core/java/android/widget/Editor.java
180942764740696527b1d3f549d4c4299bf209e5 16-Apr-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: keep text selection when starting a process text intent."
b1a3946712da0c4913179fb0a55d8a71b6afc6be 16-Apr-2015 Yoshiki Iguchi <yoshiki@google.com> Merge "TextView.extractText should not crash with null arguments"
ee14772531097848b724a3067add9e3f40306ecc 13-Apr-2015 Yoshiki Iguchi <yoshiki@google.com> TextView.extractText should not crash with null arguments

TextView.extractText crashes when null argument(s) is given. This patch
adds a null-check and prevents the crash.

Bug: 5762732

Change-Id: I945b6cde77f30cb5ee2944797732ec69890711bf
/frameworks/base/core/java/android/widget/Editor.java
b3a0660eabeb4d4bd7ae539ca48c0f9d22b31890 14-Apr-2015 Mady Mellor <madym@google.com> Merge "Use HandleView's previous offset for text selection handles"
578286fb321243e72a999b3e5fd4ef5f2e4b8682 10-Apr-2015 Clara Bayarri <clarabayarri@google.com> Editor: keep text selection when starting a process text intent.

This CL makes sure the selection is not cleared when a text processing
intent starts, so that we can properly replace the selection when it
comes back.

It also fixes a related issue with the selection handles. The previous
code assumed a text selection mode starts from touch and enters drag
mode by default. This CL makes the code conscious of whether it should
show the selection cursors or enter drag mode.

BUG: 20148456
Change-Id: Ie8632e4a96f431dc6b2e4d0b4d3978eb55149172
/frameworks/base/core/java/android/widget/Editor.java
28e7ba66440b3e135a2b5966ad54c498c2b684ca 12-Apr-2015 Clara Bayarri <clarabayarri@google.com> Merge "Show and trigger activities that implement Text Processing actions"
94bf0d9157418d398325e7e8c1662923b848842e 10-Apr-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Account for a split cursor in the content rect calculation"
d5bf3ed9b0138e9fd305da91386d1df03f9a75cc 27-Mar-2015 Clara Bayarri <clarabayarri@google.com> Show and trigger activities that implement Text Processing actions

This CL adds the Activities that support Intent.ACTION_PROCESS_TEXT
to the Text Selection Action Mode in Editor, and triggers an intent
with the currently selected text when they are selected.

It also adds the required mechanism to allow a View to request an
intent to be started, and return the activity result back to it.

Change-Id: I62ec618010edf01da41338c8c1a7dd4292a15227
/frameworks/base/core/java/android/widget/Editor.java
b7419dd76e6d0ff06a1d45fd8389093c9a212351 09-Apr-2015 Clara Bayarri <clarabayarri@google.com> Editor: Account for a split cursor in the content rect calculation

In some cases, the cursor in a TextView is split. This happens with
RTL languages. For this case we need to ensure neither of the half
cursors is obscured by the Floating Toolbar, hence we take the
minimal rectangle that contains both cursors as the content rect.

Change-Id: I2ce411793fcba2140c4ad7fb7caaf03593620484
/frameworks/base/core/java/android/widget/Editor.java
4c42bc045daccb293198559334df6fc6232fff6a 10-Apr-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Allow invalidation of the Text Selection Action Mode"
7bfcad34274e7d78a85cc7f54bb64d3e5ffa7da6 10-Apr-2015 Seigo Nonaka <nona@google.com> Merge "Fix unexpected selection cancellation"
bb6a62c2be16bf99b2e8b9a4aa15b8dc267ad3fc 31-Mar-2015 Seigo Nonaka <nona@google.com> Fix unexpected selection cancellation

It turned out that text selection is unexpectedly cancelled by
InsertionPointController if it is visible. The InsertPointController
is not necessary if there is a selection, so just hiding before
performing set selection fixes this issue.

Bug: 19946192
Change-Id: I2afce1789d772a8d2ea368643cc7533561ee2bf0
/frameworks/base/core/java/android/widget/Editor.java
b8ed5b75da7b48e3f5c40cd9bae1d29fd5a8db9b 09-Apr-2015 Clara Bayarri <clarabayarri@google.com> Editor: Turn on Floating Toolbar Action Mode for Text Selection

Change-Id: I267809e8cd5f10a3f9efd8f555ad24c7a935fdb8
/frameworks/base/core/java/android/widget/Editor.java
13152d1c725c6310a697ebc521cf8b57a52490ac 09-Apr-2015 Clara Bayarri <clarabayarri@google.com> Editor: Allow invalidation of the Text Selection Action Mode

This allow us to add/remove the "replace" item, which depends on
having a replacement span.

Change-Id: I47b6487fc91f80b9dab13e90b8d630194b3f9beb
/frameworks/base/core/java/android/widget/Editor.java
c2225b9d9e36d94b0a96282b91e370318475e830 02-Apr-2015 Mady Mellor <madym@google.com> Use HandleView's previous offset for text selection handles

HandleView tracks the previous offset of where the handle is at in the text
so it's unnecessary to track it in StartHandleView and EndHandleView again,
this updates them to use the already existing value.

Change-Id: I1a824c9fd9c54ed782e15fa419f23f49abea57a1
/frameworks/base/core/java/android/widget/Editor.java
7fc946eb5d232fad17213582b6fdab24e6b9a8fa 31-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Fix crash when selecting text on a non-editable TextView

We are querying the insertion controller, which is null on a
non-editable TextView.

Change-Id: Ie8428c6264385a1283310823c959ecdd63ef5a3f
/frameworks/base/core/java/android/widget/Editor.java
ea4f150c38853c8b03e7e459a1b39bce13eee4be 18-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Provide the selection content rect to ActionMode.Callback2

This is necessary for the positioning of the floating toolbar.

Change-Id: I790c1f011a7e90c5e315aad77e96569b26b553af
/frameworks/base/core/java/android/widget/Editor.java
80d4bd84ede57b1a3c1e8738fb6380c667c13865 31-Mar-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Reorder items in the text selection action mode."
26d443aee4ee5a8791417b4ca09e8c78ba8dc78b 30-Mar-2015 Raph Levien <raph@google.com> Revert "Fix build: Revert "Record hyphens from Minikin and draw them""

This reverts commit 5a6eeb3cbe0896ddf4bdccc0b1a81d7aac49821e and
fixes the underlying issue (needed to @hide getHyphen() for subclasses
of Layout, not just the base class), and layoutlib changes for
checkbuild.

Change-Id: I7a2b5f20ae014ea8e224d8c4079cf9131e17e1c1
/frameworks/base/core/java/android/widget/Editor.java
ed2e391454503397292058f42571768beebe07bd 24-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Reorder items in the text selection action mode.

Reorder elements to place "Select All" last, as otherwise when
we use a floating toolbar the first element is "Select All" and
takes up too much space, forcing Copy and Paste to the overflow.

Change-Id: I04cdd79915bd2a3abbd10969ce298b7b0f7f8cb0
/frameworks/base/core/java/android/widget/Editor.java
dff34599c24d73ec34dd453e6493d276d6a33933 30-Mar-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Cleanup the unused ActionPopupWindow"
2205425b94d62c64fc189c36b92b44067d371cc6 25-Mar-2015 James Cook <jamescook@google.com> Fix undo of text pasted into TextView with TextWatcher

Pasted text is directly inserted into the TextView buffer, so it looks
like a programmatic insert to the undo system. This is fine, but we
need to be sure that subsequent modification by a TextWatcher (for
example, to add spaces to a credit card number) is merged into the same
undo operation -- from the user's perspective, pasting in the text and
having spaces inserted are a single operation.

Also clean up mForceMerge flag in EditOperation -- we don't need to
store it across edits, just use it when a new edit comes in.

CTS test to follow.

Bug: 19332904
Change-Id: I7b3c97c08b83faebeab9f1708b0d6eac6d151d50
/frameworks/base/core/java/android/widget/Editor.java
a2e207a807b7d4488c3d5a21ff686c811b1638be 24-Mar-2015 Mady Mellor <madym@google.com> Merge "Text selection - Don't select vertical white space"
08fe91875382dbd952fcf540610e642c40085b4d 24-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Cleanup the unused ActionPopupWindow

This is unused since we removed the paste popup

Change-Id: Id609d43a9f9f9bc31b2f40286ca1fe88773ad1dd
/frameworks/base/core/java/android/widget/Editor.java
5b734f2430e9f26c769d6af8ea5645e390fcf5af 09-Jul-2013 Mikael Gullstrand <mikael.gullstrand@sonymobile.com> Context leaks in EditText causes out of memory

In android.widget.Editor, Blink runnables can be posted even if
the related TextView is not attached to a window. If a message has
been posted to the Blink message queue and the run method of
the Blink runnable has started executing, the removeCallbacks call
in onDetachFromWindow method is not enough to abort the execution
of the Blink runnable. This results in a memory leak when
the activity is destroyed.

The solution is to cancel the execution of the Blink runnable by
calling the suspendBlink method from onDetachFromWindow method.
Hence the Blink thread will halt, and the referenced context can
be released by GC when the activity is destroyed. Also adding
a corresponding resumeBlink method call in onAttachedToWindow
to start executing the Blink runnable.

Change-Id: Icb26c9c947b3cc1158f7629ae35d7b4e42b80f17
/frameworks/base/core/java/android/widget/Editor.java
b9bbbb1d97adb8ffdda2af14921401aabcec8cdd 23-Mar-2015 Mady Mellor <madym@google.com> Text selection - Don't select vertical white space

This alters text selection so that you won't select a
whitespace line above or below your selection unless you select
a non-whitespace character past the line.

Change-Id: Ic93f77f6ccecb06be2acc83524ca9e9a627660ce
/frameworks/base/core/java/android/widget/Editor.java
fca29e7d49c3254c837f0c94f3346b41adf08181 20-Mar-2015 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Start respecting View.DRAG_FLAG_GLOBAL flag."
6820434edde7354e9414e4ebe2923021db1a4361 19-Mar-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Avoid the paste popup from coming up when a word is selected."
870c4ba78a8a272cade87e98e0105eb850db0fec 19-Mar-2015 Andreas Gampe <agampe@google.com> am 1eca7d66: am 2a247b36: Merge "Frameworks/base: Fix visibility flag in Editor"

* commit '1eca7d66ee3da87c622259544794b8fe998cdb92':
Frameworks/base: Fix visibility flag in Editor
c3debf29d68fa711a98027d60cb33a66305d1d0a 19-Mar-2015 Vladislav Kaznacheev <kaznacheev@google.com> Start respecting View.DRAG_FLAG_GLOBAL flag.

Respect flags passed to startDrag (they used to be ignored).
Allow global drag&drop for text views.

Bug: 19548858
Change-Id: I981cfd617ebc6f5f2d59ebded798c22dc4920d38
/frameworks/base/core/java/android/widget/Editor.java
6351e660142a2319c142346628f131c494ded99c 17-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Avoid the paste popup from coming up when a word is selected.

The existing code already fires the selection action mode, which
contains all the elements from the popup.

This is the last case remaining in which the popup is used, so also
clean up all popup related code.

Change-Id: I68b8b7bc8076279371955265b0088bfa0c22760b
/frameworks/base/core/java/android/widget/Editor.java
10ff56ec6d402a69f53ee899e54e3c1de7bf3b1a 19-Mar-2015 Clara Bayarri <clarabayarri@google.com> Merge "Editor: Make the Insertion handle start/finish the selection action mode on tap."
452fa75207404f5cf4a0a6963d1dc9455e8f4b8e 16-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Make the Insertion handle start/finish the selection action mode on tap.

The Insertion handle used to show/hide the paste popup, not that we are
unifying it with the selection action mode it should start/finish the mode.

There are no other use cases of the popup with the insertion handle, so that
code is cleaned up.

Change-Id: I40703bc8316f217edaf97aff72436935de60500c
/frameworks/base/core/java/android/widget/Editor.java
f2560e62cf26cae64f5751b0479743e09cb7bd7f 18-Mar-2015 James Cook <jamescook@google.com> Merge "Improve undo support for text entered with IME"
43c410eaacf7d287c6c3f5621e6e0b96501004dc 18-Mar-2015 Chris Craik <ccraik@google.com> Merge "Remove HardwareCanvas"
d2026686702f6c893e871c078dc5176347b3b27e 03-Mar-2015 James Cook <jamescook@google.com> Improve undo support for text entered with IME

Use span properties to detect:
* Composing text - don't record undo operations
* Completing a composition - record an insert undo operation
* Canceling a composition - don't record

Save the composition state on parcel/unparcel.

Stop using begin/end batch edit to try to detect when a TextWatcher
is modifying the text. IMEs trigger multiple InputFilter passes in
a single batch edit. Use SpannableStringBuilder to determine when
we're in a TextWatcher callback because it is the authority on that
state.

Fix a bug in undo manager where it doesn't forget undos correctly if
there are more than one in the stack.

Bug: 19332904
Change-Id: Iaa9b0b2a7bf6683302cc85e7616e5d5fcc9fa202
/frameworks/base/core/java/android/widget/Editor.java
29d2b5aa484f4b1e06aa9ad07d9f32d1e45e2032 13-Mar-2015 Clara Bayarri <clarabayarri@google.com> Editor: Fire the selection Action Mode when long pressing on an empty space

This used to fire the "paste" popup instead. It is a tiny step towards
unifying the cut/copy/paste action mode and paste popup.

Change-Id: I03dfcc294d4453e92464fc4f714468f58c692f24
/frameworks/base/core/java/android/widget/Editor.java
4976e2de8df1d1477ad327f3150b8fb8b5dffcd1 18-Mar-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Fix visibility flag in Editor

Fix double check.

Bug: 19797138
Change-Id: I95e694f384f1f25d6cf3b6a1669052940385e41d
/frameworks/base/core/java/android/widget/Editor.java
4f831caa494b1215a004f461ca8363673fb31d2d 12-Mar-2015 Roozbeh Pournader <roozbeh@google.com> Merge "Fix negative touch word offset that caused crashing when selecting text"
27d6b97f635bba781f4979093b82b7f6198cdeb9 12-Mar-2015 Mady Mellor <madym@google.com> Fix negative touch word offset that caused crashing when selecting text

Previously the offset between the touch event and the start / end of
the word could result in a negative value - we don't care or want
this value to be negative. The negative value also causes the returned
offset to be outside the bounds of the text which resulted in a crash.

Bug: 19705184
Change-Id: I4287df7778c246dd10654f1a1f1e57538e940730
/frameworks/base/core/java/android/widget/Editor.java
f84a9724f1a915c782ac9d9c6465e13f8e9a42c9 02-Mar-2015 Clara Bayarri <clarabayarri@google.com> Move the "Replace" popup option to the Text Selection ActionMode.

As a first step in unifying the cut/copy/paste ActionMode in Editor
with the paste/replace popup, I'm moving the replace option to
the CAB ActionMode. Paste is already there, so for now all options
are together.

Missing things to address in upcoming CLs:
- Invoke the ActionMode in all cases where the popup shows up now,
ensuring only the options that are currently available show up.
- Get rid of the current popup
- Make the ActionMode a floating toolbar (pending feature completion)
- Define a keyboard shortcut for replace?

Note that since the ActionMode still shows up in the ActionBar and
replace has no icon it now appears as text and takes up lots of
space. This will improve when we can switch to using a floating
toolbar.

Change-Id: Ib6b60bae9b58e4db96b9c4cee556e19d3f1bb466
/frameworks/base/core/java/android/widget/Editor.java
f6829a0a618b4523619ec53c996b04d67e3186b9 10-Mar-2015 Chris Craik <ccraik@google.com> Remove HardwareCanvas

Change-Id: I239646a7f00f09d3f76fe6b6162eed86bc0d6e77
/frameworks/base/core/java/android/widget/Editor.java
900185d00359661e185c3b328f40a4d572ae03f9 10-Mar-2015 James Cook <jamescook@google.com> Handle undo in TextView fields with no cursor

This fixes a rare crash in the undo system. In particular, if the
TextView did not have a cursor and the first operation was a
programmatic insert/append the "old cursor position" would be -1.
Attempting to undo would try to restore the cursor to -1 and crash.

Test will land separately in CTS.

Bug: 19332904
Change-Id: I9aa18c1e3621b99d13ac707e483154382effb81c
/frameworks/base/core/java/android/widget/Editor.java
d1eca77c3c1294c8d48147ed9c500032d3dac57f 10-Mar-2015 Roozbeh Pournader <roozbeh@google.com> Merge "Fix: Drag handles are not shown for selection/insertion"
f7e503de70ab5424f42861b2fe305ca6fd5dd66c 06-Mar-2015 James Cook <jamescook@google.com> Merge "Support undo of some programmatic TextView changes"
138bc2f37b007cdaaa1dc8d7aa71148bf6d2e7ea 05-Mar-2015 Mady Mellor <madym@google.com> Merge "Text selection changes - smart handles & drag accelerator"
48e0fac6c268c9e19e608bcb43aaacbd3eba5328 26-Feb-2015 James Cook <jamescook@google.com> Support undo of some programmatic TextView changes

Applications can use TextWatcher.afterTextChanged() to implement
post-edit formatting of text, such as inserting spaces in a credit
card number. From the user's perspective, the insertion of the spaces
is not a separate action, so that change should be merged with the
previous undo operation.

* Force merge undo states for edits that are triggered by callbacks
after the InputFilter, such as TextWatchers.
* Reset the undo state when the whole field is reset with setText().
* Create separate undo operations for direct programmatic changes to
the Editable (e.g. directly calling insert).
* Remove part of the non-forced replacement edit merging code. An
improved version will land in the next CL.

Bug: 19332904
Change-Id: Iba5366a5aadbe3534554b668f8d417250deff505
/frameworks/base/core/java/android/widget/Editor.java
2ff2cd873cc2a3f6a17cdaeb3e64b83ae2c6fda9 02-Mar-2015 Mady Mellor <madym@google.com> Text selection changes - smart handles & drag accelerator

Drag accelerator:
After entering text selection mode, immediately dragging your finger
along the screen will select text. Once you have dragged past the initial
word the selection an offset is added so that the end of the selection is
not below your finger.

Smart handles:
When expanding the selection the handles snap to words, when shrinking the
selection the handles go by character, once you're in by-character mode
you can expand by character until you hit a word boundary where you will
then expand by word again. Your finger must past the first ~2 characters
in a word before the handle will jump to the word boundary.

Bug: 19356160
Bug: 19355947
Change-Id: I79b8ec5ae3159148cd2f15d2e63dd5045c2069e4
/frameworks/base/core/java/android/widget/Editor.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/core/java/android/widget/Editor.java
f1dad1ea82c5d9ca920af39b81ac6894ff692b99 27-Feb-2015 James Cook <jamescook@google.com> Add TextView XML attribute for undo support

* Defaults to true, but can easily be changed if we decide that undo
should be off by default.

Bug: 19332904
Change-Id: Ic4f3814a1b0a5e25171a910f2fe628606e16104e
/frameworks/base/core/java/android/widget/Editor.java
471559f129b8b0c87e70d013f13386fa8fc46ec7 27-Feb-2015 James Cook <jamescook@google.com> Reland: Improvements to TextView Ctrl-Z undo support

This relands commit 7713d18847c7fe81fb5f34e888aaf8167862f5fd which was
reverted in commit 3ac0bcb095e0067721a5e35d3b4c51e4090842a3.

Original description:
* Undo/redo restores cursor position
* Multiple deletes are consolidated into a single operation
* Don't create undo history for invalid or no-op operations
* Move logic for merging operations into Editor.EditOperation

CTS tests in android.widget.cts.TextViewTest will land separately.

Bug: 19332904
Bug: 19450037
Bug: 19505388
Change-Id: Ice27e3c4e5e421b47be8c4e9964c10844e61b0fc
/frameworks/base/core/java/android/widget/Editor.java
f59152cf00520d1bd36949b44faca2e1fcf6d28f 27-Feb-2015 James Cook <jamescook@google.com> Reland: Add basic support for Ctrl-Z to editable TextViews

Reland 9201e797833f35b9afb219f88c10d3b6fda02a4e which was reverted in
c8f08e07a47cc259a25caed3f731ee7044328635.

Original description:
* Add an UndoManager to the Editor for each editable TextView
* Record operations as being owned by that Editor
* Parcel the undo state
* Wire hardware keyboard shortcuts Ctrl-Z for undo and Ctrl-Shift-Z
for redo into TextView shortcut handling.
* Expose IDs for "undo" and "redo" for symmetry with cut/copy/paste.

Additional fix:
* Ensure each UndoOwner always has a valid mManager, even after the
UndoManager is parceled and restored.

Bug: 19332904
Bug: 19505388
Change-Id: Iad4476e6e9ca952281e69bf22c07cca915dfa7bd
/frameworks/base/core/java/android/widget/Editor.java
7340be7993fea97232fdf7b98dfa1a5bc9b8fd95 27-Feb-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Drag handles are not shown for selection/insertion

Bug: 19538371

Change-Id: I9017ae37bfd456272787aa4705d5a1608690f0cb
/frameworks/base/core/java/android/widget/Editor.java
c8f08e07a47cc259a25caed3f731ee7044328635 26-Feb-2015 James Cook <jamescook@google.com> Revert "Add basic support for Ctrl-Z to editable TextViews"

This reverts commit 9201e797833f35b9afb219f88c10d3b6fda02a4e.

It causes crashes on typing after device orientation change.

Bug: 19332904
Bug: 19505388
Change-Id: I0d9fb728eb6f8d591beb35fab333c0a182e24542
/frameworks/base/core/java/android/widget/Editor.java
3ac0bcb095e0067721a5e35d3b4c51e4090842a3 26-Feb-2015 James Cook <jamescook@google.com> Revert "Improvements to TextView Ctrl-Z undo support"

This reverts commit 7713d18847c7fe81fb5f34e888aaf8167862f5fd.

It causes crashes on text input after device orientation change.

Bug: 19332904
Bug: 19450037
BUG: 19505388
/frameworks/base/core/java/android/widget/Editor.java
7713d18847c7fe81fb5f34e888aaf8167862f5fd 18-Feb-2015 James Cook <jamescook@google.com> Improvements to TextView Ctrl-Z undo support

* Undo/redo restores cursor position
* Multiple deletes are consolidated into a single operation
* Don't create undo history for invalid or no-op operations
* Move logic for merging operations into Editor.EditOperation

CTS tests in android.widget.cts.TextViewTest will land separately.

Bug: 19332904
Bug: 19450037
Change-Id: I9c7887aecdd0209e783fb7cda4cb7081a97a98cd
/frameworks/base/core/java/android/widget/Editor.java
9201e797833f35b9afb219f88c10d3b6fda02a4e 11-Feb-2015 James Cook <jamescook@google.com> Add basic support for Ctrl-Z to editable TextViews

* Add an UndoManager to the Editor for each editable TextView
* Record operations as being owned by that Editor
* Parcel the undo state
* Wire hardware keyboard shortcuts Ctrl-Z for undo and Ctrl-Shift-Z
for redo into TextView shortcut handling.
* Expose IDs for "undo" and "redo" for symmetry with cut/copy/paste.

Tests in CTS TextViewTest will land separately in ag/635321

Bug: 19332904
Change-Id: Ibd23843f86b4cd556751faa0b3ad1f35d6d49785
/frameworks/base/core/java/android/widget/Editor.java
bb2397c523dc3e1e54fcd2ebf7ae20907e3f37ad 13-Feb-2015 Raph Levien <raph@google.com> Fix EditText RenderNode invalidation bugs

EditText uses a TextDisplayList data structure to hold RenderNode
objects for optimized incremental drawing. This data structure uses an
isDirty flag to indicate when it has been invalidated and needs to be
re-rendered. This flag was not being computed correctly, leading to
excessive re-rendering.

This patch clears isDirty after rendering text into the RenderNode, so
that it can be reused until it is invalidated, and also explicitly sets
it when it is recycled.

Bug: 19371378
Change-Id: I70239cc30e43bb8631dfffc2ea2705e8d4c452f4
/frameworks/base/core/java/android/widget/Editor.java
107843de4507b3511006cb9c77b8d0364374385a 08-Sep-2014 Tom Hudson <tomhudson@google.com> Remove status return from all uirenderer::Renderer functions

This moves the interface closer to android::Canvas. The only use of
return values was in the OpenGLRenderer subclass; that is replaced
with an internal dirty flag: returned from finish(), checked by
CanvasContext.

This is part of a series of CLs to refactor the Graphics JNI bindings.

BUG:15672762
R=djsollen@google.com,ccraik@google.com

Change-Id: Ifd533eb8839a254b0d3a5d04fc5a2905afdfc89e
/frameworks/base/core/java/android/widget/Editor.java
955d8d69ea6caabce1461dc25b339b9bf9dc61a6 08-Oct-2014 Dianne Hackborn <hackbod@google.com> Put in real "code" (aka marketing) name.

Change-Id: Idb3976edfae37293ed75cb5b869b4b42d8042bbe
/frameworks/base/core/java/android/widget/Editor.java
5a689ce78ed85cb5df1f2c7c680dcc6525dfe9eb 10-Sep-2014 Raph Levien <raph@google.com> Remove auto spaceifying behavior on paste

The paste action contained some logic to automatically insert or remove
spaces, basically to emulate the semantics of the text being a sequence
of space-separated words. This was never universally loved, and gives
particularly unexpected behavior with a hardware keyboard.

This patch simply removes the logic to automatically adjust spaces on
paste, so what gets pasted is simply the literal buffer contents.

Bug: 16900326
Bug: 3304489
Change-Id: I5cdf9c43d98a17aa708883b47245aa7929a124d2
/frameworks/base/core/java/android/widget/Editor.java
5f183f0671dfa1d87ca6d741deb457170c432493 02-Sep-2014 Yohei Yukawa <yukawa@google.com> L API proposal: Introduce IS_RTL flag

This CL introduces CursorAnchorInfo.FLAG_IS_RTL for better
RTL support. This CL also renames *CharacterRect() with
*CharacterBounds() so that they can look more consistent
with other existing APIs.

Rationale:

CursorAnchorInfo.FLAG_IS_RTL addresses following issues.
1. There is no way to associate the RTL information with
the insertion marker.
2. Returning mirrored (right < left) RectF for RTL in
CursorAnchorInfo#getCharacterRect() is turned out
to be bug-prone. Such usage of RectF is not fully
supported. For example, RectF#isEmpty() always returns
false when right < left.
3. There is no reliable to provide the RTL information
when CursorAnchorInfo#getCharacterRect() returns an
empty (right == left) RectF. Perhaps we could use +0.0
and -0.0, but I'm afraid that it is also bug-prone.

BUG: 17365414
BUG: 17335734
Change-Id: Ic8c6fab58c01206872a34e7ee604cdda1581364d
/frameworks/base/core/java/android/widget/Editor.java
cc24e2b6a2a429d70b75c6810a5cfd8816ce03ad 30-Aug-2014 Yohei Yukawa <yukawa@google.com> API Review: CursorAnchorInfo

This CL introduces following combinable flags as a replacement
of CHARACTER_RECT_TYPE_* constants.
- CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION
- CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION

This CL also replaces #isInsertionMarkerClipped() with
flags.

Rationale:
getCharacterRectFlags() should return a set of flags, rather
than enum-like types.

getInsertionMarkerFlags() is more consistent with
getCharacterRectFlags() than isInsertionMarkerClipped().
It is also open for future extension.

BUG: 17200900
Change-Id: Ia8cbb9f6b41cd9509fc0147fd68763dfde593ffc
/frameworks/base/core/java/android/widget/Editor.java
119907cd2575c56b1ebf66348b52e67aaf6a88d8 14-Aug-2014 John Reck <jreck@google.com> Animator stuff

Bug: 17228458

Change-Id: Id884a429a512f9cd2be0ed16dbd0f10e92b4440d
/frameworks/base/core/java/android/widget/Editor.java
a277db28e990d1f6f74ace0c32fe92401660a840 22-Aug-2014 Yohei Yukawa <yukawa@google.com> Remove CursorAnchorInfoRequest and related stuff

This CL removes CursorAnchorInfoRequest and related stuff
in favor of InputConnection.requestUpdateCursorAnchorInfo,
which is more easy to understand. This CL also deprecates
InputMethodManager#updateCursor and related stuff.

Rationale:
1. The spec of #updateCursor says that it provides the cursor
position in local coordinates, while the input method
requires it in the screen coordinates.
2. #updateCursor has never been enabled in AOSP, because
InputMethodManager#isWatchingCursor always returned false.
3. There has been no way to let
InputMethodManager#isWatchingCursor return true.
4. In L, InputMethodManager#updateCursorAnchorInfo is
introduced to address all the issues above.

Given that we no longer need to support #updateCursor,
CursorAnchorInfoRequest is overkill when we need to convey
just a couple of parameters.

BUG: 17185263
BUG: 17182367

Change-Id: I4a577bfd02b37b9e56c80b8b41bb25afa95dd8ef
/frameworks/base/core/java/android/widget/Editor.java
3fceabd64c95bfd2c563972e243117af308438d3 20-Aug-2014 Adam Powell <adamp@google.com> Update text selection handles to have a minimum touch target size.

The text selection handles were traditionally sized based on the size
of the provided drawables. When these drawables are visually small, do
not restrict the size of the touch target beyond a certain minimum.

Bug 16851360

Change-Id: If6a468c7b3a9a1a21913006633f00699637751c0
/frameworks/base/core/java/android/widget/Editor.java
987eb3f109c646476d1310a54f7037a558ccfef3 08-Aug-2014 Yohei Yukawa <yukawa@google.com> Fix handling of line-end and RTL characters in CursorAnchorInfo

This CL addresses line-end handling and RTL characters handling
in CursorAnchorInfo.

BUG: 16499624
Change-Id: Ie23569fb136751c40f79dd9886e279dc01cefae9
/frameworks/base/core/java/android/widget/Editor.java
098e7fb5875c31aede4e6d40a3acec876d948527 06-Aug-2014 Adam Powell <adamp@google.com> Have TextView editors use the Menu context for action mode icons

Using the TextView's context instead when resolving these icons from
the theme causes issues if a dark action bar theme is in use.

Bug 16686041

Change-Id: I44cb4a83516d8610103b6ebaf604860b67ac84dd
/frameworks/base/core/java/android/widget/Editor.java
0023d0e0c4f5339b299d1eacbd4e7181c2fd271f 10-Jul-2014 Yohei Yukawa <yukawa@google.com> Polish new IME API for L part 2: CursorAnchorInfo

This CL addresses feedbacks from internal customers for new
input method APIs that are mainly used for physical keyboard
support in L.

For performance reasons, #onUpdateCursorAnchorInfo is not called
back by default and each input method has to enable this
event notification explicitly whenever fine-grained character
locations are needed.

In L-preview, InputMethodSession#setCursorAnchorMonitorMode was
introduced for this purpose. However, we got several feedbacks
to be addressed.
- The effect of #setCursorAnchorMonitorMode is not preserved
during focus change. IMEs need to call
#setCursorAnchorMonitorMode every time when #onStartInput is
called. This is tricky and hard to understand.
- As #onUpdateCursorAnchorInfo is a new API, not all
applications/text editors have supported it. Therefore IMEs
can't always rely on it. However, there is no way to query
if the attached target is supporting this new API or not.
It would helpful for IME authors if we can provide a
reliable way to query if the attached input target is
supporting the new API or not.

In order to address these issues, the triggering method has
moved from InputMethodSession to InputConnection in this CL,
as an analogy of existing InputConnection#getExtractedText API,
which has provided similar functionality including optional
reactive event callbacks from the application to the IME.

BUG: 15812658
BUG: 16118603
Change-Id: I3c6b69bd9d79b199afe68d838f25effa6048e5cc
/frameworks/base/core/java/android/widget/Editor.java
0b01e7fc58cdde00d8350285a3386c4209b72d78 08-Jul-2014 Yohei Yukawa <yukawa@google.com> Polish new IME API for L: CursorAnchorInfo

This CL allows application authors and input method authors to
communicate with each other more precisely on the visibility of
insertion marker and composing characters. Now we can describe
the situation where the coordinates of them are available but
they are overlapped by other UI elements.

This change is based on feedbacks from internal customers of
this preview API.

Change-Id: I82eba0e844a6f8b99ba11a68fad272399034cc24
BUG: 16118303
/frameworks/base/core/java/android/widget/Editor.java
a7090e0cfd7c719a6d4c03aae34f5db98754cbdd 21-Jun-2014 Chris Craik <ccraik@google.com> Update 'DisplayList' vs 'RenderNode' naming in several places

Change-Id: I635c6627d098b661fb9b0ba1bd42fa6d7277d287
/frameworks/base/core/java/android/widget/Editor.java
c46b5f04aa2a9fd292c117d2824f70fcf06e86ba 09-Jun-2014 Yohei Yukawa <yukawa@google.com> Rename CursorAnchorInfoBuilder with Builder

Inner Builder class should not inherit full class name of outer
class.

BUG: 15516230
Change-Id: I2d56edebb0c85639db57ca5b2aadb22c67fc5926
/frameworks/base/core/java/android/widget/Editor.java
81f4cb3f858f46a4d9b793c4d326b9bf6aca868d 13-May-2014 Yohei Yukawa <yukawa@google.com> Enable CursorAnchorInfo to contain composing string

This CL adds one more functionality to CursorAnchorInfo
that enables applications to associate the composition
string with its positional information. This is useful
for an IME to handle CursorAnchorInfo asynchronously.

This is also useful for the framework to detect if
the application is unnecessarily calling
IMM#updateCursorAnchroInfo with duplicate event.

BUG: 14579622
Change-Id: Ie75c17b523dad33e97b08c15f5f5267573ce2063
/frameworks/base/core/java/android/widget/Editor.java
83b68ba4ad7e80dd0afe34f9f53dde5884325f58 12-May-2014 Yohei Yukawa <yukawa@google.com> Support IMM#updateCursorAnchorInfo in Editor

With this CL, Editor starts calling IMM#updateCursorAnchorInfo
iff IMM#isWatchingCursor(View) returns true. The performance
regression should be negligible when IMM#isWatchingCursor(View)
returns false.

BUG: 14579622
Change-Id: Ib35a6f4201b26d837a6aa07d1204c9eb75404da1
/frameworks/base/core/java/android/widget/Editor.java
8de65a8e05285df52a1e6f0c1d5616dd233298a7 10-Apr-2014 John Reck <jreck@google.com> Switch DisplayListData to a staging model

Bug: 13912977

Change-Id: I5b2f664e797be22a58300964f57ceb4fab60528c
/frameworks/base/core/java/android/widget/Editor.java
776abc24cdd18610232a50b997cce3cffa74609b 07-Mar-2014 Adam Lesinski <adamlesinski@google.com> Uses VMRuntime.newUnpaddedArray for ideal array sizes

Bug:13028925

Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
/frameworks/base/core/java/android/widget/Editor.java
f666ad7046c0b1b255835f75aeb7d1391067df93 15-Mar-2014 John Reck <jreck@google.com> Rename DisplayList->RenderNode

Change-Id: Idcca6f26ba6282594789962f5edb3ed53a290fef
/frameworks/base/core/java/android/widget/Editor.java
be34f2f3b340196426bdf558b28951359a4d84fa 10-Mar-2014 John Reck <jreck@google.com> DisplayList lifecycle changes

Bug: 13360343
Change DisplayList to be more forgiving with weaker lifecycle
requirements. Is more self-managed with a strong reference
to the renderer it needs

Also fix naming mismatch

Change-Id: I5c89453a72a52954f6f959f0846199705dbb6476
/frameworks/base/core/java/android/widget/Editor.java
7558aa708160c287552f4e1e33c33d8b191e9f0e 05-Mar-2014 John Reck <jreck@google.com> Remove invalid usage of DisplayList.isValid()

Bug: 13324734

Editor was using isValid as a mechanism to track whether or not it
needed to re-record the DisplayList. This is not correct as isValid()
is not a general-purpose dirty bit. Add an explicit dirty bit for
Editor to use instead

Change-Id: I5608b151791870fca3681056b5507bd39ee48f52
/frameworks/base/core/java/android/widget/Editor.java
44fd8d24f761f82d21e9b00932648a1b6bf91449 26-Feb-2014 John Reck <jreck@google.com> DisplayList overhaul

Change-Id: I53418d580c98f706e971545cff81b9921c12cc5f
/frameworks/base/core/java/android/widget/Editor.java
8eea3ea5591e59f55cbb4f6b2b7e9363a285ced3 04-Feb-2014 Alan Viverette <alanv@google.com> Add APIs for obtaining themed Drawable from Theme, Context

BUG: 12611005
Change-Id: Ic0057be4e4c2d0c61ce02a019b3f7d0625e3a016
/frameworks/base/core/java/android/widget/Editor.java
dcd8258e2447afacb6d6f793c2cfb7ad94d2acec 06-Jan-2014 Raph Levien <raph@google.com> am 971003c9: am ece5bc9d: am 7b6b85d2: am d7d07498: am a980c7aa: Merge "Re-initialize error after attach"

* commit '971003c9ffc854f4b080af902457e7a6447f692a':
Re-initialize error after attach
f4ecc55657c535b8b2d7113095903b3808e903e9 13-Aug-2013 Daniel 2 Olofsson <daniel2.olofsson@sonymobile.com> Re-initialize error after attach

If flag for error after attach is not reinitialized, it may cause
NullPointerException on subsequent onAttachedWindow if error text
was reset to null.

Change-Id: I8976c28a6ca71017e5c4b3f29d4eeeb2eda48c38
/frameworks/base/core/java/android/widget/Editor.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/widget/Editor.java
339f901ba65d6b8478b6d7680cfb2f5421e42d9b 06-Nov-2013 John Reck <jreck@google.com> Cleanups

Simplify DisplayList creation
Remove unnecessary debug code

Change-Id: I310c9196485c6bf65a6793669bd2dc2b9a8a0a15
/frameworks/base/core/java/android/widget/Editor.java
f3bd8d4843dc811a29854bdb11ce6ea2b2834e9c 14-Oct-2013 Victoria Lease <violets@google.com> am 4c4a469c: am 677687c2: am edbab7b5: Merge "no layout = no visibility" into klp-dev

* commit '4c4a469cbfe61f50c23b70d8b2e63f7b661745c7':
no layout = no visibility
b9b77aecf22307300bbf923fbde39422c8c12e80 14-Oct-2013 Victoria Lease <violets@google.com> no layout = no visibility

This fixes an Editor crash when the associated TextView's Layout
is null.

Bug: 11165608
Change-Id: I061c0db6eef95bf39a7696ad6e6f919bd22bfb11
/frameworks/base/core/java/android/widget/Editor.java
65e1772d6b815b5f610a5faa641efd3358c20d8f 25-Sep-2013 Jean Chalard <jchalard@google.com> am 424054ba: am 6a1e32ef: Merge "Don\'t change the text in reaction to a user dict add" into klp-dev

* commit '424054ba621738452b0bae69dcd6a8372ca5c273':
Don't change the text in reaction to a user dict add
0995398e734bd66ee04b60939ec7c74548148952 12-Sep-2013 Jean Chalard <jchalard@google.com> Don't change the text in reaction to a user dict add

This is a confusing interface. The user should be able
to edit the word in the dialog, and the text should be
unchanged.

Bug: 9902905
Change-Id: I24e93df37583f6051046fd6a84a4cbb10d99c046
/frameworks/base/core/java/android/widget/Editor.java
617feb99a06e7ffb3894e86a286bf30e085f321a 10-Sep-2013 Alan Viverette <alanv@google.com> Add View constructor that supplies a default style resource

Also updates the constructor of every class that extends View.

BUG: 10676369
Change-Id: Ifaf27bf82028d180afa4931c0e906df88d858ac3
/frameworks/base/core/java/android/widget/Editor.java
d7429c15e6f4dd9a43b81d94a1bbf65b17d46a16 05-Jun-2013 Satoshi Kataoka <satok@google.com> Fix an issue where "SuggestionSpan"s are not removed properly

Basically, the root cause of this issue is a lack of an expected implementation.
This change completes the spec of the architecture to remove modified "SuggestionSpan"s.

Bug: 9190860
Change-Id: I63f2ccf3407ae7c1bc28813e044b8703e2112f34
/frameworks/base/core/java/android/widget/Editor.java
3aa49b6fece334ace7525d42c1f6d0b7cdc1fbfb 27-Apr-2013 Dianne Hackborn <hackbod@google.com> New UndoManager.

Basic implementation of an undo manager. Supports
multi-level undo/redo, building on the top undo state
as edits occur, managing multiple distinct entities in
the undo state (such as embedded objects in a document),
and saving/restoring the full undo state. Still some
work remaining on correctly dealing with dependencies
between undo states that hold multiple owners.

Also do a simple implementation of undo state in TextView
to see how things actually work. The implementation here
is very primitive: it needs a lot more work to correctly
identify when to merge undo ops, is not trying to do
anything smart with style spans, etc.

Change-Id: Ie30f4e133351e2f569ffb48c6c44a2b19cadee27
/frameworks/base/core/java/android/widget/Editor.java
684634144b15e4da0ed04baa2c4531ef538652a6 21-Apr-2013 Chet Haase <chet@google.com> am 371d4ccc: am 339ac854: Merge "Fix quickReject logic to account for setClipChildren() setting" into jb-mr2-dev

* commit '371d4cccde56ec4d26e51f8e82ef68f196169a3d':
Fix quickReject logic to account for setClipChildren() setting
dd671599bed9d3ca28e2c744e8c224e1e15bc914 19-Apr-2013 Chet Haase <chet@google.com> Fix quickReject logic to account for setClipChildren() setting

The rendering code optimizes by rejecting drawing operations that
lie outside of the bounds of their views. This works in most
situations, but breaks down when containers have called
setClipChildren(false), because we reject drawing that is outside
of that container, but which should be drawn anyway.

Fix is to pass in the value of that flag to the DisplayList drawing
routines which take that flag into account when deciding whether
to quickReject any particular operation.

Issue #8659277 animation clipping

Change-Id: Ief568e4db01b533a97b3c5ea5ad777c03c0eea71
/frameworks/base/core/java/android/widget/Editor.java
0d84e725667315fc9ccb70b93b26ba40b7653285 19-Mar-2013 Fabrice Di Meglio <fdimeglio@google.com> am 430058f2: am 2d18e52b: Merge "Fix bug #8335710 TextView can\'t clear CompoundDrawables" into jb-mr2-dev

* commit '430058f2699041e86d7c0e50cad1fa6989d08cab':
Fix bug #8335710 TextView can't clear CompoundDrawables
f7a5cdfac62cf2335f192581ca299d241d83e195 15-Mar-2013 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #8335710 TextView can't clear CompoundDrawables

- fix start/override mechanism
- take care of RTL compatibility mode (pre JB-MR1)
- fix where reset of drawables resolution needs to happen

Change-Id: I55a69487a0eedee14c4be7006ee0abad085200ad
/frameworks/base/core/java/android/widget/Editor.java
c99d33fb4dcf332b66281a0a6a31710407fc829d 01-Mar-2013 Jean Chalard <jchalard@google.com> Actually change the place where updateSelection is called

Call updateSelection in endBatchEdit instead of onDraw.
This works because all edits go through a batch edit,
which is already the case although the next change will
enforce it going forward.
This is step 3 of a four-step refactoring.

Bug: 8000119
Change-Id: Ia5e257382e2ef2168726bf3d9c7c84f9379ba376
/frameworks/base/core/java/android/widget/Editor.java
baf3094ecaa073e1cb3e807fa17d096f826c3968 01-Mar-2013 Jean Chalard <jchalard@google.com> Add a SpanWatcher to catch programmatic selection changes

When the selection is set via Selection#setSelection, the
Editor needs to know so that it can call back to a bound
IME, if any. This adds a watcher to catch these events.
This is step 2 of a four-step refactoring.

Bug: 8000119
Change-Id: Ia01aee853d5cafb4820fd234bc24b587ad3f7dd0
/frameworks/base/core/java/android/widget/Editor.java
df7c72f68c2fe32546aa119e98be9acf8fffd66d 01-Mar-2013 Jean Chalard <jchalard@google.com> Initial refactoring to move updateSelection to a better place

This is step 1 of a four-step change which will move where
updateSelection is called in regular text fields. The new
behavior will be to call it for each actual batch of
changes, instead of doing it in the render loop which leads
to both false positives and true negatives.

Bug: 8000119

Change-Id: I17bd91a129b18d5451fe1d8e7794ae20165de309
/frameworks/base/core/java/android/widget/Editor.java
1b15ba5d194c1db71d0a34ee110bd1ab169c8a29 20-Feb-2013 Luca Zanolin <zano@google.com> Resubmitting "Enable correction/deleting notification via EasyEditSpan.""

Re-run "make update-api"

Original CL Ic227b8fd50066699915f69a54f225fb5330867c4

Change-Id: Ifb1a0f61801c544b01193435fbfdedd7f3888971
/frameworks/base/core/java/android/widget/Editor.java
1b916301e044d1f6f672c9708c993090ecdf30cf 20-Feb-2013 Luca Zanolin <zano@google.com> Revert "Enable correction/deleting notification via EasyEditSpan."

This reverts commit 8cd8135b95da5b471804604b06084eecbe1cc23b

Change-Id: I6361cc47d58281ab37cb9ae0a67541b43f873147
/frameworks/base/core/java/android/widget/Editor.java
8cd8135b95da5b471804604b06084eecbe1cc23b 14-Feb-2013 Luca Zanolin <zano@google.com> Enable correction/deleting notification via EasyEditSpan.

When the "delete" pop-up is clicked (and the wrapped text removed), the
creator of the span will receive a notification of the action.

Similarly, if the user modifies (i.e., add/remove a char), the creator of
the span will receive a notification too. The notification will not contain any
information about how the text has been modified.


Bug: 6905960
Change-Id: Ic227b8fd50066699915f69a54f225fb5330867c4
/frameworks/base/core/java/android/widget/Editor.java
52036b19a5f82bc4d75cfcbff99c65df8d25a99b 15-Feb-2013 Romain Guy <romainguy@google.com> Expose display list APIs

The exposed APIs are slightly simpler than the full APIs used internally.
Only APIs useful to applications are exposed.

Change-Id: Ie03014628d40ad5ef63dedbc52ce3def84429d54
/frameworks/base/core/java/android/widget/Editor.java
9122187fca67c7509ba2a040b602f67928fc9a98 28-Jan-2013 Adam Powell <adamp@android.com> am bb74d8b9: am 783fe429: am e305e5f6: Merge "show SELECT ALL icon with text in landscape mode"

# By Sungmin Choi
# Via Android Git Automerger (2) and others
* commit 'bb74d8b9f632bdda2f5639a9516a83f58374b936':
show SELECT ALL icon with text in landscape mode
783fe4295372cee8d024388221414c253802c995 28-Jan-2013 Adam Powell <adamp@android.com> am e305e5f6: Merge "show SELECT ALL icon with text in landscape mode"

# By Sungmin Choi
# Via Gerrit Code Review (1) and Sungmin Choi (1)
* commit 'e305e5f68df8338cb3c4bdcf099d23ec9abce564':
show SELECT ALL icon with text in landscape mode
f036920669f933c05ac43a8e0ea6cb1a4e35275a 25-Jan-2013 Sungmin Choi <sungmin.choi@lge.com> show SELECT ALL icon with text in landscape mode

Though set config_allowActionMenuItemTextWithIcon as true,
icon for the "SELECT ALL" menu on ActionBar is not shown as staring
in landscape mode.
To fix it, use "SELECT ALL" icon in onCreateActionMode() to show the
icon and text together.

To show or hide text is decided by updateTextButtonVisibility() of
core/java/com/android/internal/view/menu/ActionMenuItemView.java

STEPS TO REPRODUCE: (please be specific)
1. launch Browser/Chrome and go to google.com
2. rotate to landscape mode
3. long press on URL address

Bug: 8073761
Change-Id: Ie0e0aa45f0dff609ed8c03e4423b163bad5452ed
/frameworks/base/core/java/android/widget/Editor.java
955beb2b96a78cf6ee990d0f20bcaf2d22ce608b 10-Dec-2012 Sangkyu Lee <sk82.lee@lge.com> Optimize drawHardwareAccelerated method in Editor class

When inserting a new line or breaking a line,
every display list was invalidated and rebuilt before.
However, we can reuse the display lists above intactly and also
reuse the display lists below with only updating drawing locations.

This patch reuses the display lists if possible.
The display lists above the inserted line are just reused
and the display lists below are reused with only updating
drawing locations not fullly rebuilt.

mIndexOfFirstChangedBlock is the index of the first block
which is moved by inserting or breaking a line.
So the display list whose index is >= mIndexOfFirstChangedBlock
only needs to update its drawing location.

Change-Id: Ica20deb0ebb5750de21356ed31fa9f86e657ff92
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
/frameworks/base/core/java/android/widget/Editor.java
afe8e9b6d033cb854afa3024d8198a32896a804a 20-Dec-2012 Raph Levien <raph@google.com> Suppress horizontal scrolling with trailing blanks

The existing behavior of EditText is that trailing blanks can cause a
line to exceed the layout width, causing the cursor to extend past the
line, which in turn causes horizontal scrolling. This patch clamps the
cursor to the layout width in the non-scrolling case, which makes the
spaces effectively invisible when they're at the end of the line, but at
least suppresses the scrolling.

The clamping only works reliably in left-to-right alignments, so this
patch checks for than and only enables the clamping in those cases.

Fix for bug 7699295.

Change-Id: I22bc4e6c9ded3d7716edfcf10dd2b5c31a5da9de
/frameworks/base/core/java/android/widget/Editor.java
ab989ac313a996280aec61183636e3fb9ac21d9d 17-Dec-2012 Sascha Prueter <saschap@google.com> am 8149820c: am 25458528: am dd2ed93e: Merge "Handle "CODE_ALREADY_PRESENT" message from Settings app" into jb-mr1.1-dev

* commit '8149820c2b2df47028498571785ca009d99b5dc9':
Handle "CODE_ALREADY_PRESENT" message from Settings app
6bad2f2fefc44830e6e7019886a6fde42bec7223 17-Dec-2012 satok <satok@google.com> Handle "CODE_ALREADY_PRESENT" message from Settings app

Bug: 7725834
Change-Id: I85c35e73978d606edf9687e2de76c6ffc3c3ee2b
/frameworks/base/core/java/android/widget/Editor.java
40efbd40606fc31863d3de90f062db431ba7fb47 14-Dec-2012 Mike Cleron <mcleron@google.com> am 323bb07f: am a5a4eb0f: am 6b922cc6: Merge "Receive a user dictionary callback from Settings application" into jb-mr1.1-dev

* commit '323bb07f762e5373f90e758a1146b93a3c31fe17':
Receive a user dictionary callback from Settings application
0e3849af4775debf376317d70450e70976825f6d 13-Dec-2012 Satoshi Kataoka <satok@google.com> Receive a user dictionary callback from Settings application

Bug: 7725834

The callback is sent when the user adds a word to the user dictionary.

Change-Id: Ieee9bfd50a9adbed1a769e3cd95d9cb2815c34b4
/frameworks/base/core/java/android/widget/Editor.java
742524b2169b5b5726e7b27fcd1673dabca62099 20-Nov-2012 Fabrice Di Meglio <fdimeglio@google.com> am 3ee47400: am 95263ef3: am 4d931acd: Merge "Fix for bug #7417949 TextView / EditText error Drawable is not put on the left in RTL mode" into jb-mr1.1-dev

* commit '3ee4740009b0e217ee0f6de0f86f2f557b175dea':
Fix for bug #7417949 TextView / EditText error Drawable is not put on the left in RTL mode
bb0cbae441f04c052dd1a73448ae58fbffaca65d 14-Nov-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix for bug #7417949 TextView / EditText error Drawable is not put on the left in RTL mode

- keep the Error Drawable infos into the Drawables cache
- reset left/right Drawable state before resolving where to put the Error Drawable
- get the mirrored Drawable for the Error popup background
- set the Error popup position depending on the layout direction (so that the "triangle"
of the background is pointing to the middle of the Error icon)

One restriction: we load the Error popup background Drawable corresponding to the layout
direction of the System Locale. So if you set the Layout direction on a TextView (or
an EditText) to RTL and set an error to it when you are in a RTL System Locale, then you
see that the background "triangle" is not pointing to the Error icon. This is working as
intended as the AssetManager load the Drawable resource depending on the configuration
which is in that case the RTL one thus loading the RTL version of the background (and not
the LTR one).

Thus there can be a discrepancy between the "layout direction" of the TextView
and the one from the Error popup background. This would happen only thru using the SDK and
not in a normal case when running an App.

Change-Id: I91bbfbe46ac20efe0e585c5d4c766db23b5c709d
/frameworks/base/core/java/android/widget/Editor.java
7a12433390470ce8ae1eda2ed7578f513abc75ad 13-Nov-2012 Fabrice Di Meglio <fdimeglio@google.com> am bb67d486: am a97f5b8c: am 9d82d324: Merge "Fix bug #7457897 Error icons are not shown in credit card entry form" into jb-mr1.1-dev

* commit 'bb67d48606afdeb34fc488fb16f18c136eb49ec8':
Fix bug #7457897 Error icons are not shown in credit card entry form
5acc379c5488e846093efd2347d408069509830a 12-Nov-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #7457897 Error icons are not shown in credit card entry form

- fix regression: the error icon was no more showing is the widget was not focused

Change-Id: I24cc00a0cb79d38e365d413f9820b5a6981de4f4
/frameworks/base/core/java/android/widget/Editor.java
18d9a269411a5ac1431cb86949b101987ae3242e 08-Nov-2012 Romain Guy <romainguy@google.com> am a965fc5e: am b37e5d75: am 7b9b41c1: am 1b3b2544: Merge "Dismiss error icon on setError(null) [regression] Bug #7442935" into jb-mr1-dev

* commit 'a965fc5e8f0c84cbeeaae7006eddbaf3bba64586':
Dismiss error icon on setError(null) [regression] Bug #7442935
d1cc1878cc7a07c794feec51c840fd566f59d523 06-Nov-2012 Romain Guy <romainguy@google.com> Dismiss error icon on setError(null) [regression]
Bug #7442935

Change-Id: I783d868173637007be326e20795cbb4cb8c7b899
/frameworks/base/core/java/android/widget/Editor.java
5fc949d0ae051f05437858d911ebf12d3a6fbead 02-Nov-2012 Raph Levien <raph@google.com> am e5a4e92f: am fd06d34c: am d9134e7a: Merge "Revert partial RTL\'ization of Editor.setError()" into jb-mr1-dev

* commit 'e5a4e92f175e7a776ba4703a09b68de562060e1f':
Revert partial RTL'ization of Editor.setError()
f58f1b9d41a5cfc2614b836417b7fee7e6d241b6 02-Nov-2012 Raph Levien <raph@google.com> Revert partial RTL'ization of Editor.setError()

The conversion of the error indication on Editor to RTL-aware was only
partially completed, and was causing bugs such as an error indication
failing to appear when set (bug 7457897).

This patch reverts these changes and just always sets the error drawable
on the right. This fixes the above bug, and also makes the error
drawable position always consistent with the error popup (before, in an
RTL layout direction, the popup would be on the right and the drawable
on the left).

Making the error display fully RTL-aware should be done as future work.

Change-Id: Icaee91210454ed9056e7200520d9275303de02ca
/frameworks/base/core/java/android/widget/Editor.java
46e62fe39874abf2a9bdfab7635df98011c03cd1 30-Oct-2012 Fabrice Di Meglio <fdimeglio@google.com> am 024e70c8: am dd80335e: am 07ce0ca2: Merge "Fix bug #7419054 TextView Drawables resolution is broken in RTL mode" into jb-mr1-dev

* commit '024e70c8156a0fa2d702ff2fba4a38c1f6b68f98':
Fix bug #7419054 TextView Drawables resolution is broken in RTL mode
1957d281ea123e4925e51fa5ad22ce239ef2a07d 26-Oct-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #7419054 TextView Drawables resolution is broken in RTL mode

- check layout direction previous value in the onResolveDrawables(int) callback
- dont do any Drawables resolution if we cannot resolve the layout direction
- also remove unnecessary call to resolveRtlPropertiesIfNeeded() in ViewGroup when
adding a child as the call to resolveRtlPropertiesIfNeeded() will be done into
the measure() call itself later

Change-Id: I62237af3d307dfea203f7f2865551d1c61a0e0b8
/frameworks/base/core/java/android/widget/Editor.java
5d96964fb5ec8125b984ba84e2f9acb4a9255f0d 03-Oct-2012 Raph Levien <raph@google.com> am 11541338: am e9b175b7: am 484de9db: Merge "Fix for bug 6954231 text wraps on second line and is fused..." into jb-mr1-dev

* commit '11541338c5c0db1181107aef8f96c398d8445fd4':
Fix for bug 6954231 text wraps on second line and is fused...
6b558994d4ea8dfa1967f96e272496a7d2b8972a 03-Oct-2012 Raph Levien <raph@google.com> Fix for bug 6954231 text wraps on second line and is fused...

When breaking a line, the paragraphs below the new line break were still
being drawn in their old location. This only happened when the height
was fill_parent, otherwise the height change would force a relayout,
which in turn would do a full invalidation.

This patch checks for changes to the layout height (not just the widget
height, which won't change when it's fill_parent), and invalidates.

Change-Id: I64adb9f5eae0479c1c9c8d37c10c2c27a6f582a8
/frameworks/base/core/java/android/widget/Editor.java
525926078b5f4b9eeceb21662cdebe763f4c5b45 24-Sep-2012 Fabrice Di Meglio <fdimeglio@google.com> am 72d65718: am 239e4305: Merge "Fix bug #6427629 Clean up layout direction APIs" into jb-mr1-dev

* commit '72d657182312c7bac049b3ed94a4658c3935ae28':
Fix bug #6427629 Clean up layout direction APIs
e56ffdc7b31b0937628609cc3bbaa15879023569 23-Sep-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #6427629 Clean up layout direction APIs

- rename getResolvedLayoutDirection() to getLayoutDirection()

Change-Id: I3afe56c0db0751952f5056c23893cb7455531d29
/frameworks/base/core/java/android/widget/Editor.java
b19f313e259eea7f10753cf69f10950ec45155ca 18-Sep-2012 Victoria Lease <violets@google.com> am 976ed471: am d6991106: Merge "Avert crash when dragging text in same TextView" into jb-mr1-dev

* commit '976ed4711ef5fc943ad94a8cbb251cd5feb34cde':
Avert crash when dragging text in same TextView
91373209da02813ed760d9ea201d6f917e2a1fc1 08-Sep-2012 Victoria Lease <violets@google.com> Avert crash when dragging text in same TextView

The previous implementation made liberal assumptions about the size
of the string being edited, as well as the position of the substring
being dragged. Explicitly checking those assumptions fixes our
IndexOutOfBoundsException.

Bug: 7129392
Change-Id: I32560cf87fbbe703a8b26c7eb2a64c8f8c0bfcf1
/frameworks/base/core/java/android/widget/Editor.java
0c96b81f8e843b8d6e8c21218fb468f1897b999b 29-Aug-2012 Luca Zanolin <zano@google.com> Relax suggestion notification.

Before the suggestion selection were notified only when they were added by
an IME. This CL relaxes this constrain, and the suggestion are notified
even if they are added by an application.

If the context is null and the package name of the apk cannot be determined,
the suggestion are notified using the old method via the Input Method Manager.
This is required to keep the backward compatibility.

Bug: 6905960
Change-Id: If225ef27cded386809fbd899e34e32aced4e0473
/frameworks/base/core/java/android/widget/Editor.java
58cf576243d17b34c0bd3e0aead48cae00c089c0 02-Jul-2012 Gilles Debunne <debunne@google.com> Merge "UI changes in suggestion menu"
1daba18747782588ee7f486d0ba4033438429302 26-Jun-2012 Gilles Debunne <debunne@google.com> UI changes in suggestion menu

Icons removed for delete and add to dictionary.
Words capitalized (in English only)
Changed background color to white for words.

Note that due to a bug in the interaction between listView and
popup window, setting a background to the TextViews paints a
solid rectangle, which hides the rounded corners defined in
the popup window background.

Bug 6712892

Change-Id: Id5bb429463e2debc5e30d571c34426dfa82119d4
/frameworks/base/core/java/android/widget/Editor.java
c72fba82a68992fe5bec05e4415ae98deaa66ea3 26-Jun-2012 Gilles Debunne <debunne@google.com> Ensure batch edit mode is ended on window focus loss

This is a translation of this open source contribution:
https://android-review.googlesource.com/38503

Change-Id: I4d3adf89d0752e6fd5ec2cdad3a54d4e764a1fe7
/frameworks/base/core/java/android/widget/Editor.java
0ed59fae6fc85c2c4a223d3be88b79cf797908ab 30-May-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #6567507 [Bidi] - Cursor is sometimes not visible on EditText

- take the hint layout primary horizontal offset if needed

Change-Id: Ib5c4dd990278e1fd8bb9ba4f4b6940a62dba91e3
/frameworks/base/core/java/android/widget/Editor.java
057a585fba01d92c38f27a8c080622dfd0c6f556 11-May-2012 Adam Powell <adamp@google.com> Automatic persistent text selection for ListViews

Use View transient state tracking to allow selection to persist across
ListView-style item view recycling.

Fix some bugs with transient state tracking.

Bug 6110122

Change-Id: Ic084b8fc2289bff718b19478a37ce64459b3ed4c
/frameworks/base/core/java/android/widget/Editor.java
fd5bc01f70c8d9270162d38bb9f675308b5a19b0 24-Apr-2012 Gilles Debunne <debunne@google.com> Better horizontal internal scroll handling in Text.

Bug 6378843

Corrects CL 183460, which would clip text with a width greater than
twice the TextView's width.

Internal horizontal translation is now handled in a similar way to
vertical scrolling.

Internal scrolling is indeed handled by the TextView, which translates
the canvas and sets the clipping bounds accordingly.

When drawing the internal DL, we tighten the horizontal bounds like we
did for the vertical bounds using top and bottom. As in Touch.java, we
use the getHorizontallyScrolling() method to know if we indeed have to
measure the actual text width. If there is no horizontal scrolling we
use the TextView's width as a safe upper estimate in order to avoid an
actual computation. Note that horizontal scrolling is typically only
used for long single-lined text, so that the measurement loop is quick.

As a result, the internal DLs represent the entire text, and there is no
need to invalidate them when an internal scrolling takes place. This
behavior replaces the draw-only-what-is-needed we had before, but is
more consistent with what we do for long texts inside of a ScrollView
with no noticeable performance change, even on very long text.

Change-Id: I47c24c0ae988547d4f1e9f87d136225c93a3056d
/frameworks/base/core/java/android/widget/Editor.java
0b7d747e900dd9e6e6f62f10772c2dded9b9d0c6 24-Apr-2012 Gilles Debunne <debunne@google.com> Merge "Editor uses a SpanWatcher to track EasyEditSpans"
8b482446683e4908e6a71da42301291a0a399932 24-Apr-2012 Gilles Debunne <debunne@google.com> Merge "Centered text is not updated"
c62589cbecef6e748bcc6c6f4ea6a8ff7656923f 12-Apr-2012 Gilles Debunne <debunne@google.com> Editor uses a SpanWatcher to track EasyEditSpans

Will also fix Bug 6344997

The previous TextWatcher mechanism was inneficient. It require an
expensive getSpans() call to retrieve all the spans and then search
for the one we're interested in in case it has been changed.

The SpanWatcher is faster, it will broadcast the add/changed/removed
events we're interested in.

Now that we can rely on SpanWatcher, use it to directly track
addition and removals of EasyEditSpans.

No unit test for this feature which require an integration with
the voice IME. Easy to test manually though.

Change-Id: Idabcacc48c479bf9868d5204c0b0ca709207ede2
/frameworks/base/core/java/android/widget/Editor.java
fb9f5be318e4f530eff9964702cfb655a6433f00 24-Apr-2012 Gilles Debunne <debunne@google.com> Centered text is not updated

Bug 6378843

Emergency fix. May submit a proper fix with less translations later.

Change-Id: I9d8348e29d5436580202d3ee0456d341bf81dab8
/frameworks/base/core/java/android/widget/Editor.java
b983e27af47b6a3a6b13af0d3dd64b163f540efd 24-Apr-2012 Gilles Debunne <debunne@google.com> Merge "Re-added a flag to prevent the IME from showing"
1271e2cc80b01d577e9db339459ef0222bb9320d 20-Apr-2012 Chet Haase <chet@google.com> Remove USE_DISPLAY_LIST_PROPERTIES flag

This flag was still hanging around pending any need to disable
DisplayList properties. But things seem stable, so it's time to clean up
and simplify the code.

At the same time, I reduced redundance in DisplayList dimensions. We
used to call drawDisplayList() with width/height parameters that were
used to do a clip reject. This is redundant with the DisplayList properties
that set the bounds of the DisplayList; the left/right and top/bottom properties
represent the same width/height properties formerly used in drawDisplayList().
The new approach is to not pass dimensions to drawDisplayList(), but to
instead pull those dimensions directly from the DisplayList when needed.

Change-Id: I8871beff03b1d4be95f7c6e079c31a71d31e0c56
/frameworks/base/core/java/android/widget/Editor.java
de09576f4910f36f63275683870a067054d51428 23-Apr-2012 Gilles Debunne <debunne@google.com> Merge "Cursor is moved at end of word when it is added to dictionary"
3473b2b1f495f0f5a31e7ed687557c423c63abff 21-Apr-2012 Gilles Debunne <debunne@google.com> Re-added a flag to prevent the IME from showing

Revert of CL 161404

This flag will be used by the dialer. It prevents any IME from
showing as a result of a focus given to a TextView through a tap
or a D-Pad click.

Change-Id: Ifa5bfcbff124b300780f76dea443d26cf172f5e3
/frameworks/base/core/java/android/widget/Editor.java
ebc86af1dc186c77f723c8970951e8ff00b4866b 21-Apr-2012 Gilles Debunne <debunne@google.com> Visible spans changes only invalidate the affected text sub display lists

When a span with a visible influence on the text is modified, we only
need to invalidate the text sub display lists that overlap this span.

This is especially useful when typing and the composing span (an underline
span) gets updated after each key stroke.

Change-Id: Ib2af3219c41eb79ec5d0a2eee317aca8c4efdef9
/frameworks/base/core/java/android/widget/Editor.java
2eb70fb257623de7d32e8c1a878f4c03b71846d1 19-Apr-2012 Gilles Debunne <debunne@google.com> Cursor is moved at end of word when it is added to dictionary

Bug 6355904

Change-Id: Ib56b719d0c3001ce975bccf8dd80c138bffc24cc
/frameworks/base/core/java/android/widget/Editor.java
157aafcbee0eabda798a3be406ccc4200ee86756 20-Apr-2012 Gilles Debunne <debunne@google.com> TextView's sub display lists have tighten bounds

An editable TextView caches text rendering inside an adaptive
number of sub display lists. The bounds of these use to be those
of the entire View.

This CL creates block display lists with tighten bounds, so that
(a still-to-be-implemented) quick rejection can occur.

Also cleaned-up the contradictory translations that were used to
handle the TextView's internal scroll and removed the invalidation
of display lists in that case.

TODO: When internal scroll sets a tighter clipping rect, quick
reject the creation and display of the clipped display lists.

Also renamed blockEnds to a more explicit blockEndLines.

Change-Id: I7d79bea78d06d19b6935aef75ff7aa7df2594050
/frameworks/base/core/java/android/widget/Editor.java
acb69bb909d098cea284df47d794c17171d84c91 14-Apr-2012 Dianne Hackborn <hackbod@google.com> Add direct support for HTML formatted text in ClipData etc.

When using the clipboard, ACTION_SEND, etc., you can now supply
HTML formatted text as one of the representations. This is exposed
as a set of methods on ClipData for building items with HTML
formatted text, and retrieving and coercing to HTML (and styled)
text. In addtion, there is a new EXTRA_HTML_TEXT for interoperating
with the old ACTION_SEND protocol.

Change-Id: I8846520a480c8a5f829ec1e693aeebd425ac170d
/frameworks/base/core/java/android/widget/Editor.java
cfbf0e0296acd4c3451591ec4b241e393fb9bd8a 04-Apr-2012 Gilles Debunne <debunne@google.com> Removed spurious log about blinking cursor

Change-Id: I940c3847bb6e461178575480c82e7dd6739277cf
/frameworks/base/core/java/android/widget/Editor.java
d88876a72f9ceebd2c93eb9ba1be4bcff971e754 17-Mar-2012 Gilles Debunne <debunne@google.com> Extracted text editing logic in a separate class

Editor specific method and fields are extracted to a dedicated Editor class.

Some private fields and methods had to be made package private so that the
Editor can see them. No change in the public API.

Other changes in this CL:
- The Blink class no longer has a WeakReference to the TextView
- EasyEditSpanController is no longer a field of ChangeWatcher.

Future work:
remove the getEditor() method in TextView and
clean whitespaces and indentation.
remove the EasyEditSpanController as a change watcher, fix spanWatcher

Change-Id: I1fbe0176b6bd27d90f556dc3a90469367f77437c
/frameworks/base/core/java/android/widget/Editor.java