136 Commits

Author SHA1 Message Date
gauthams
9ea1918ef8 Update BottomNavigationViewTest to cover shifting mode cases
PiperOrigin-RevId: 157039884
2017-05-24 16:37:23 -07:00
miguely
644139fb99 Add a BackLayerLayout and BackLayerSiblingBehavior + tests.
These are the foundation for the back layer functionality. The behavior
does the heavy lifting to measure the adjacent content view.

As of now this only lays out the views correctly in the hidden state, it doesn't support exposing the back layer at all, yet. Full of TODOs, this is just a skeleton.

PiperOrigin-RevId: 156334640
2017-05-24 16:33:21 -07:00
gauthams
d15d791fb7 Fix NPE on bottom nav menu update, and add test for this case.
PiperOrigin-RevId: 155776319
2017-05-11 13:00:34 -07:00
gauthams
5c9ac9798b Suppress flaky AppBarLayout tests on API 15
PiperOrigin-RevId: 155236892
2017-05-05 16:42:16 -07:00
gauthams
0d29fa6a89 Add default scrolling behavior to BottomNavigationView
PiperOrigin-RevId: 155029168
2017-05-05 16:38:46 -07:00
travisc
838d1c2d6e Fix various problems preventing MDC from building with gradle.
- AppBarWithCollapsingToolbarStateRestoreTest needed a variable used inside a closure to be marked as final (No idea why Bazel was okay with this)
- BottomNavigationViewTest/TabLayoutTest needed TargetApi annotations for tests that run on N+
- Every Shrine build.gradle file needs to specify values for Java includes and srcDirs, regardless of whether they contain Java. If they don't they get the default library values (which includes every subdirectory recursively), and result in duplicate classes being generated.
- Various styles.xml files in Shrine were using attributes only available in v17 or v21+

This also updates the main build.gradle file to print lint errors on stdout, so they're easier to look at in TravisCI.

PiperOrigin-RevId: 153389041
2017-04-17 14:52:28 -07:00
Chris Banes
c1506d4568 Fix CollapsingToolbarLayout height when wrap_content
If there is a top window inset we need to make sure
that we expand our height to allow the Toolbar
to be offset.

BUG: 36126318
Test: included
Change-Id: I179fc6764166d80d92a8a995c93d54650365c2bf
PiperOrigin-RevId: 152452065
2017-04-12 17:43:05 -07:00
Aurimas Liutikas
1985a0c0dd Use PollingCheck instead of sleep in AppBarWithCollapsingToolbarTest.
Bug: 30701044
Test: I was unable to repro this locally, but this should fix the flakiness
Change-Id: I58b143c5aeec13941b28bac6136f28215a8efbab
PiperOrigin-RevId: 152432632
2017-04-12 17:41:30 -07:00
Aurimas Liutikas
04adec8ed3 Unflake AppBar tests
AppBarWithCollapsingToolbarStateRestoreTest has been rotating the activity
without rotating it back causing tests that follow it to flake due to
unexpected
orientation change back to original orientation.

Bug: 36130096
Test: Test still passes locally
Change-Id: I642a72d8a90ae5c16df4ef3710a4fd3057bd3043
PiperOrigin-RevId: 152411001
2017-04-12 17:40:05 -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
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
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
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
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
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
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
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
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
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
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
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
c2894bfee5 Notify ViewPager on data set change in the same UI event
Otherwise the tests are flaky.

Test: run TabLayoutWithViewPagerTest
Bug: 32777434
Change-Id: I89df311b2d20b4e4e30f8b85db997cace50f3f99

PiperOrigin-RevId: 148288601
2017-03-14 17:22:14 -07:00
Tenghui Zhu
c82b5dd94b Mark mediumTest for TextInputLayout's test
Test: both TextInputLayout*Test
Bug: 34767250
Change-Id: I56a8f3ecb1dc2e77d4e9f5ebe02e866093db0cff

PiperOrigin-RevId: 147117094
2017-03-14 17:20:37 -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
travisc
487e9edac9 Fix lint errors in CoordinatorLayoutTest.
PiperOrigin-RevId: 146954123
2017-02-08 14:08:38 -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
5effa7d71f Add gradle wrapper and associated files, restructure top-level directories.
This new structure will allow for a top-level gradle file and a multi-project
build (which is a more typical structure for things). In the future, it will
allow us to place other projects in here as well (such as sample applications).

PiperOrigin-RevId: 141247594
2016-12-12 16:01:26 -08:00
Aurimas Liutikas
f00553a3e8 Merge "Fix BottomNavigationMenu item selection via Menu object" into nyc-mr1-dev
GitOrigin-RevId=c6885cd26f144d3ce2cab889b220bff158b5becb

PiperOrigin-RevId: 140564835
2016-12-12 16:01:08 -08:00
Chris Banes
60952ee9d7 Merge "Stop measure/layout on GONE views in CoordinatorLayout" into nyc-mr1-dev
GitOrigin-RevId=a00197715ad65c1afdaf407aaf18e9e550adb1cc

PiperOrigin-RevId: 140564828
2016-12-12 16:01:02 -08:00
TreeHugger Robot
b5d357b847 Merge "Fix TextInputLayout hint not working in extract mode" into nyc-mr1-dev
GitOrigin-RevId=b8d98f1a52faedf56f1ee5613689fb6d4f2edd9c

PiperOrigin-RevId: 140564817
2016-12-12 16:00:58 -08:00
Chris Banes
82e6d8ac77 Merge "Preserve left+right compound drawables" into nyc-mr1-dev
GitOrigin-RevId=a58ff1dd874d8dddf2385ccdcb98c522ff591b14

PiperOrigin-RevId: 140564806
2016-12-12 16:00:54 -08:00
Aurimas Liutikas
31befb564d Merge "Fix crash when adding items to BottomNavigationView." into nyc-mr1-dev
GitOrigin-RevId=9ea1de1d830db6a174e6495665bd0943d1a0f8f4

PiperOrigin-RevId: 140564788
2016-12-12 16:00:42 -08:00
Aurimas Liutikas
7df86b4ca6 Merge changes Id091acf5,Ie27b07ae,I701a2582,I32122d77 into nyc-mr1-dev
* changes:
  Start using return value of OnNavigationItemSelectedListener.
  Clean up BottomBar docs
  Force BottomNavigationView item labels to be singleLine.
  Clean-up BottomNavigationMenuView#onMeasure and other style fixes.

GitOrigin-RevId=c4037564222e361cb92bbc05a062f8da91be5f5f

PiperOrigin-RevId: 140564780
2016-12-12 16:00:38 -08:00
Alan Viverette
94e2756ddc Merge "Fix CoordinatorLayout IllegalArgumentException crash" into nyc-mr1-dev
GitOrigin-RevId=76f4c18e25fdad211d81463dd9fb4586d7cc66a0

PiperOrigin-RevId: 140564755
2016-12-12 16:00:34 -08:00
Yuichi Araki
ee19b1c15f Merge "Fix setWillNotDraw in ScrimInsetsFrameLayout" into nyc-mr1-dev
GitOrigin-RevId=0a67f0ce0df8b1e2c60f23c00f6f5da954db144e

PiperOrigin-RevId: 140564742
2016-12-12 16:00:26 -08:00
TreeHugger Robot
963ed8c2d1 Merge "Set background on correct view" into nyc-mr1-dev
GitOrigin-RevId=bbbe658ea43455e5530d717dbde38716705075be

PiperOrigin-RevId: 140564738
2016-12-12 16:00:22 -08:00