Commit Graph

6193 Commits

Author SHA1 Message Date
Yohei Yukawa
116d872d9c Merge "Introduce InputConnection#getHandler()." into nyc-dev 2016-02-19 02:36:50 +00:00
Deepanshu Gupta
491523d52c LayoutLib fixes for N
Moves LayoutLib to Java 8 - YAY!
Fix delegates

Change-Id: I098996e43e330e995d33f12df1c16355bbc02f0f
2016-02-18 02:10:24 +00:00
Sunny Goyal
a086f0436a Using AppWidgetHostView in RemoteViewsAdapter instead of managing the RemoteViews inflation itself
Change-Id: If6dd8a778096a07c58b543efe892bbffbe24098f
(cherry picked from commit 89699a2811)
2016-02-17 18:08:46 +00:00
Sunny Goyal
4ea5484266 Changing hashmaps to sparseArrays and other similar conversions
Change-Id: I1905120a2dc109e8f383b973e599e2c23e005d0e
(cherry picked from commit c7ccff4b20)
2016-02-17 18:07:40 +00:00
Siyamed Sinir
afe3cd1aaf Merge "Ellipsized and Non-ellipsized baselines should be same." into nyc-dev 2016-02-16 22:37:54 +00:00
Siyamed Sinir
715589fb46 Ellipsized and Non-ellipsized baselines should be same.
This CL make sure that ellipsized and non-ellipsized text have the
same baseline.
- TextView did not set the maxLines for StaticLayout when ellipsized
is false. This resulted in height and baseline calculation
discrepancies between ellipsized and non-ellipsized TextViews using
StaticLayout.
- For single line TextViews when a text is not ellipsized
BoringLayout is used, and when text is ellipsized StaticLayout is
used. Because of the bottom padding added to the last line of
StaticLayout, those two did not have the same baseline.

Bug: 18864800
Change-Id: I5dbc48a6c7f0f4ac4c693d5c95f0a99b989e07f4
2016-02-12 18:23:37 -08:00
Yohei Yukawa
612cce92ad Introduce InputConnection#getHandler().
Currently there is an internal hidden class named
ControlledInputConnectionWrapper which works as a proxy in the
application process to receive incoming binder calls from input method
and dispatch those method calls again on an appropriate thread.
Although this is a kind of implementation details, basically you can see
the same design everywhere in the Android.

Currently ControlledInputConnectionWrapper is initialized with
view.getHandler(), where the view here is the View which was used to
call View#onCreateInputConnection().  This is actually a reasonable
behavior because we have generally assumed that there the only
reasonable way to implement InputConnection is to extend
BaseInputConnection, which is designed to be able to work only on the
UI-thread associated with the target view.

However, on Android N and onward, we are going to ensure that
BaseInputConnection can be re-implemented on top of public APIs [1].
Although most of applications should not try to do that, for certain
applications such as web browsers and WebView it may make sense to let
custom InputConnection implementation run with a custom Handler so that
the application can respond to the IME without blocking the UI thread.

To do that, this CL introduces a new method
InputConnection#getHandler(), which changes nothing as long as it
returns null, but if it returns non-null Handler, InputMethodManager
will use it to initialize ControlledInputConnectionWrapper.

Note that InputConnection#getHandler() is not for IME developers.
It just returns null when called in the IME process.

 [1] See Bug 24688781 for details.

Bug: 26945674
Change-Id: Id9e579bb3e2966986cdcb1c34bc8cacfeca2e1a9
2016-02-11 17:47:33 -08:00
Aurimas Liutikas
13fdea05b3 Start saving iconified state of SearchView.
Bug: 27113484
Change-Id: Ifbde47c9af7c5460390e278a5af674f0c8654c2a
2016-02-11 18:13:11 +00:00
Adrian Roos
9b123cf9bb Make actions extend over the whole action rail
Bug: 26767249
Change-Id: I3c67f1de40b218aa21f0a1f68bda1032c0804a14
2016-02-10 18:39:40 +00:00
Siyamed Sinir
f4aa7d2e8a Merge "Clamp EditText cursor in the drawable boundaries." into nyc-dev 2016-02-08 23:16:49 +00:00
Siyamed Sinir
217c0f71df 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
2016-02-08 22:41:26 +00:00
Siyamed Sinir
027711904b Do not save TextView text when freezesText is false
Currently TextView state is saved whenever selection is set even if
freezesText is false. This causes inconsistencies with the described
behavior for the attribute. This CL updates the behavior as:
- Always save the text for EditText
- Always save the selection if there are any.
- Do not save the text for TextView if freezesText is false.
- During onRestoreInstanceState if selection is out of the text
  boundaries, do not restore the selection.

Bug: 22076905
Change-Id: I5e05d343e752a7d106c8881993e4d95ae21a38ce
(cherry picked from commit 8535836673)
2016-02-08 22:23:25 +00:00
Adam Powell
2af189a0a7 Preserve compatibility for ViewGroup#showContextMenuForChild
Have the new showContextMenuForChild(View, float, float) call through
to the old showContextMenuForChild(View) before recursing up to its
parent. This ensures that existing apps with custom views that
override the old method still get called as expected if they implement
custom behavior.

Unlike some other similar circumstances we aren't implementing this to
be bidirectional as the new behavior doesn't need to be triggered by
invoking the old. If the older method is invoked explicitly we will
still show old-style dialog context menus instead of the newer popup
style since we won't have a good place to visually anchor a popup.

Bug 26919262

Change-Id: Ie09f922d322b5a24789c7867820c4bc43824c385
(cherry picked from commit 759a4c5400)
2016-02-08 18:59:28 +00:00
Steven Dao
6ce4a46a96 Merge "Fix GridView isHeading computation" 2016-02-05 22:23:54 +00:00
Steven Dao
061b16ff88 Fix GridView isHeading computation
- Same issue that was previously in the ListView

Change-Id: I3a3105b46bdadc43ea679b4d29d0719a67c291bc
2016-02-05 13:51:55 -08:00
shwetachahar
4e9a64929b Decrease the key progress increment step size to allow finer control of
seekbar using keys.
Bug:26926346
Change-Id: Ic7d290552c102d8602275f19dac4d57de4a53297
2016-02-05 11:51:50 +00:00
Alan Viverette
d50ed370f3 Merge "Improve handling of popup window exit when host window goes away" 2016-02-04 16:09:09 +00:00
Alan Viverette
3caad43a1f Merge "Preserve TextView mDrawables if it has metadata (ex. tint or padding)" 2016-02-03 22:03:21 +00:00
Sunny Goyal
40dedd5a97 Merge "Added support for async inflation of RemoteViews" 2016-02-03 19:31:09 +00:00
Alan Viverette
634a808226 Improve handling of popup window exit when host window goes away
- Exit immediately if the anchor root is already detached
- End ongoing transition if anchor root is detached while exiting

Bug: 25691021
Change-Id: I8f9e721fba965060dc830ab3b674526def53f4ad
2016-02-03 14:22:41 -05:00
Alan Viverette
1c9d20b535 Preserve TextView mDrawables if it has metadata (ex. tint or padding)
Bug: 26939206
Change-Id: Iccc8b3d50e93e50685d050ca6ea191708a0e6171
2016-02-03 10:45:55 -05:00
Steven Dao
5f9eb89844 Fix CollectionItemInfo.isHeading for ListView
- At the moment all non-header/footer items are marked
  as headings and vice versa.

Change-Id: I453e2fb9e75fa4bd863f513c4318a5e6ac4b2c87
2016-02-01 11:45:45 -08:00
Alan Viverette
8ab1a37b76 Merge "Consume AbsListView touch events following a successful long-press" 2016-01-29 15:23:16 +00:00
Seigo Nonaka
60490d1ad4 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
2016-01-29 15:29:56 +09:00
Alan Viverette
66df60fbb6 Consume AbsListView touch events following a successful long-press
This prevents the user from accidentally scrolling the list following a
long-press that, for example, opens a modal window.

Bug: 26799074
Change-Id: I9e4bce9f9fc3edd0a5b0908a868fbf7cdcb73f8c
2016-01-28 14:56:07 -05:00
Siyamed Sinir
0b9e35ab30 Merge "AbsListView invalidates data when it isn’t changed" 2016-01-27 17:53:32 +00:00
Vladislav Kaznacheev
a74e729fa9 Merge "Fix SecurityException in Editor.onDrop" 2016-01-27 00:38:38 +00:00
Vladislav Kaznacheev
c14df8e73d 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
2016-01-26 11:53:00 -08:00
Keisuke Kuroyanagi
0837daa464 Merge "Make scroll bar mouse draggable." 2016-01-26 01:46:53 +00:00
Keisuke Kuroyanagi
dfea1a3336 Merge "TextView: start drag and drop when dragging selection by mouse." 2016-01-26 01:26:06 +00:00
Siyamed Sinir
135554e628 AbsListView invalidates data when it isn’t changed
When setItemChecked is called for AbsListView, it does not check if the
value has changed or not. Then it invalidates the data by setting
mDataChanged to true and also requests a layout. This CL changes the
behavior and does not invalidate data or make a layout request when
the old and the new values are same.

Bug: 25793105
Change-Id: Id0e1f9d3ef348549a2aa88cf5ec9fe7a4b870f44
2016-01-25 16:01:18 -08:00
Alan Viverette
09a02f1c34 Merge "Ensure all showContextMenu() overrides have matching x,y overrides" 2016-01-22 15:20:43 +00:00
Yohei Yukawa
094e64b7cf Merge "Clarify the purpose of EditorInfo#hintLocales." 2016-01-22 09:54:19 +00:00
Yohei Yukawa
d469f2122e 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
       0445fdf321

Bug: 22859862
Change-Id: I0a730011874ea8d01e50624ed3f1ecd197d05f94
2016-01-21 21:13:06 +00:00
Alan Viverette
62bbd1a952 Ensure all showContextMenu() overrides have matching x,y overrides
Bug: 26340507
Change-Id: I9c6da434954d40fe689c18fa9559a80c8ca61f95
2016-01-21 14:47:30 -05:00
Adam Powell
bd918aad63 Don't show TextView "share" option for an unprovisioned device
Bug 26600141

Change-Id: Ifc59752c146c2203a66cdd463b648a891ebf12c8
2016-01-21 10:49:39 -08:00
Yohei Yukawa
88f0430980 Merge "Ensure EditorInfo#locales is set before return." 2016-01-21 06:06:49 +00:00
Keisuke Kuroyanagi
d85bc5074d Make scroll bar mouse draggable.
This is for Views that have special mouse dragging handling. e.g.
TextView invokes text selection on mouse dragging, so it cannot be
scrolled by mouse dragging.
This provides such Views or ViewGroups a last resort to scroll as we
don't assume that all devices have touch panel, touch pad, or mouse
wheel.

Bug: 20016455

Change-Id: I68a13258a50b5e4ea681b2576da6000a0bb3fa65
2016-01-21 14:50:38 +09:00
Yohei Yukawa
0445fdf321 Ensure EditorInfo#locales is set before return.
This is a follow up CL for the previous CL [1], which mistakenly put
the initialization code of EditorInfo#locales after return statement.

  [1]: I77db5b99a7cf745d800db75baf135bb60ad04820
       8d6eeb01df

With this CL, the IME starts receiving correctly initialized LocaleList
as expected.

Bug: 22859862
Change-Id: I738ffaaf07091d8b980f8bfc6e16227fcb85a96a
2016-01-20 21:09:33 -08:00
Jaesung Chung
69c8cc2930 Merge "Support for CEA-708 closed caption" 2016-01-21 03:41:01 +00:00
Alan Viverette
1c3f701807 Merge "Postpone hover state resolution in DropDownListView" 2016-01-20 20:49:54 +00:00
Alan Viverette
fb4cbc4a06 Postpone hover state resolution in DropDownListView
Prevents a HOVER_EXIT => TOUCH_DOWN transition from triggering two
Drawable.setState() calls in the same frame.

Bug: 25849904
Change-Id: Ib10f127fd68e433992b6b11e62ac2263d790ef52
2016-01-20 11:26:06 -05:00
Jason Monk
8bcbb9bc87 Merge "Add LinearLayout#getGravity" 2016-01-20 15:55:44 +00:00
Jason Monk
efe916c3c7 Add LinearLayout#getGravity
Change-Id: I290790b8e84e14f2702c6fc9c679b1c435cc13a8
2016-01-20 10:55:09 -05:00
Seigo Nonaka
74fb6dc7b1 Merge "Fix material style errors in suggestion popup window." 2016-01-20 07:07:30 +00:00
Seigo Nonaka
3ed1b39f40 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
2016-01-20 13:45:00 +09:00
Alan Viverette
91098574f9 Animate context popup menu around origin point
Also enables the context popup menu enter transition.

Bug: 25801140
Change-Id: Id7fb384e8ac8974189b32a052352bd2f6cbb176e
2016-01-19 14:07:31 -05:00
Yohei Yukawa
ac3e599069 Merge "Introdude IC#deleteSurroundingTextInCodePoints()." 2016-01-18 05:34:26 +00:00
Alan Viverette
a884fbeed9 Merge "Remove delay before performing drop down item click" 2016-01-15 19:04:40 +00:00
Alan Viverette
388eb91c12 Merge "Clean up CalendarView docs and annotations" 2016-01-14 16:17:26 +00:00