Commit Graph

6215 Commits

Author SHA1 Message Date
Yigit Boyar
5ae74b7fa6 Merge "Check if item is selectable before calling on click" into nyc-dev 2016-03-02 00:36:50 +00:00
Yigit Boyar
418d0cf5c9 Check if item is selectable before calling on click
This CL fixes a bug in ListView where it might call onClick on an
un-clickable if a new touch arrives before up timeout.

We could actually consider making child position non-changable
but that will change behavior. This seems safer approach.

Bug: 27198796
Change-Id: I7b15d04efa19d1d760a294bd027f3da3aaa3a445
2016-03-01 16:09:58 -08:00
Alan Viverette
90ed1eca3e Merge "Use Holo date/time picker layouts on very small screens" into nyc-dev 2016-03-01 23:13:43 +00:00
Alan Viverette
6b3f85f87e Use Holo date/time picker layouts on very small screens
If the screen is smaller than "small" then use the Holo picker layouts.
Unifies the SavedState between delegates so that we can seamlessly
transition between them during configuration changes. Pushes the
DatePickerSpinnerDelegate up to the same level as the calendar delegate.

Bug: 27239893
Change-Id: Ida4dc2748d38bd766ae93d12aef15e963921939c
2016-03-01 16:48:04 -05:00
Andreas Gampe
4f655de3de Merge "Frameworks/base: Refactor TextView initialization" into nyc-dev 2016-03-01 18:38:09 +00:00
Jorim Jaggi
8175846ed6 Fix popup window calculation for multi-window
If ignoreBottomDecorations=true, the display size was extracted from
the resources. However, this didn't work if the parent window was in
multi-window, as all the calculations went wrong. Instead, introduce
View.getWindowDisplayFrame which returns the "full" frame of the task
the window is currently in, without any insets, and use that to
calculate the bottom edge.

Bug: 26255254
Change-Id: I8b235b335775022ae399ee082d1200aa76cc047c
2016-03-01 09:00:29 +00:00
Andreas Gampe
ddc1397eba Frameworks/base: Refactor TextView initialization
To allow static initialization of a number of View classes based
on TextView, refactor the initialization of the font cache to be
explicit from the zygote.

Bug: 27265238
Change-Id: I1b71086d3f49d8b3e72eea2bf8359351d25fc0fd
2016-02-29 11:13:01 -08:00
Aurimas Liutikas
7849a3d785 Fix crash when restoring SearchView.
I forgot to include Parcelable.Creator when I added SearchView
iconified state saving.

Bug: 27357167
Change-Id: Ia96490aa9c12c4042f50ba4b1aeb7422b37a1d4c
2016-02-26 15:27:31 -08:00
Selim Cinek
a94742c7f9 Merge "Added convenience methods to use chronometer countdown methods" into nyc-dev 2016-02-26 19:05:04 +00:00
Selim Cinek
81c23aac78 Added convenience methods to use chronometer countdown methods
Bug: 27343480
Change-Id: Iea4d0259ba8c3ab91fec5ee04ea4b39e5dd988bf
2016-02-25 16:23:13 -08:00
Alan Viverette
7970894a9c Revert "Fix exit transition and dismiss callback for popup exit transition"
This reverts most of commit 21d361806c, which
broke too many expectations in both apps and framework widgets. We need to
find a safer way to handle the exit transition callback.

Bug: 27359366
Bug: 27353218
Change-Id: I769ac7a25cb900c50e857839ca0563fbc5a3cb16
2016-02-25 16:57:08 -05:00
Sunny Goyal
c1a3181d8d Merge "Fixing the parent check loop to allow RemoteViewsFrameLayout" into nyc-dev 2016-02-25 18:10:38 +00:00
Sunny Goyal
b880d167a6 Fixing the parent check loop to allow RemoteViewsFrameLayout
Bug: 27328093
Change-Id: I0f6ae8e95f952d40589eafb912ba188d15d7624c
2016-02-25 09:07:37 -08:00
Seigo Nonaka
6d2b3ac67c Merge "Show selection handles at the correct position for view transformation" into nyc-dev 2016-02-25 05:59:19 +00:00
Alan Viverette
5249bd296d Merge "Fix exit transition and dismiss callback for popup exit transition" into nyc-dev 2016-02-24 23:22:21 +00:00
Alan Viverette
21d361806c Fix exit transition and dismiss callback for popup exit transition
We should run the transition only when the anchor root IS attached,
and we should only call the dismiss callback when the animation has
completed and the window has been removed.

Bug: 25323707
Bug: 26647820
Change-Id: I2bcdc901885d4c0a6c48c2b2c949797def1d7512
2016-02-24 15:34:11 -05:00
Adrian Roos
5dd685f24c Fix broken remote inputs
Bug: 22452379
Change-Id: Ibcf0cf23e9f163b37270d42629de01083e12643c
2016-02-24 12:05:51 -08:00
Seigo Nonaka
2f229ca27b 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
2016-02-24 12:56:36 +09:00
Selim Cinek
ed1a33cc86 Made the Chronometer able to count downwards
Bug: 26862188
Change-Id: I3a4a34ffccdbcbcb8001b1894ce47bb75b11821d
2016-02-22 15:56:56 -08:00
Keisuke Kuroyanagi
f2629d481e Merge "Make drag shadow grapheme cluster aware." into nyc-dev 2016-02-22 19:40:13 +00:00
Keisuke Kuroyanagi
5396d7eb13 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
2016-02-22 19:37:26 +00:00
Chris Banes
6cb9b20b7b Fix rounding error in SeekBar tickmark drawing
There are instances where an int calculation would result
in a loss of precision and rounding error. Fixed by
using a float instead.

Change-Id: I595872f00552a7fd717a1754c1d8f5a50d776621
2016-02-22 16:13:26 +00:00
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