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
StaticLayout.Builder used "setTextDir" as a shorthand, but it's not
as clear as spelling it out. So, setTextDirection.
Bug: 21572282
Change-Id: Ia94476562d70678f963196b87bb63511d30836b6
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
Fix an incorrect unparceling of the previous saved state in
HorizontalScrollView. Remove an unneeded field in the saved state by
storing scroll offset from start instead of scrollX + isRtl.
Bug 20666194
Change-Id: I1ec45b3e3bd0846b5f659356df7ff94f42e61055
ListView caches transient state views for reuse during layout, which calls
dispatchStartTemporaryDetach() before caching the view. This should always
be followed by a corresponding dispatchFinishTemporaryDetach() before
removing the view from the cache and returning it for reuse. While this
was the case for other types of cached views, we missed this call for
views placed in one of the two transient view caches.
Bug: 17387206
Change-Id: I360945006558b2783c098183a7cc9bc28d05d9ab
Don't try to change focus at all on exit from touch mode. The old
behavior might have been useful for very old apps with a TabHost as
their primary UI, but that's not a modern app structure.
Bug: 21417491
Change-Id: I3db2ab42c90b6c82f23216244a8183c4290eb7d7
Moves themed interface out of Spinner and extends SpinnerAdapter, updates
Spinner constructor to take a Theme rather than a Context.
Does NOT change BaseAdapter to implement ThemedSpinnerAdapter, because
the BaseAdapter class does not have any notion of layout inflation and
that would break the contract implied by ThemedSpinnerAdapter.
Bug: 21571899
Change-Id: Id7e8d630458857ce6c93a6a8b8f920e169ee1152
Not calling mutate here had a side-effect making the icon in the
status bar untintable in SysUI.
Bug: 21566007
Change-Id: Ifb78c81ba7f04d496f14031ef635a6e964e6280e
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
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
Changes to the data provided to AssistStructure:
* Text foreground color is correct even if the view has not yet been
painted.
* Text background color is now always 1 (TEXT_COLOR_UNDEFINED) for a
TextView, as it has no separate concept of background color.
* Switch now reports the text size/color/style of the label text
(usually user visible) rather than the on/off text on the button
itself (usually hidden in Material, and not usually revelant when
visible).
Bug: 21080375
Change-Id: I7e15f68d89510a76cab76031c2c8ca6ca3f32435
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
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
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
- 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
We reference the cached enabled state from the selector state update
code, so we need to ensure it is accurate first.
Bug: 20121334
Change-Id: I5859e9e8c594e1ba64ec9f001f47c2a6ea311c4f
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
Drag accelerator state was not cleared when the text was
modified; thus, mStartOffset could point to an invalid offset.
Bug: 21178876
Change-Id: Ic9b47375bab321fbc573e8a81e3fadf60309da78
mDrawable is updated, but it was not re-drawn properly.
postInvalidate() should be called when the drawable is
updated.
Bug: 21141841
Change-Id: Icb3ddf18d05285ffa8758a9be256482d594ab8ed
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
Previously it wasn't offsetting the position by the min date's month,
so it would be off by a year if the min date wasn't in January. Also
now updates button visibility whenever the ViewPager's range changes.
Bug: 21203303
Change-Id: Id7a41a4fa48843943c744fb0fecd4bebb798cee5