120 Commits

Author SHA1 Message Date
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
Chet Haase
d2a1943f2c Merge "Revert "Set background on correct view"" into nyc-mr1-dev
GitOrigin-RevId=0000262ec628f37c6c662af12e4269b5befc5b54

PiperOrigin-RevId: 140564734
2016-12-12 16:00:18 -08:00
Alan Viverette
efd99424f9 Merge "Set background on correct view" into nyc-mr1-dev
GitOrigin-RevId=1525e4e3778248830dee5febd7e4eafd8850e79a

PiperOrigin-RevId: 140564729
2016-12-12 16:00:14 -08:00
Yuichi Araki
cb27739272 Merge "BottomSheetDialog is canceled when swiped down" into nyc-mr1-dev
GitOrigin-RevId=845f379018d1017a4a34cdf4ecb192e1978d74e9

PiperOrigin-RevId: 140564690
2016-12-12 16:00:09 -08:00
Chris Banes
efa90ae177 Fix TextInputLayout regressions
am: 46c7710bb8

Change-Id: Id3c713f4aba70527d83b570b055dffd792bd4a21

GitOrigin-RevId=eabc8679777cd73c397f12707bdeb1de41c521c1

PiperOrigin-RevId: 140564629
2016-12-12 15:59:45 -08:00
Yuichi Araki
7a4fc0e548 BottomSheet slideOffset when peekHeight is auto
am: e9864e3df0

Change-Id: Ibf467f85431ce82406be0ab4772392f20a1012e3

GitOrigin-RevId=4878d70139b883f55a6be288d7d930c6068c0977

PiperOrigin-RevId: 140564611
2016-12-12 15:59:41 -08:00
Aurimas Liutikas
99e5e26453 Merge "Fix BottomNavigationViewTest." into nyc-mr1-dev
GitOrigin-RevId=d22aec00a5005d150e1f9015ed1f40d757d47281

PiperOrigin-RevId: 140564555
2016-12-12 15:59:25 -08:00
Chris Banes
ee5bc393c9 Fix CollapsingToolbarLayout not consuming insets
am: 40c8b62219

Change-Id: I07ff1bcf166693ba43948fd4281729169be9ff5b

GitOrigin-RevId=cc016a74d8ed4ebd67fe5d231be78777ad4f3bf6

PiperOrigin-RevId: 140564542
2016-12-12 15:59:16 -08:00
Yuichi Araki
41ef4d7e2e Fix ViewDragHelper usage in BottomSheetBehavior
am: 6cb44089e8

Change-Id: I6fa108e94b7bb0130d06cdae27a1ce1d68faa490

GitOrigin-RevId=af80a686f277f5c59c99104a35b5fd3139b6931f

PiperOrigin-RevId: 140564539
2016-12-12 15:59:12 -08:00
TreeHugger Robot
a7b5da56b2 Merge "Fix IOOBE due to internal list being updated from remove" into nyc-mr1-dev
GitOrigin-RevId=b8fdfafda9aa5a5d5cdbcce8dcf7e208477e8b2c

PiperOrigin-RevId: 140564475
2016-12-12 15:58:45 -08:00
TreeHugger Robot
2e3edd249e Merge "Annotate more support lib tests with size annotations." into nyc-mr1-dev
GitOrigin-RevId=7fb37f6d8dc8eb41b98811d878181d7c31d78670

PiperOrigin-RevId: 140564469
2016-12-12 15:58:41 -08:00
Aurimas Liutikas
b6027cd01c Stop sending OnTabSelectedListener calls with null tabs.
am: 32ae746bb6

Change-Id: I9ea902716d16c400eed624f8f531e79e0c018dd3

GitOrigin-RevId=0dcaf948ec9b788f47038876c4b8ff799df79dc6

PiperOrigin-RevId: 140564462
2016-12-12 15:58:37 -08:00
Aurimas Liutikas
451ce2d51a Merge "Fix BottomSheetBehaviorTest" into nyc-mr1-dev
GitOrigin-RevId=f773b66be4375fece7d76287e68d832946fdf8e1

PiperOrigin-RevId: 140564451
2016-12-12 15:58:33 -08:00
Chris Banes
58eefa7aa5 Speculative fix for exception in CoordinatorLayout.onLayout
am: 3c9fb156e6

Change-Id: Ifc56967ad6295722b099a358cb48245a24981061

GitOrigin-RevId=af56b22da2c5537d68b8c1446f72c2526cd08133

PiperOrigin-RevId: 140564447
2016-12-12 15:58:29 -08:00
Chris Banes
7ae0f4523b Fix CollapsingToolbarLayout tests
am: b539fd5711

Change-Id: Ida0b5a86948aaac6d010660275c4bd6a45d380db

GitOrigin-RevId=61b3959efb64d18358645762023abf36cec2cc53

PiperOrigin-RevId: 140564437
2016-12-12 15:58:25 -08:00
Chris Banes
93d1987738 AppBarLayout + CollapsingToolbarLayout tests fixes
am: bb3740d273

Change-Id: Idf315788b60e3536563591715ff10570808d113b

GitOrigin-RevId=6dcd2f07828798bf84b1b9486a03d9ac271bf20f

PiperOrigin-RevId: 140564398
2016-12-12 15:58:13 -08:00
Chris Banes
0240f57b2c Merge \"Fix FloatingActionButtonTest build\" into nyc-support-24.1-dev
am: 102798cbda

Change-Id: I6db667ddcbb604a1a9f19327e249d6e015473fba

GitOrigin-RevId=42ccf61b5cc2f01938ac7a37b44fb51825d3c44d

PiperOrigin-RevId: 140564086
2016-12-12 15:57:20 -08:00