140 Commits

Author SHA1 Message Date
markwei
35261ca224 Rename base Chip style Base.Widget.MaterialComponents.Chip.
PiperOrigin-RevId: 183026249
2018-01-25 18:21:57 -05:00
Material Design Team
6404d1badf Fix RTL outBounds on material chip
PiperOrigin-RevId: 182831674
2018-01-25 18:17:04 -05:00
travisc
04bf0a7c42 Move themes into theme package, invert dependency structures around components.
Previously [most of] the components were either in `widget` or depended on it,
and all theme-related resources (attributes, styles, etc.) were placed there.
This structure doesn't really work for our goals, and makes it harder to split
components by functional area. In this commit, I move all the theme definitions
to `theme` (as well as `dialog` and `bottomsheet` since they also have relevant
themes, and splitting them into separate packages is the only way to make the
dep tree non-circular). Component packages declare their own theme attributes
(e.g. `chip` declares all the theme attributes necessary for chips), as well as
styles, colors, dimens, drawables, etc.

This move isn't entirely complete in this commit, but it is enough to get
things building with this setup. I'll move the rest of the components' resources
in follow-up commits.

PiperOrigin-RevId: 182611275
2018-01-25 18:12:31 -05:00
gauthams
d0431c72df Add unbounded ripple attribute to TabLayout
PiperOrigin-RevId: 182458105
2018-01-25 18:12:07 -05:00
gauthams
abc9555ba5 Update button style names
PiperOrigin-RevId: 182446238
2018-01-25 18:11:50 -05:00
gauthams
51dc22478a Initialize BottomNavigationMenuView correctly in BottomNavigationPresenter
PiperOrigin-RevId: 182432827
2018-01-25 18:11:27 -05:00
afohrman
ec18befe2d Delete shifting mode in favor of label visibility mode.
PiperOrigin-RevId: 182431135
2018-01-25 18:10:56 -05:00
afohrman
f909ab4d9e Rename text input resource prefixes from design -> mtrl.
These dimensions were added before we changed the naming scheme for new resources.

PiperOrigin-RevId: 182426105
2018-01-25 18:09:39 -05:00
gauthams
7de8926953 Update default inset value for button component
PiperOrigin-RevId: 182314895
2018-01-25 18:09:22 -05:00
gauthams
1d45586a1c Update button tinting to support ViewCompat.setBackgroundTintList()
PiperOrigin-RevId: 182294606
2018-01-25 18:09:04 -05:00
Material Design Team
8f04338501 Automated g4 rollback of changelist 182118849
PiperOrigin-RevId: 182245219
2018-01-25 18:08:00 -05:00
gauthams
7042ac6663 Update button tinting to support ViewCompat.setBackgroundTintList()
PiperOrigin-RevId: 182118849
2018-01-16 18:27:17 -05:00
afohrman
1967141098 Add active text appearances to bottom nav.
To support different font weights and other text attributes for active and inactive TextViews, the bottom nav now takes two separate text appearances, one for the active TextView, and one for the inactive TextView. This creates more complexity for how the ColorStateList for textColor is handled, and there were a couple of alternatives considered, but this seems to be the most elegant solution to a unique set of requirements.

The text size attributes introduced in the last commit are deleted. They were only necessary as an interim solution for text sizes, to keep the active and inactive labels from jumping to the wrong sizes.

PiperOrigin-RevId: 182054036
2018-01-16 16:15:01 -05:00
markwei
e26a690572 Add letter spacing to typographic styles.
PiperOrigin-RevId: 181810134
2018-01-16 16:13:58 -05:00
dniz
7825a4f80f Fix Chip and MaterialSwitch lint issues
PiperOrigin-RevId: 181742611
2018-01-12 11:37:02 -05:00
Material Design Team
5643af73b3 Automated g4 rollback of changelist 181541883
PiperOrigin-RevId: 181544129
2018-01-11 11:26:20 -05:00
dcarlsson
4c1f422765 Update how MaterialCardView handles background color.
PiperOrigin-RevId: 181541883
2018-01-11 11:26:00 -05:00
markwei
977f529a4d Add typography style TextAppearances and demo.
PiperOrigin-RevId: 181534940
2018-01-11 11:25:33 -05:00
cketcham
3056e3772e Added mode attribute to BottomAppBar
PiperOrigin-RevId: 181520200
2018-01-11 11:25:00 -05:00
afohrman
b12f4dee49 Add text sizing capabilities to bottom nav.
Open an itemTextAppearance attribute and two attributes for active and inactive label sizes to allow customizing the label text sizes.

The Widget.MaterialComponents.BottomNavigationView styles now defaults to AppCompat's Caption sizing (12sp) for both the active and inactive label sizes.

PiperOrigin-RevId: 181399525
2018-01-11 11:24:31 -05:00
gauthams
43a96f559a Add flag to TabLayout to limit indicator width to the width of its content, rather than the width of the entire tab item
PiperOrigin-RevId: 181358392
2018-01-11 11:14:17 -05:00
Material Design Team
9c11d3531a Prevent potential NPE. It's reported in live AGSA bugs and the root cause could be the same with cl/152195381.
PiperOrigin-RevId: 181238092
2018-01-11 11:13:47 -05:00
afohrman
2885fc7ad8 Remove field prefixes from bottom nav code in the widget package.
This is part 2 of a change that removes field prefixes from code related to bottom nav.

PiperOrigin-RevId: 181229750
2018-01-11 11:13:30 -05:00
afohrman
15fa53bb6d Remove field prefixes from internal.
PiperOrigin-RevId: 181202757
2018-01-11 11:13:07 -05:00
afohrman
e65c6f9587 Remove early returns from if statements in BottomNavigationMenuView.
This also fixes a lint warning to use braces with if statements.

PiperOrigin-RevId: 181198188
2018-01-11 11:12:44 -05:00
cketcham
4d80d2f76d Separate attached and detached state from the mode.
The FAB should float above the BottomAppBar when it is detached.

PiperOrigin-RevId: 181165130
2018-01-11 11:12:30 -05:00
dcarlsson
036cd85fa5 Add custom attributes to MaterialCardView for stroked outline card styles.
PiperOrigin-RevId: 181046826
2018-01-11 11:12:09 -05:00
dcarlsson
b864c352a1 Add class for MaterialCard.
Add foundation for styles and theme support.

PiperOrigin-RevId: 181045762
2018-01-11 11:11:35 -05:00
travisc
1ef167edc2 Move ThemeUtils to internal package and rename to ThemeEnforcement.
This is a first step in reversing the dependency flow around the `theme`
package in MDC. In a future commit, I'll make theme contain all the various
MaterialComponents theme definitions, and it will thus depend on the various
packages containing our components (widget, button, toggle, etc.).

The theme package will be empty as of this commit, but since I plan to use it
in the next one I've left the build infrastructure in place.

PiperOrigin-RevId: 180737806
2018-01-11 11:09:46 -05:00
travisc
0f29cbf042 Make widget its own package, change lib into a pure export package.
This also moves expandable and transformation into their own packages, as was originally intended (but they had resources, which was problematic at that time). CoordinatorLayout has been moved out of the typical source root to ease its later deletion (when it has made it into core-ui).

PiperOrigin-RevId: 180728823
2018-01-11 11:08:30 -05:00
Material Design Team
1e32cc7443 Rename Toggle & toggle - MaterialSwitch & switch
We cannot use 'switch' as a package name in java but would like to keep naming
conventions inline with sysUi - SwitchCompat. This feels clumsy to me as we now
have items such as <android.support.design.materialswitch.MaterialSwitch but I
am not sure how else to get around this.

PiperOrigin-RevId: 180649420
2018-01-11 11:07:43 -05:00
travisc
b7fb904d18 Make internal its own package.
This gives internal its own res directory, and pushes the build files down into
the source directory (as it is with all our other non-widget packages). Ideally
new things don't really get added to this package (instead they can be added to
feature/component-specific packages as package private). A few new packages had
to be created in order to break circular dependencies between widget and
internal.

This commit also fixes a number of problems with the Gradle build, as they were
mostly related to dependency issues or things not being included in
settings.gradle.

The next step here is to do the same for the widget package, and turn the lib
build files into something that just exports the other library packages.

PiperOrigin-RevId: 179866428
2018-01-11 10:58:06 -05:00
Material Design Team
356410c480 Material Toggle component.
This is still a WIP but breaking this down into smaller pieces for review purposes. There are a number of items still outstanding due to technical complexity that need to be addressed. I have included TODOs for each of these. These will need to be completed before moving this component into the main catalog.

The main items:
Finalise the base values from the red lines
Change the GradientDrawable for thumb and track to something that can have elevation
Fix the padding issue with the track - remove the workaround onDraw due to concerns over the solution being 'hacky'
TrackTintMode & ThumbTintMode needs adding
Ripple radius is smaller due to drawable which I will address once we have resolved the drawable solution

Video of toggle in current state:
https://drive.google.com/open?id=1pWFGuud3k3Wpay0CUKXZu8gbbxuCtG8d

PiperOrigin-RevId: 179551097
2018-01-11 10:56:48 -05:00
cketcham
ca52d28595 Add lint checks for button component
PiperOrigin-RevId: 179088379
2018-01-11 10:56:26 -05:00
gauthams
2aa0405d03 Fix issue where setting indicator height to 0dp would not hide the indicator
PiperOrigin-RevId: 178756271
2018-01-11 10:56:13 -05:00
gauthams
f6769a509c Add tab selection indicator gravity attribute to TabLayout. Also renames SlidingTabStrip to SlidingTabIndicator.
PiperOrigin-RevId: 178626652
2018-01-11 10:55:49 -05:00
markwei
61375f7e97 Implement ChipGroup selection exclusivity.
New singleSelection attribute to control whether the ChipGroup has a multiple-exclusion scope for its chips.
When set to true, the ChipGroup acts as a RadioGroup.

ChipGroup can be used purely for layout purposes when singleSelection is set to false.

PiperOrigin-RevId: 178466966
2018-01-11 10:55:26 -05:00
cketcham
72d0370a1c Fix bouncy behavior with nested scrolling v2
Adds condition to only snap the CoordinatorLayout if a fling is ending, or a fling won't be started

PiperOrigin-RevId: 178374659
2018-01-11 10:54:52 -05:00
markwei
46d1a6f070 New ChipGroup widget.
Uses FlexboxLayout to allow either:
- Reflowed multiline chips (default)
- Singleline chips

PiperOrigin-RevId: 178151061
2018-01-11 10:53:50 -05:00
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