15 Commits

Author SHA1 Message Date
travisc
ab2fec6da4 Move lib/src/ to lib/java/, and lib/jvmtests/javatests/ to lib/javatests/.
Bazel is happier if Java/Java test roots are named 'java' and 'javatests', and
this will mean that once we create a BUILD file for
android/support/design/{widget,internal}/ we'll no longer need a custom package
specified in our build (which tends to cause build problems that manifest quite
weirdly). This commit doesn't attempt to refactor the build at all yet, and is
just a pure move.

PiperOrigin-RevId: 178060739
2018-01-11 10:50:18 -05:00
travisc
5d3098956c Update gradle to 4.1 and Android gradle plugin to 3.0.
This changes all our dependencies to use the 3.0-style dep types (api and implementation). Generally it just makes everything api unless known otherwise, but moving to implementation where possible in the future would be desirable.

PiperOrigin-RevId: 177391618
2018-01-11 10:19:47 -05:00
travisc
9a2fde4aa3 Update MDC manifests to target 27.
PiperOrigin-RevId: 177064785
2018-01-03 14:47:15 -05:00
markwei
75dbb6bccc Create compatibility() and project(fromPath()) dep targets for consistent dependencies.
Add missing dependencies.

PiperOrigin-RevId: 172164225
2017-11-14 13:43:18 -05:00
markwei
5edfba0242 BackLayerLayout cleanup.
BackLayerLayout:
- Expanded state is saved and restored via ExpandableWidgetHelper across configuration changes.
- BackLayerLayout and BackLayerSiblingBehavior no longer keep references to each other, minimizing stale state.
- All state changes now go through CoordinatorLayout.dispatchDependentViewsChanged(), mirroring other MDC-Android components like FAB Transformation and dynamic persistent sheet.

BackLayerSiblingBehavior:
- The behavior is now an ExpandableBehavior, mirroring other MDC-Android components like FAB Transformation and dynamic persistent sheet.
- Animates state changes using both position and translation, better separating its semantic meanings:
 - BLL's collapsed size determines the sibling's position, which never changes.
 - BLL's expanded size determines its translation, which is animated.
PiperOrigin-RevId: 171064071
2017-11-13 14:19:07 -05:00
miguely
289ccd7577 Add explicit exclusions to "**/build/**" in gradle files.
Since our source roots are the project's root directory, generated output falls inside it, unless properly excluded, all intermediate output such as R classes gets recompiled with each gradle pass.

This causes failures because of duplicate R classes.

PiperOrigin-RevId: 169588457
2017-09-21 16:13:59 -04:00
miguely
713ac062ad Update Gradle build to fit our new code structure.
We have subprojects of :lib: because our internal builds are bazel-based. Gradle does not support more than one project at any level with the same name, which is a staple of bazel-based builds, so gradle projects have to be renamed in runtime to include their whole path (see settings.gradle).

Furthermore since every node includes the path up until that node in its name, writing dependencies can get tedious, for this purpose there is a new method in build.gradle called getTransformedProjectPath which takes /-separated project path and turns it into the correct project path, after the rename.

This also updates versions for TargetSdk and SupportLibrary to 26, which is required by the newer code.

PiperOrigin-RevId: 169457686
2017-09-21 15:09:52 -04:00
miguely
b352fa92f8 BackLayer: Make Sibling Behavior listen to changes inside the BackLayerLayout (views changing size or relayout) to react automatically to changes in content.
Before, if there was any change to the layout inside BackLayerLayout while the back layer was already expanded, the developer had to manually call setExpanded(true) for it to animate to the new size.

Now, the behavior reacts automatically and animates the size change on its own, simplifying the code path and allowing more flexibility.

PiperOrigin-RevId: 165175310
2017-09-21 14:31:01 -04:00
Alan Viverette
d16cead6c8 Remove unnecessary casts on calls to findViewById
Bug: 24137209
Test: make -j32
Change-Id: I04084b2d05ddd7afaa160a76efe0b0d0c8eb5f00
PiperOrigin-RevId: 165042386
2017-09-21 14:30:28 -04:00
miguely
4ef1f94011 Backlayer: Keep the value of expanded across activity restarts and config changes using onSaveInstanceState and onRestoreInstanceState.
This CL also changes the API from a explicit expand()/collapse() method duo to a single setExpanded(boolean) to match other expandable widgets in MDC, for consistency.

This is a breaking change but there has been no release of MDC that contains BackLayerLayout in a usable state, so this is the right time to do this kind of change.

PiperOrigin-RevId: 164664813
2017-09-21 14:22:28 -04:00
miguely
2d618793dd Adds support for more than one expanded state for the BackLayerLayout.
The content for the backlayer should be able to change in runtime to allow for multiple experiences in the backlayer. Furthermore, changing to a different experience should not imply collapsing and re-expanding the backlayer, it should happen in-place with the content layer sliding to accommodate the size of the new content.

If expand is called when the backlayer is already expanded then the backlayer
animates a possible size change.

If there is no need to change the size then the duration for the animation is
zero.

On the side, this changes BackLayer to be a LinearLayout.

PiperOrigin-RevId: 162277051
2017-09-21 12:00:21 -04:00
miguely
9acb393c41 Move BackLayerLayout to use LinearLayout instead of RelativeLayout.
In previous code reviews there was a concern over the performance hit of
RelativeLayout's double measurement, and BackLayerLayout's own double measurement.

As a compromise we chose to use LinearLayout instead. Furthermore after
switching to LinearLayout, the EndBackLayerLayoutTest works, so this commit
also commits that new test.

PiperOrigin-RevId: 161720799
2017-09-21 11:31:30 -04:00
miguely
025f75b4cf Generalizes all test logic to abstract the position of the BackLayer.
Adds concrete tests for Start, Top and Bottom backlayers.

Note: EndBackLayerLayoutTest has not been added in this CL because it is
failing over layout issues. These issues are not related directly to the core
functionality of the BackLayerLayout, but it still has to be fixed. Punting
this to a separate CL.
PiperOrigin-RevId: 161667143
2017-09-21 11:29:43 -04:00
miguely
fb9092098a Add the ability to hide and expose the Back Layer.
-The exposure and hide actions are animated, and have before/after callbacks.
-Clicks on the content layer when the backlayer is exposed are hijacked to close the back layer.
-The animations do not relayout, by simply sliding the boundaries (bottom/left/right/top).

PiperOrigin-RevId: 160315361
2017-09-21 11:25:14 -04: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