644 Commits

Author SHA1 Message Date
Aurimas Liutikas
d9a2a442ee Remove usages of ScrollerCompat after minSdk 14 bump.
ScrollerCompat can be completely replaced by OverScroller that was
added in API14 which ScrollerCompat wraps.

Bug: 32794064
Test: ./gradlew assemble
Change-Id: Ice79dd122b00e1b3c92dea3a95446ac897135a84
PiperOrigin-RevId: 152204128
2017-04-12 17:38:10 -07:00
Aurimas Liutikas
43ec3dd052 Remove usage of MotionEventCompat methods.
We bumped our minSdk to 14 and now most of MotionEventCompat methods and
constants are no longer needed.

Bug: 32794064
Test: ./gradlew assemble assembleAndroidTest
Change-Id: I5fc698fc8243107cd969743b7500163818f8c258
PiperOrigin-RevId: 152201817
2017-04-12 17:37:17 -07:00
Geoffrey Métais
f0b3b462ee Prevent potential NPE
Ignore scroll events if mNestedScrollingChildRef is not set yet.
It happens if BottomSheetBehavior view is inflated from a ViewStub for
example, input events can arrive too soon.

bug: https://code.google.com/p/android/issues/detail?id=232646
Test: nullity check, existing unit tests still pass.
Change-Id: I0535a63ed834d64fcbf20dd8b268d109232c5077
PiperOrigin-RevId: 152195381
2017-04-12 17:36:54 -07:00
Aurimas Liutikas
465ea656d0 Clean up usage of ConfigurationHelper.
Bug: 32794064
Test: ./gradlew assemble
Change-Id: I7b92c5a6d846336c22b893fe228521bed239e337
PiperOrigin-RevId: 152181216
2017-04-12 17:36:41 -07:00
afohrman
b140f8debc Make filters layout more pre-L friendly.
This commit changes the filters layout to use AppCompat's switch, which looks much nicer on pre-L versions. It also moves filters/ to use paddingStart/End to paddingLeft/Right, because that was only added in API level 17.

PiperOrigin-RevId: 152180875
2017-04-12 17:33:46 -07:00
Aurimas Liutikas
70cff08266 Remove usages of methods in VelocityTrackerCompat that got added before API 14.
Bug: 32794064
Test: ./gradlew assemble still works.
Change-Id: Ia805a39aeebce9ff69278836c6dad55218b8b2d5
PiperOrigin-RevId: 152179324
2017-04-12 17:33:31 -07:00
Aurimas Liutikas
0ce16ad50e Update test sizes for all currently @SmallTest.
SmallTests are supposed to complete in <200ms, Medium in <1s, and Large in
<30s.
This CL updates the size of all the SmallTest based on excecution times from
presubmit test runners.

Test: None
Bug: 34854821
Change-Id: Iec73f7b6ef63b27cd3d8b19a8e8c7a9b91ff6729
PiperOrigin-RevId: 152174653
2017-04-12 17:32:48 -07:00
afohrman
48e71e8c6b Fix VectorDrawable bugs in ItemActivity.
This commit fixes two bugs with VectorDrawable that were causing a crash in pre-L devices. One bug was a simple fix: using app:srcCompat instead of android:src for the FAB's icon. The other bug was more complicated, since it involved a VectorDrawable in a compound drawable. To work around the compatibility issues with this, I wrapped the VectorDrawable in a StateListDrawable and enabled AppCompat's ability to set vector drawables from resources.

PiperOrigin-RevId: 152136061
2017-04-12 17:31:46 -07:00
Aurimas Liutikas
8428f09805 Remove ViewCompat method usages for things that were added in API 11.
Bug: 32794064
Test: ./gradlew assemble assembleAndroidTest still works
Change-Id: I18fb0cc1ebc67c911eeb30aada7b8315afc15835
PiperOrigin-RevId: 152030798
2017-04-12 17:31:18 -07:00
dcarlsson
04faaf9a98 Move contributing document to fix broken link.
PiperOrigin-RevId: 152030315
2017-04-12 17:29:07 -07:00
Kassim Maguire
45120e4f07 Use enabled scrolling child in BottomSheetBehavior
Modification of findScrollingChild() that only returns a view if
it has nested scrolling enabled (instead of just implementing
NestedScrollingChild). As to prevent an incorrect view being
referrenced, leading to incorrect behavior when scrolling.

Test: added BottomSheetBehaviorTest.testFindScrollingChildEnabled()
that tests that an enabled NestedScrollView contained within a disabled
NestedScrollView parent is returned by findScrollingChild(parent)
Change-Id: I9841db9c67520f858913a5109dc08ffed9e53568
PiperOrigin-RevId: 151889793
2017-04-12 17:26:05 -07:00
Aurimas Liutikas
eda6419b17 Cleanup FloatingActionButton code to remove unneeded code.
Remove code that is no longer needed since minSdk for support library is API
14.
This code collapses FloatingActionButtonImpl, FloatingActionButtonGingerbread
and FloatingActionButtonIcs into one class.

Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: Id20c0d1807e08ab11ece63883debe2682cfa815f
PiperOrigin-RevId: 151874300
2017-04-12 17:25:18 -07:00
Aurimas Liutikas
9d9d667e46 Simplify ViewGroupUtils code.
We can delete the different pre API 11 implementation since now
minSdk for support library is API 14.

Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: I6ada8869060539b1a5fd7039a343bad766c5aced
PiperOrigin-RevId: 151872595
2017-04-12 17:23:15 -07:00
Aurimas Liutikas
f02b42594b Move to using Transitions directly for BottomNavigationView.
Since our minsdk is now 14 we can use support transitions apis directly
from BottomNavigationView.

Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: Ic9372da05c7ebba59f9a37926ab81f4138f967a2
PiperOrigin-RevId: 151644244
2017-04-12 17:22:50 -07:00
Aurimas Liutikas
d32ba949a8 Move to using ValueAnimator directly instead of compat versions.
ValueAnimator can now be used directly given that our minSdk is 14.

Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: Ibf0111b104eaea10acf33c8d54a3275fdfa0c1a4
PiperOrigin-RevId: 151641145
2017-04-12 17:22:06 -07:00
Aurimas Liutikas
96436e4d8d Bump minSdkVersion to API 14.
First step in moving minSdkVersion to API 14 for design library.

Bug: 32794064
Test: gradlew clean assemble assembleAndroidTest still works
Change-Id: I113834cc6e3c088cdf606a86fe7a35faa192b801
PiperOrigin-RevId: 151608161
2017-04-12 17:21:22 -07:00
Vladislav Kaznacheev
c5a67bc8a7 Pointer icon tests for support library
Expanding BottomNavigationViewTest and
TabLayoutTest to cover pointer icon setting.

Bug: 32178074
Change-Id: I6deab8ed0d702ccb32ab906d91c72c7abb78656d
Test: the affected tests should pass
PiperOrigin-RevId: 151519710
2017-04-12 17:14:12 -07:00
afohrman
5a8554ab40 Fix snackbar text color.
The text was illegible - it was showing up dark blue on a dark grey background. A simple tweak to the way text colors were set in the theme fixed this.

PiperOrigin-RevId: 150932983
2017-04-12 17:13:26 -07:00
afohrman
42fb7311bd Add Shrine demo app to material_components.
This builds on Bazel - Gradle setup to come in a future commit.

PiperOrigin-RevId: 150927644
2017-04-12 17:11:47 -07:00
dcarlsson
8af4d85340 Add additional basic documentation to MDC Android components.
PiperOrigin-RevId: 150830728
2017-04-12 17:08:41 -07:00
travisc
104513acdf Fix another lint error.
This one seems like something the lint tool could infer from the test annotation, but oh well.

PiperOrigin-RevId: 150239380
2017-03-15 14:08:39 -07:00
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
Andrei Stingaceanu
45d961bf72 support:design fix possible flakiness in tests
activity.setTitle(..) run now on UI thread.

Bug: 35273478
Change-Id: I01568cbb50a8b7ad40e450bfaf8bf6b78e965716

PiperOrigin-RevId: 149173220
2017-03-14 17:29:58 -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
b57c6a3a24 Add onClick listener test for FABs
Got a report that OnClickListeners we not working
in 25.1. Wrote this test to confirm that they are
working fine (which they are).

Test: wallah
Change-Id: I684188e1de8389bca9b27c3a2c78de6bc1e2c6b0

PiperOrigin-RevId: 148668701
2017-03-14 17:24:58 -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