Commit Graph

6106 Commits

Author SHA1 Message Date
Keisuke Kuroyanagi
ff37557795 Merge "Fix selection expansion detection logic." 2015-12-10 07:18:21 +00:00
Keisuke Kuroyanagi
155aecb18b 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
2015-12-10 06:41:10 +00:00
Keisuke Kuroyanagi
4368d05af7 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
2015-12-10 06:01:19 +00:00
Keisuke Kuroyanagi
b2ba0605ef 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
2015-12-10 14:41:52 +09:00
Keisuke Kuroyanagi
40329b8540 Merge "Move mouse selection handling logic to Editor." 2015-12-10 05:14:11 +00:00
Keisuke Kuroyanagi
97af673e1f 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
2015-12-10 05:13:40 +00:00
Chet Haase
709bf2a37c Merge "Revert "Add support for partial view layouts"" 2015-12-09 18:40:06 +00:00
Alan Viverette
2ce4f73bf7 Merge "Snap AbsSeekBar touches to nearest progress tick" 2015-12-09 17:43:05 +00:00
Chet Haase
4610eeff9c Revert "Add support for partial view layouts"
This reverts commit c55d5072ac.

There were several bugs related to incorrect handling of various
layout issues (layout not being run on containers/views that needed
it), reverting to take another run at it outside of master.

Issue #25980198  requestLayout() sometimes doesn't result in measure/layout for view

Change-Id: Ic0e159cbcf6171652d8fd1bee9ae44a3977cea04
2015-12-08 16:45:23 -08:00
Alan Viverette
9c17c85d1e Snap AbsSeekBar touches to nearest progress tick
Previously it would snap to the floor(progress) tick, which makes the
touch target size for the last tick 0px wide and difficult to touch.

Change-Id: Iac488d73e5a67c29b45f9bb4368db46c0028483e
2015-12-08 13:23:58 -05:00
Chet Haase
f1b40f65b0 Merge "Fix requestLayout() optimizations" 2015-12-07 21:29:00 +00:00
Chet Haase
016f445757 Fix requestLayout() optimizations
A bug in recent layout optimizations was causing the framework to avoid
laying out containers with WRAP_CONTENT in one axis or the other.
This fix updates the logic in the code that finds dependent layout axes
to correctly account for this case.

Issue #25980198 requestLayout() sometimes doesn't result in measure/layout for view

Change-Id: Ie5f678beef5d8c4ba25291ffdcd59797d4697acc
2015-12-07 13:17:44 -08:00
Chris Banes
f2a7e9712f Fix possibility of ScrollView not allowing clicks after a fling
The reason that manifests is because SV's
onInterceptTouchEvent checks if it's scroller.isFinished()
returns true. The result of Scroller.isFinished() is only
valid if it has had computeScrollOffset() called on it before.

ScrollView currently posts a invalidation after a computeScroll()
call, which means that isFinished() *should* be valid, but it's
better to be explicit which CL adds.

BUG: 26051101
Change-Id: If78f48dc855de1776011cb7b0f95cb0a80d9b777
2015-12-07 11:53:26 +00:00
Yohei Yukawa
658c29e86e retry: Add @hide SpellCheckerSubtype#getLocaleObject().
This is the 2nd try of I39dc0c310158ad23ba6c987efce07deaf30ce693.

This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

No behavior change is intended.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I51be014c752b736a808e2b0d56e664941a218a2f
2015-12-04 14:43:01 -08:00
Yohei Yukawa
8687b42463 Merge "Revert "Add @hide SpellCheckerSubtype#getLocaleObject()."" 2015-12-04 22:30:45 +00:00
Yohei Yukawa
80a918c3bd Revert "Add @hide SpellCheckerSubtype#getLocaleObject()."
This reverts commit e3c761c87e.

Previous CL unintentionaly contained behavior change.

Change-Id: I1e350f224df815e991d9f42ac4145ecfc5c1c8b0
2015-12-04 22:26:41 +00:00
Yohei Yukawa
ab004d5ad8 Merge "Add @hide SpellCheckerSubtype#getLocaleObject()." 2015-12-04 22:17:32 +00:00
Yohei Yukawa
e3c761c87e Add @hide SpellCheckerSubtype#getLocaleObject().
This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I39dc0c310158ad23ba6c987efce07deaf30ce693
2015-12-04 22:07:39 +00:00
Filip Gruszczynski
ae5fe6abb3 Merge "Remove some sized based resource (match support lib removal)." 2015-12-04 20:09:31 +00:00
Filip Gruszczynski
b635fdaf22 Remove some sized based resource (match support lib removal).
Bug: 25394588
Change-Id: I5b5b446667fc6ec028ec259da236967d3b2d22d2
2015-12-03 18:37:38 -08:00
Yohei Yukawa
b4ea6ddc03 Merge "Introduce EditorInfo#locales." 2015-12-04 01:21:02 +00:00
Yohei Yukawa
8d6eeb01df Introduce EditorInfo#locales.
The primary goal of this CL is to enable application developers to
provide more context-based language (locale) information for IME
developers so that users can be benefited by more natural text input
experience.

As of API Level 23, there are several APIs that allow IMEs to retrieve
locale/country related information.

  - Locale#getDefault()
  - Configuration#locale
  - LocaleSpan#getLocale()
  - SubscriptionInfo#getCountryIso()

However, only LocaleSpan#getLocale() can be used to pass application
specific languge (locale) context from applications to IMEs.  Also
LocaleSpan is not designed to be used per input-context.  We want to
have something in EditorInfo and LocaleList would be the right thing.

Although default implementation of TextView#onCreateInputConnection()
starts filling EditorInfo#localeList with TextView#getTextLocales() by
this CL, application developers are encouraged to provide its own
LocaleList when they are confident that the user want to use a
certain (set) of language(s).

For instance, a chat application may be able to guess what language will
be used in the conversation before the user start typing.  At least it
should be able to remember the last used language for each conversation.

Another instance would be "From" and "To" EditText fields in a
translation app.  Those fields should have different LocaleList based on
the languages that the user want to translate from and to.

Bug: 22859862
Change-Id: I77db5b99a7cf745d800db75baf135bb60ad04820
2015-12-03 16:10:37 -08:00
Alan Viverette
9643e73951 Merge "Ensure only one context menu is shown at a time" 2015-12-03 21:27:07 +00:00
Neil Fuller
568f4de11a Merge "Fix @code escapes" 2015-12-03 09:44:01 +00:00
Keisuke Kuroyanagi
26454141a8 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
2015-12-02 15:04:57 -08:00
Selim Cinek
7943316678 Merge changes I2af07b57,Ic0a774e8,Ica3d21ff,Id4c3c901
* changes:
  FalsingManager Quick settings fix
  Fixed a bug where the panel could be too small in certain cases
  Fixed a bug where the margins where not updated correctly
  Fixed the handling of the expand on the lockscreen
2015-12-02 19:08:58 +00:00
Neil Fuller
71fbb81b14 Fix @code escapes
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.

Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
2015-12-02 14:24:11 +00:00
Keisuke Kuroyanagi
5d7657e99b Refactoring: SelectionHandleView.
Remove code duplication in SelectionStartHandleView and
SelectionEndHandleView by introducing SelectionHandleView.

Change-Id: I4486019714b13d184a72cf7ee60c346c4d8b5f5a
2015-12-01 17:30:51 -08:00
Selim Cinek
a89ef23e8c Fixed a bug where the margins where not updated correctly
When updating a notification, the end margin was not
correctly updating, leading to overlapping text with
the image.

Change-Id: Ica3d21ff0268105d0a8a73527b8dad0225e12d5a
2015-12-01 13:04:31 -08:00
Selim Cinek
4fb12d3f8e Made the bigtext now nicely float around the image
If there is an image instead of applying the same
margin everywhere, the text now floats around the
image.

Change-Id: I87f9ca9f51fb270b0732a99374544381bd1fc4e0
2015-11-30 17:45:15 -08:00
Selim Cinek
65b2e7c6cb Update the notification templates
Most of the notification templates have been updated.
Some cases like media notifications don't yet work well
but will be fixed in a later CL.

Bug: 25376106
Change-Id: I26c366e58ebba3852cea20de6fca311bd302bb24
2015-11-30 17:45:15 -08:00
Raph Levien
f9b40659e6 Merge "Always invalidate TextView on checkForRelayout" 2015-11-30 21:07:07 +00:00
Alan Viverette
5ac42c92fa Always invalidate TextView on checkForRelayout
Previously we would check whether relayout was required and optionally
invalidate; however, with partial layout we leave this work for the
makeNewLayout() method. We still need to manually invalidate, though,
since makeNewLayout() does not handle invalidation.

Bug: 25857300
Change-Id: I81ef9062c9fb4964d5e42a3562e6c782492ad65f
2015-11-30 13:03:00 -08:00
Yohei Yukawa
777ef95ebf Use Context.getSystemService(Class<T>) for InputMethodManager.
This is a mechanical replacement of Context.getSystemService(String)
with Context.getSystemService(Class<T>) when retrieving
InputMethodManager.  Note those are bundled code.  Hence we don't need
to make sure Build.VERSION.SDK_INT >= 23.

Change-Id: Icc64942ad8f11e44bf84f8d4fe476b2fdd1257f3
2015-11-26 00:02:05 -08:00
Alan Viverette
021627eb58 Ensure only one context menu is shown at a time
Refactors the menu helper classes. Both classes now implement a common
MenuHelper interface, which eliminates the need to keep separate helpers
on PhoneWindow and unifies the DecorView showContextMenuForChild()
implementations.

We now explicitly dismiss any previously shown context menu before showing
a new context menu. Previously we relied on the modal nature of the dialog
context menu to prevent multiple menus from being opened at once, but this
is no longer reliable with popup context menus.

Bug: 25656520
Change-Id: Idab3daa6d6888f803f2e33660fe1dd488e4c28d1
2015-11-25 14:22:00 -05:00
Keisuke Kuroyanagi
d3c48931ea Merge "Add selection handle dragging tests." 2015-11-25 07:24:17 +00:00
Keisuke Kuroyanagi
da79ee683d 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
2015-11-25 16:15:15 +09:00
Seigo Nonaka
a71a244ec6 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
2015-11-24 12:05:48 +09:00
Adrian Roos
10613a9472 Merge "Visuals for Inline Reply" 2015-11-23 22:19:09 +00:00
Adrian Roos
fe84e1f436 Visuals for Inline Reply
Change-Id: I374a7ec82795f95fe2f3ce8c9e6b02c1479433af
2015-11-23 20:07:49 +00:00
Alan Viverette
12209b9afe Merge "Only look for nearest child View in ViewGroup" 2015-11-23 17:26:38 +00:00
Alan Viverette
708aa9d964 Dispatch the actual PopupWindow dismiss callback to PopupMenu
Previously the dismiss callback was called immediately after the menu
received a close request; however, the dismiss callback implies that
the menu's window has finished animating and been removed from the
window manager.

Also cleans up handling of mPopup in MenuPopupHelper to prevent
unnecessary MenuPopup allocations and convert unnecessary fields into
method arguments.

Bug: 25323707
Change-Id: I8e3877ae6c40b4d0f1df23a4ff4fa48a7df34e0d
2015-11-20 15:21:30 -05:00
Alan Viverette
7add7e0496 Only look for nearest child View in ViewGroup
NearestTouchDelegate may still be assigned to non-ViewGroup views, but
we won't attempt to find a target child View until the touch moves into
a ViewGroup.

Bug: 25813455
Change-Id: I570f88fee63623110e3463e8d4579cca8113fd5e
2015-11-20 14:19:39 -05:00
Alan Viverette
68016a66f6 Set mTempCalendar in TimePickerSpinnerDelegate
A previous CL removed setLocale(), which had been initializing the temp
calendar. This CL also makes the calendar final, since the locale is only
set once during construction.

Bug: 25776094
Change-Id: If0af34df3120a7c4b1667129a553b9f8b7ec1999
2015-11-19 17:10:54 -05:00
Adam Powell
c55d5072ac Add support for partial view layouts
Traditionally, when a view called requestLayout it would force
recursive requestLayout calls for all parent views up the
hierarchy. This meant that there was no way to determine at traversal
time whether a parent view itself needed layout, or if just one of its
descendants did.

Add a ViewParent method requestPartialLayoutForChild(View). This lets
a caller state that a particular child of a given parent needs a
remeasure and relayout at its current measured size and position
within that parent. This can help prevent the full-tree relayout often
caused by otherwise trivial changes. Partial layouts are processed
after any pending "full" relayout during ViewRoot traversals, but
before drawing.

Add a ViewGroup method requestLayoutForChild(View). This lets a
ViewGroup decide whether it is more appropriate to request a
traditional relayout or a partial layout for itself or just the child
that changed.

Add a ViewParent method findDependentLayoutAxes. This allows a caller
to check if the ViewParent's layout is dependent on a specific direct
child view along one or both axes. Called recursively, this can be
used to determine if a change in a child view can be isolated to a
partial layout, even if its direct parent's own layout is tied to its
other ancestors. (e.g. MATCH_PARENT, LinearLayout weights)

Implement ViewGroup#requestPartialLayoutForChild to call new
ViewParent method findDependentLayoutAxes and based on the result,
either request a full layout for itself or a partial layout for the
child in question.

Implement findDependentLayoutAxes for common framework ViewGroups. A
private implementation in ViewGroup is available for use by framework
classes that will deal with basic LayoutParams. These implementations
specifically check for derived LayoutParams classes and abort the
optimization if they find something beyond their expected parameter
types.

Change-Id: I0a1a9b79293d17d4fae8d9892b96d3586f9401ae
2015-11-19 09:31:56 -08:00
Aurimas Liutikas
664e040f7b Merge "Start saving CheckedTextView checked state." 2015-11-18 21:06:14 +00:00
Siyamed Sinir
6fbb5c1ca4 Merge "TextView setText/append methods set movement method" 2015-11-18 18:32:22 +00:00
Siyamed Sinir
4ba0aa598e TextView setText/append methods set movement method
Previously, TextView setText and append methods set the movement
method to LinkMovementMethod only when autoLink was enabled and
Linkify was able to find links in the input text. This CL adds the
case where autoLink is false, linksClickable is true, and the input
text contains ClickableSpans.

Fixes https://code.google.com/p/android/issues/detail?id=2219

Bug: 1712837
Change-Id: Ife4e35bac7f6cb48ad0dac6ecb4b90aec126fc73
2015-11-17 17:56:03 -08:00
Aurimas Liutikas
e3fa176472 Start saving CheckedTextView checked state.
Match the behavior of other widgets and start saving
CheckedTextView checked state.

Bug: 25720678

Change-Id: I8c3df3a67f4cea848320e6075066516857d8cddf
2015-11-17 14:52:44 -08:00
Filip Gruszczynski
6c54e72892 Swtich from max_action_buttons resource to a method.
We want to limit the number of size thresholds that an application will
report. Instead of using a dimen resource that will increase the number
of thresholds, we calculate the max number of action buttons dynamically
in code.

Bug: 25394588
Change-Id: I8ece331cd02fb116b49734003cec112708d27f85
2015-11-17 12:56:08 -08:00