93 Commits

Author SHA1 Message Date
travisc
84e5eb6527 Fix lint error that was breaking the build on Travis.
PiperOrigin-RevId: 150213396
2017-03-15 11:07:39 -07:00
travisc
1f58c9f2c3 Bump version to 25.3.0.
PiperOrigin-RevId: 150135802
2017-03-14 17:35:07 -07:00
Aurimas Liutikas
ce8442831d Fix BottomNavigationView label animation.
In ag/1820194 we broke this by moving beginDelayedTransition to after
the layout params and scale are set causing it to no longer animate
the text label.

Bug: 36074994
Test: Unable to come up with good automated test. Tested manually - text labels no longer jump
Change-Id: I6bcc988dfd8b2b38360c68fdb6634fcb60c00a2f

PiperOrigin-RevId: 150134808
2017-03-14 17:34:54 -07:00
travisc
395a258bc7 Bump version to 25.2.0.
PiperOrigin-RevId: 150132393
2017-03-14 17:34:29 -07:00
Kirill Grouchnikov
5d84aba7fc Remove unnecessary null check
If that variable is null, it would crash in the previous line

Bug: 34129526
Test: run a few design lib tests
Change-Id: Ic403d4ccf79899f4d2978856fbb02ffc65de0f3f

PiperOrigin-RevId: 150132347
2017-03-14 17:34:18 -07:00
Jonathan Koren
3bd7fdf7c1 Make bottom navigation item pool non-static
This also fixes a flaky test where items acquired from the pool were
still attached to their old parent.

Bug: 35422793
Bug: 35395583
Change-Id: I303d49bb4a287856baf997bd85d42fd53131c32b

PiperOrigin-RevId: 150129729
2017-03-14 17:34:06 -07:00
Yuichi Araki
ddcda55a30 Fix restore of actionView state in NavigationView
NavigationView was crashing on restoring its states when an action view
outside the screen gets inside the screen by screen orientation change
or similar.

Test: NavigationViewTest#testActionViewState
Bug: 34796332
Change-Id: Id2c150fce4d6cc4695c50d57523243975c4f2ef0

PiperOrigin-RevId: 150128785
2017-03-14 17:33:48 -07:00
Jonathan Koren
6cbee8658b Add item reselected listener to BottomNavigationView
Adds an additional listener in for developers that want to discern
between item selection and reselection without tracking the current
selection. This maintains backward compatibility with existing uses
of OnNavigationItemSelectedListener by itself in client code; new
behavior is only observed if an OnNavigationItemReselectedListener is
added.

Bug: 34576220
Test: Modified tests in BottomNavigationViewTest, Updated support-design-demos
Change-Id: Id48cde6395dd73a01ce68e3be1783161229f8939

PiperOrigin-RevId: 150119002
2017-03-14 17:33:32 -07:00
Jonathan Koren
98e5ed2e43 Add setSelectedItemId() to BottomNavigationView
Also fixes a bug where programmatic selection of an item (previously
by calling setChecked(true) on a menu item) does not invoke the
OnNavigationItemSelectedListener and does not animate properly.

Bug: 34627065
Bug: 33002556
Test: Added new tests in BottomNavigationViewTest
Change-Id: I2acbacaedb6cf7a05135ba90137f939b690190da

PiperOrigin-RevId: 150107208
2017-03-14 17:33:14 -07:00
Chris Banes
e11302bda7 Fix Snackbar touch handling
This fixes the issue where the timeout is
not restored when the user swipes up
from the Snackbar.

Test: included (and passing)
BUG: 33931084
Change-Id: I2a10936bed97c0344cc3dac66b908e2733f2ffa0

PiperOrigin-RevId: 149605717
2017-03-14 17:32:29 -07:00
Jonathan Koren
9e2c201185 Fix BottomNavigationView not saving state
Bug: 32995862
Test: Added new test to BottomNavigationViewTest
Change-Id: Id66e262e8264c2d09c01580f4f0055d026300684

PiperOrigin-RevId: 149586534
2017-03-14 17:32:12 -07:00
Jonathan Koren
5ec569f17e Fix TabLayout#setScrollPosition() in RTL
Also includes Ib494e97ee482f6b221ad957518af8b4885e88d89, as the added
test fails pre-M otherwise.

Bug: 34686900
Test: Added new test in TabLayoutTest
Change-Id: I2bdee71d55e8b68377124fc4d8a7b94a01a567ba

PiperOrigin-RevId: 149492933
2017-03-14 17:31:48 -07:00
Jonathan Koren
a566dfbbab Add content descriptions to BottomNavigationItemView
Bug: 33896023
Change-Id: I4673925aeacf3ad499ea317016e3e60f2c21b689

PiperOrigin-RevId: 149473206
2017-03-14 17:31:32 -07:00
Yuichi Araki
871b4d139b Fix BottomSheetDialog after swiping it down
BottomSheetDialog now collapses the bottom sheet when it is shown,
making it possible to use the same instance more than once after user
swipes it down.

Test: BottomSheetDialogTest#testHideThenShow on 15, 18, 19, and 25
Bug: 34214747
Change-Id: I464625eadb41cf42fdaacafe12e32324c21903cb

PiperOrigin-RevId: 149463377
2017-03-14 17:31:13 -07:00
Chris Banes
d5f104f1c8 Fix scroll|enterAlways when we have a top inset
Currently AppBarLayout scrolls too far. This
CL fixes that.

Test: included
BUG: 33934454
Change-Id: Id835c255dddef3ce4fdedd5a4e18a7bd493c5f9a

PiperOrigin-RevId: 149335184
2017-03-14 17:30:49 -07:00
Yuichi Araki
2cf31d94d3 Fix gravity handling in CoordinatorLayout
When a child without behavior or anchor has only one axis specified as
its layout_gravity, CoL was centering the child for the other axis.

Bug: 33655774
Test: CoordinatorLayoutTest#testLayoutChildren on 9, 15, 19, 25
Change-Id: Ie56afa62491251b01355b269c9f4c0d79658da4d

PiperOrigin-RevId: 149329258
2017-03-14 17:30:18 -07:00
Chris Banes
7a641a2fec Fix some issues caught via a static analyzer
I concentrated on the resource leaks rather than
any possible null dereferences.

Test: all pass
Change-Id: I2eab70648068058111b6dc82ba7494a1ff0ecb32

PiperOrigin-RevId: 149157552
2017-03-14 17:29:10 -07:00
Kirill Grouchnikov
b906d347b3 Remeasure snackbar inner layout if it's MATCH_PARENT in width
Test: all the tests pass, also visual inspection on tablets
Bug: 34186126
Change-Id: I135136563647261cd842e1aec2ae9b78e1ca6901

PiperOrigin-RevId: 149146388
2017-03-14 17:28:54 -07:00
Chris Banes
8dc79e22e4 Stop nested scolling calling onDependentViewChanged
onDependentViewChanged() should only be called if
the dependent view has moved or changed size.
Theres currently a code path where the method
can be called if a nested scroll is in progress.
This CL fixes it by gating the movement bounds
check more widely.

Test: included
BUG: 33655283
Change-Id: I06d34147c4ff6136168b1cfd6568a6fce336566e

PiperOrigin-RevId: 149068329
2017-03-14 17:28:36 -07:00
Chris Banes
e55660a78f Fix AppBarLayout elevation jump on API 21-23
Since we use a SLA now to control elevation
changes, we've hit the issue where draw dispatching
is skipped before the Activity transition finishes
on API 21-23 devices.

This results in the SLA running, but visually you see a
jump in elevation after the activity animation has
finished (and draw commences).  To combat this, we now
jump the elevation change in layout.

Test: manual (impossible to automate it)
BUG: 29598367
Change-Id: Ia4f1c2168d363297b7e94ca9f4a0113e4f8ab271

PiperOrigin-RevId: 148950143
2017-03-14 17:28:19 -07:00
travisc
15f9ce0dd3 Rolling AppBarLayout fixes forward, since the test breakage is now fixed.
PiperOrigin-RevId: 148942854
2017-03-14 17:27:49 -07:00
Chris Banes
db70ec1e76 Rolling back for test breakage.
PiperOrigin-RevId: 148722460
2017-03-14 17:27:23 -07:00
Chris Banes
3fe5df16e1 Fix various AppBarLayout restoration bugs
- Not restoring elevation
- Not restoring on min-height with status bar insets
- Not restoring when expanded="true" set in layout

Test: included
BUG: 33471543
BUG: 33510949
BUG: 33511540
Change-Id: I43b2afeaf1c2cebf0a87045314830064554e2c5d

PiperOrigin-RevId: 148701728
2017-03-14 17:26:55 -07:00
Yuichi Araki
3969d48119 Fix BottomSheetBehavior settling state
BottomSheetBehavior#checkSetState was stuck in settling state if the
peek height is as tall as the expanded state.

Test: BottomSheetBehaviorTest#testExpandedPeekHeight
Bug: 31756143
Change-Id: I6e3c4145d545d799b028e5f4fb0ff205f4ec1d0f

PiperOrigin-RevId: 148686097
2017-03-14 17:26:35 -07:00
Kirill Grouchnikov
b41237f33a Extend offsetTopBottom vs setTranslationY to KK platform as well
Bug: 32439902
Test: CoordinatorSnackbarWithFabTest
Change-Id: Iebd264d2dc97c7c1add4dc5ee80a02938b259e6c

PiperOrigin-RevId: 148678470
2017-03-14 17:26:16 -07:00
Chris Banes
f43a6d3325 Remove deprecated isDirty method
It was deprecated in 24.1.0 so it is long
due to be removed.

Test: compiled
BUG: 30110671
Change-Id: I95ca0cb691fd78fc7cca1ff65079f2a964f94e46

PiperOrigin-RevId: 148491907
2017-03-14 17:23:53 -07:00
Alan Viverette
9a5306030d Remove unnecessary @TargetApi annotations
Bug: 33412815
Test: ./gradlew assemble
Change-Id: I0be3358fb97d6e637357c253f3f43f39355a643a

PiperOrigin-RevId: 148415249
2017-03-14 17:23:30 -07:00
Yuichi Araki
dd60249ea2 Fix Talkback on BottomSheetDialog
The bottom sheet is no longer marked as clickable.

Bug: 32548431
Test: BottomSheetDialogTest#testTouchInside, #testClickContent
Change-Id: I0870ae90f6f51fd705486f715d7e8e6e970998da

PiperOrigin-RevId: 148385873
2017-03-14 17:23:13 -07:00
Kirill Grouchnikov
b072533890 Use a different API to slide snackbars on JB
Working around what appears to be a platform flakiness
with setTranslationY

Test: ./gradlew support-design:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.SnackbarTestWithFAB
Bug: 32439902
Change-Id: Icde0f4ccac57421a158d2b4818654109a5fca6ba

PiperOrigin-RevId: 148373985
2017-03-14 17:22:53 -07:00
Kirill Grouchnikov
39daf4d002 Switch Snackbar slides to ValueAnimatorCompat.
Bug: 32439902
Test: ./gradlew support-design:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.SnackbarTestWithFAB
Change-Id: I1f56ed7a8ac565ff2a016682d315b2f2cbe3bdf2

PiperOrigin-RevId: 148297053
2017-03-14 17:22:37 -07:00
travisc
f1ed6419aa Add a pass-through #isShown method to Snackbar to make migration to 25.1.x easier.
PiperOrigin-RevId: 147746271
2017-03-14 17:21:59 -07:00
travisc
b2c6ef9111 Add a pass-through #dismiss method to Snackbar to make migration to 25.1.x easier.
PiperOrigin-RevId: 147744350
2017-03-14 17:21:48 -07:00
travisc
a1eccfbbb5 Add a pass-through #show method to Snackbar to make migration to 25.1.x easier.
PiperOrigin-RevId: 147381726
2017-03-14 17:21:21 -07:00
travisc
557633e6f3 Move back to GROUP_ID restriction temporarily to allow building against older
versions of the support libraries.

PiperOrigin-RevId: 147117547
2017-03-14 17:20:52 -07:00
Tenghui Zhu
b31e69875a Mark path as non translatable
Test: Newly added test and sample app for the original repro step.

AOSP bug: https://code.google.com/p/android/issues/detail?id=232407
Bug: 34767250
Change-Id: Ia216bf1177a55a139f8988d995836c1d42c496ee

PiperOrigin-RevId: 147116504
2017-03-14 17:20:10 -07:00
Alan Viverette
8b7af4099b Fix TextInputLayout's hint not expanding
Happens when the EditText is populated with
text from the layout, etc. Caused by some
state being set wrong in the constructor,
which makes the proceeding state update
no-op, since it thinks it is already in the
state.

BUG: 33585556
Test: included
Change-Id: I34c6e9aca3c41f864974ad32fcdbb6dc829645b8

PiperOrigin-RevId: 147067802
2017-02-09 17:32:24 -08:00
Aurimas Liutikas
b66b8c7785 Fix BottomNavigationView example to use AAPT1 style.
Many of support library users are still not using AAPT2 so
switch to use res-auto and app namespace for the example snippet.

Bug: 34690787
Test: None
Change-Id: I677cab381cc52803fcb9a5b6bb7a630ec8469a0d

PiperOrigin-RevId: 146978916
2017-02-08 17:31:41 -08:00
travisc
69a70219ad Restructure emulator tests for better bazel support.
Bazel wants a structure where the application used for testing and the tests themselves are in separate packages (which gradle is less picky about). Android has a gradle plugin for this setup (com.android.test), although it unfortunately has seemingly worse Android Studio support at this point. In any case, this change splits the code up a bit more, into 3 parts:

- lib: the files we actually distribute as a library to end users
- testing: the test application and its custom component subclasses that are tested by the emulator tests
- tests: the actual emulator test code

The structure is a tad strange for typical gradle projects (testing in particular, which has a build.gradle file for each individual Java package, at the same level as the actual source files), but it better matches the conventions of bazel while also avoiding the need for a ton of parallel directory structures at the top level.

Known issues as of this commit:
- Android Studio doesn't think the Java files in testing/ have the right package. I tried to fix this by bumping their java srcDir up to the java/ root and changing the includes, but Android studio seems unable to properly figure that out and instead acted like the Java files didn't exist at all, so I reverted that. We can possibly modify the iml files that get generated, but I'll save this for a follow-up commit since this is already very large.

- Android Studio seems unable to run emulator tests properly (but they work from the command-line). I don't quite know why they fail, but seems like lacking support for the com.android.test plugin. Hopefully this is something we can work around for find a fix for in the near future.

PiperOrigin-RevId: 146940681
2017-02-08 12:53:34 -08:00
travisc
9159128f9f Reorganize JVM tests for better multi-build-system support.
PiperOrigin-RevId: 145335578
2017-02-08 12:47:39 -08:00
travisc
9ba7c6c5fc Fix password toggle taking FOCUS_DOWN events
Pressing the TAB key sends a FOCUS_DOWN event, and
now that the EditText floats in the center, the
password toggle is actually the next vertically top focusable
view.

This CL fixes it by ensuring that the EditText has the same
min-height as the password toggle, thus making the EditText
the next focusable view.

BUG: 33771077
Test: included
Change-Id: I18f5a7e419fa6ae2b13d4081e6f3e369b67ccdbe

PiperOrigin-RevId: 144259419
2017-01-18 18:11:11 -08:00
travisc
47d28d6155 Fix a crash in clearing BottomNavigationView menu.
Bug: 33682012
Test: added BottomNavigationViewTest#testClearingMenu
Change-Id: Ib5b424784b3d2610d0bfce48be8832f0ea5cd1cc

PiperOrigin-RevId: 144243704
2017-01-18 18:08:57 -08:00
travisc
9970698e3b Fix BottomNavigationView label placement.
Use the baseline of the labels for positioning them. Previously
it was 8dp from the bottom of the view, now it is 10dp from the baseline
of the text. This makes it follow the spec for this widget.

Bug: 33794750
Test: no test, visual change
Change-Id: Iaf6534937ee5d66651c1e04d805fd7bcab3ea44c

PiperOrigin-RevId: 144145280
2017-01-18 17:57:08 -08:00
travisc
3e60e9c114 Fix Design test on TV
The test made wrong assumption of hasSystemWindowInsets
Bug: 30757891
Test: NavigationViewTest

Change-Id: I8bd4c5c578b9882699cadda098fe64f86caab887

PiperOrigin-RevId: 144144731
2017-01-18 17:56:36 -08:00
travisc
ed279941b4 Reformat all Java files to match Google style.
This change was generated with an automated tool, and should be a no-op.

PiperOrigin-RevId: 142082461
2016-12-14 17:00:32 -08:00
travisc
69249f5e51 [BUILD] Fix gradle build for 25.1.0 code.
Updates support library versions and pulls in the proper deps for the library
and its tests. Also fixes the formatting in the subproject gradle files to
match the rest of the repo.

PiperOrigin-RevId: 142079035
2016-12-14 16:56:22 -08:00
Chris Banes
992ac23449 Merge "Fix CollapsingToolbarLayout scrim not being drawn" into nyc-support-25.1-dev
GitOrigin-RevId=9e34c75622e53a85a686a8d457e9b648633e67da

PiperOrigin-RevId: 141514714
2016-12-12 16:04:58 -08:00
Chris Banes
5b2c3bcc02 Merge "Move CoordinatorLayout to use a pool for temp Rects" into nyc-support-25.1-dev
GitOrigin-RevId=0b64d3f72fc638f84dd2142d48f0e232fd278042

PiperOrigin-RevId: 141514528
2016-12-12 16:04:54 -08:00
Chris Banes
ba810a0ef5 Merge "Document Behavior handling of touch events" into nyc-support-25.1-dev
GitOrigin-RevId=ac12f4a608837cf1cb2a7a01f1ed8753bb9b3674

PiperOrigin-RevId: 141514409
2016-12-12 16:04:49 -08:00
Chris Banes
7d72764e2b resolve merge conflicts of c88a088 to nyc-support-25.1-dev
Change-Id: I22b9f7cfe49e76b97803a7f22b7408282a3ad867

GitOrigin-RevId=b2a5b5286d801081c28e6a76ff143ac1c5448f87

PiperOrigin-RevId: 141514269
2016-12-12 16:04:45 -08:00
Andrei Stingaceanu
24b2fc718a Support design - fix FAB elevation in API 21
The animations are really broken here. A hacky fix
has been added in the past for versions 22-24 and now
for version 21 just by bluntly set the elevation and
translationZ by respecting the logic in the animations
for 22-24.

Bug: 33126409
Test: identified this bug from an existing test.
Change-Id: I0cba73cda030ef7a66ffad452bc0f14b7687fc52

GitOrigin-RevId=829c95c8a3fd508b798bedff028d7d6b55e16ce5

PiperOrigin-RevId: 141514172
2016-12-12 16:04:41 -08:00