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
The implementation of onActivityResult in TextView did not check the
result code, hence treating the cancelled activity result as a
replacement by empty text.
Also added tests to catch this case and basic usage.
Bug: 21183019
Change-Id: Ibdafe89474dd69c5b70c67ec98fed46656f9fdcf
Previously it was only updated when the page was turned, but that listener
isn't called until the user turns the page.
Bug: 20701637
Change-Id: I06faf59660cda0e19d57766f4afd141e4a389b18
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
* 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
Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.
bug: b/20849543
Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
ImageView.setImageIcon() is remotable, so you can also call
RemoteViews.setImageViewIcon().
Bug: 18568715
Change-Id: I456cfa65102e1983d3392d822584d154a6cd761a
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
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
This patch adds plumbing to TextView and StaticLayout to control the
frequency of automatic hyphenation used in laying out paragraphs.
Bug: 21038249
Change-Id: Ib45de190eb0a1ed738e69fd61f2b39561b11aec7
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
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
We now maintain a mata-state with each permission in the form of flags
specyfying the policy for this permission. This enables support of the
following use cases:
1. The user denies a permission with prejudice in which case an app cannot
request the permission at runtime. If an app requests such a permssion
it gets a denial unless the user grants the permission from settings.
2. A legacy app with disabled app-ops being upgraded to support runtime
permissions. The disabled app ops are converted to permission revocations.
The app ops manager is a part of the activity manger which sits on top
of the package manager, hence the latter cannot have a dependency on the
former. To avoid this the package installer which is the global
permission managment authority marks the permission as revoked on
upgrade and the package manager revokes it on upgrade.
3. A device policy fixing a permission in a granted or revoked state. This
additional information is folded in the meta-state flags and neither
apps can request such permissions if revoked not the user can change
the permission state in the UI.
Change-Id: I443e8a7bb94bfcb4ff6003d158e1408c26149811