283 Commits

Author SHA1 Message Date
dniz
7cd55d872b Add Toolbar styles that use themed text appearances based on type scale
PiperOrigin-RevId: 202636817
2018-07-02 09:50:23 -04:00
gauthams
58df7b8baa Fixing MaterialButton padding API surface
PiperOrigin-RevId: 202584064
2018-07-02 09:49:33 -04:00
dniz
21dff0f641 Update MaterialComponents Snackbar to use themed text appearance
PiperOrigin-RevId: 202532773
2018-07-02 09:47:41 -04:00
gauthams
8cbde4c219 Update tabs to use type scale attributes, and enforce textAppearance check
PiperOrigin-RevId: 202501993
2018-07-02 09:46:58 -04:00
dniz
24867f367c Fix error in Gradle build due to TextAppearance variable scope
PiperOrigin-RevId: 202488746
2018-07-02 09:46:29 -04:00
gauthams
98350d8bdf Update TextAppearance enforcement error to be more clear.
PiperOrigin-RevId: 202189106
2018-07-02 09:43:00 -04:00
dniz
b30c567719 AppBarLayout expose setLiftable() and setLifted() as a workaround for ListView lift on scroll
Example of workaround:

  appBarLayout.setLiftable(true);
  listView.setOnScrollListener(
      new OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {}

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
          boolean isAtTop = firstVisibleItem == 0 && (view.getChildCount() == 0 || view.getChildAt(0).getTop() == 0);
          appBarLayout.setLifted(!isAtTop);
        }
      });

PiperOrigin-RevId: 202187470
2018-07-02 09:42:27 -04:00
dniz
b1a784ce75 Implement new Material Snackbar according to spec
This commit updates MaterialComponents Snackbars to have margins and rounded corners, as well as makes Snackbars styleable at the app theme level via a snackbarStyle attribute.

PiperOrigin-RevId: 202141103
2018-07-02 09:41:41 -04:00
connieshi
608d2b2fd7 Add support for android:maxWidth to ChipDrawable. Restrict the intrinsic width of the ChipDrawable by the max width. Fixes bug that ignored maxWidth set in Chip.
PiperOrigin-RevId: 202048514
2018-07-02 09:40:13 -04:00
gauthams
c852e7f0cf Make ThemeEnforcement TextAppearance check more robust
PiperOrigin-RevId: 202039029
2018-07-02 09:39:28 -04:00
connieshi
d584f91ccc Resolve fonts asynchronously to avoid ANR.
Added flag to specify that fonts should be resolved synchronously for instrumentation tests.

PiperOrigin-RevId: 202033678
2018-07-02 09:37:14 -04:00
cketcham
8f7dc21a27 Add android:fontFamily to all text styles
This lets us support clients who can't or don't need to use AppCompatTextView. Using `android:fontFamily` will work for clients with min sdk >= 16.

PiperOrigin-RevId: 202032242
2018-07-02 09:26:47 -04:00
Andhie Wong
e1c8886c6c [AppBar] appbar_scrolling_view_behavior as public res
PiperOrigin-RevId: 201416419
2018-06-20 17:30:59 -04:00
connieshi
24bd4a9531 Remove Chip method.
PiperOrigin-RevId: 201199382
2018-06-20 17:30:21 -04:00
cketcham
841ba156fc Automated g4 rollback of changelist 199530791
PiperOrigin-RevId: 201188669
2018-06-20 17:29:57 -04:00
gauthams
580f63bd4d Remove unused ThemeEnforcement method
PiperOrigin-RevId: 201101785
2018-06-20 17:29:16 -04:00
afohrman
6d28b64043 Update documentation to discourage setting the hint on TextInputEditText.
Remove ambiguity about where to set the hint by strongly recommending that it be set on the TextInputLayout.

This commit also updates the documentation to more strongly encourage the use of TextInputEditText over an EditText.

PiperOrigin-RevId: 201037651
2018-06-20 17:28:41 -04:00
dniz
005a0044c3 Update AppBarLayout liftOnScroll start scroll check to not depend on scrolling
view size

This fixes an issue where the app bar would not lift if a bottom margin is
applied to the scrolling view

PiperOrigin-RevId: 201008179
2018-06-20 17:28:13 -04:00
Material Design Team
79d3c53632 Automated g4 rollback of changelist 199854529
PiperOrigin-RevId: 200785748
2018-06-20 17:27:56 -04:00
connieshi
00a132b6a0 Remove Chip method.
PiperOrigin-RevId: 200735866
2018-06-20 17:27:41 -04:00
connieshi
3f00c13ebe Fix api issues, defer to TextView to render the chip text and ChipDrawable to render everything else.
List of text related attributes/methods supported with this approach:
    android:autoLink
    android:hint
    android:text
    android:textAllCaps
    android:textAppearance
    android:textColor

    android:textColorHint
    android:textColorLink
    android:textIsSelectable
    android:textScaleX
    android:textSize
    android:textStyle
    android:typeface
    android:fontFamily

    Not supported:
    android:textColorHighlight
    android:textColorLink

PiperOrigin-RevId: 200578044
2018-06-20 17:27:20 -04:00
Material Design Team
63f5c53c7e Repair bottomsheetbehavior on swipe
PiperOrigin-RevId: 199854529
2018-06-20 17:27:00 -04:00
connieshi
649a13fa2e Replace calls to deprecated method Chip#getChipText() with its replacement Chip#getText().
Replace calls to deprecated Chip#setChipText(...) methods with their replacement Chip#setText...).

PiperOrigin-RevId: 199663849
2018-06-20 17:26:38 -04:00
cketcham
8e3cbc3463 Fix BottomAppBar background when no Fab is anchored
PiperOrigin-RevId: 199656555
2018-06-20 17:25:55 -04:00
connieshi
860b04767b Unwrap mutated drawable (chipIcon and closeIcon) before returning it in the getter.
PiperOrigin-RevId: 199636765
2018-06-20 17:25:37 -04:00
afohrman
b087cbad7a Roll back deletion of FAB attachment functionality.
PiperOrigin-RevId: 199530791
2018-06-20 17:24:55 -04:00
connieshi
412ee4c1f1 Add support for tinting the chip icon.
PiperOrigin-RevId: 199526967
2018-06-20 17:24:18 -04:00
cketcham
cdb99838c6 Don't allow the fab to be detached from the BottomAppBar unless the fab isn't visible, or the BottomAppBar is scrolled off the screen
PiperOrigin-RevId: 199511216
2018-06-20 17:24:01 -04:00
connieshi
434be9ff15 Restores chip text after it's being cleared by TextView's onRestoreInstanceState, this was causing an clearing the chip text on config change for pre-L devices.
PiperOrigin-RevId: 199482051
2018-06-20 17:23:38 -04:00
dniz
11d5335ea9 Remove 1 pixel hairline from BottomAppBar
PiperOrigin-RevId: 199356320
2018-06-20 17:23:17 -04:00
dniz
a0457bce83 Restrict AnimatorSetCompat to library usage
PiperOrigin-RevId: 199231917
2018-06-20 17:22:57 -04:00
marianomartin
dc36a0999c Allow icon to be centered with text in MaterialButton
PiperOrigin-RevId: 199138977
2018-06-20 17:22:24 -04:00
dniz
ad573c764b Clarify sizing for FloatingActionButton
PiperOrigin-RevId: 198914008
2018-06-04 10:51:12 -04:00
dniz
91196d1163 Add get/setItemBackground() Drawable methods to BottomNavigationView
PiperOrigin-RevId: 198911383
2018-06-04 10:50:40 -04:00
connieshi
57aeb2b7f8 Android Studio is looking for a "Chip" declare-stylable when trying to determine what attributes are applicable for the "Chip" component. Android Studio doesn't know that "ChipDrawable" is used internally and all attributes to "ChipDrawable" applies.
This is preventing completions of attribute names for Chip and the attribute panels shows up empty for Chip.

Rename R.styleable.ChipDrawable to R.styleable.Chip and update ChipDrawable to use it.

AS 3.2 canary > 14  (currently 16) is required to see the attributes in the attribute panel.

PiperOrigin-RevId: 198909123
2018-06-04 10:49:01 -04:00
connieshi
4a7bd84360 Add null check to Chip#setText and ChipDrawable#setText. Set null text to empty string, this is done internally by TextView.
Changed Chip#getText and ChipDrawable#getText to be @NotNull

PiperOrigin-RevId: 198868472
2018-06-04 10:48:35 -04:00
cketcham
cf65d74636 Fix BottomSheetBehavior bug for horizontal swipes.
This fixes a jumpy behavior caused by swiping quickly horizontally on a bottom sheet.

PiperOrigin-RevId: 198868074
2018-06-04 10:48:01 -04:00
dniz
c9fbe7fed6 Annotate MaterialButton color and dimension methods
PiperOrigin-RevId: 198770878
2018-05-31 17:04:32 -04:00
afohrman
f2ebf56e21 Rename text field outlined style from "Outline" to "Outlined".
This commit updates the style names for the outlined text field box from "Outline" to "Outlined.

Widget.MaterialComponents.TextInputLayout.OutlineBox -> Widget.MaterialComponents.TextInputLayout.OutlinedBox, and
Widget.MaterialComponents.TextInputEditText.OutlineBox -> Widget.MaterialComponents.TextInputEditText.OutlinedBox.

This name matches spec and is closer to what is used on the other platforms.

PiperOrigin-RevId: 198768731
2018-05-31 16:39:44 -04:00
dniz
76bf445390 Annotate BottomAppBar dimension methods
PiperOrigin-RevId: 198767414
2018-05-31 16:36:00 -04:00
afohrman
0518a3d651 Add missing public attributes.
Looks like some styles and component style attributes slipped by.

PiperOrigin-RevId: 198762794
2018-05-31 16:35:29 -04:00
afohrman
7c77374127 Set textInputStyle to Widget.Design.TextInputLayout and remove editTextStyle from the theme.
The editTextStyle is now implicitly set to Widget.AppCompat.EditText.

The background for this change is that all EditTexts in the theme were getting the filled box text field set on it rather than Widget.AppCompat.EditText. Because the TextInputEditText style is set via a ThemeOverlay, simply setting the correct style on the TextInputEditText wouldn't remove the attributes set in the filled box ThemeOverlay. This commit sets textInputStyle to Widget.Design.TextInputLayout to work around that.

This commit also adds a legacy text field demo. This should help ensure that the pre-existing text field isn't changed as a result of other modifications to the text field.

PiperOrigin-RevId: 198758642
2018-05-31 16:32:59 -04:00
connieshi
f35acd8660 Rolling back again because of bad interactions with espresso ViewMatchers.
PiperOrigin-RevId: 198709590
2018-05-31 16:31:26 -04:00
connieshi
200fdcb6a2 Rolling forward changes to override Chip#getText() and Chip#setText(CharSequence, BufferType) now that a bug in ChipDrawable#getText has been fixed and internal tests are passing again.
PiperOrigin-RevId: 198616302
2018-05-30 17:46:46 -04:00
gauthams
670787be83 Update button to use textappearance theme attributes, and enforce textappearance check
PiperOrigin-RevId: 198609334
2018-05-30 17:45:15 -04:00
cketcham
a7ad02eb7b Add hideOnScroll attr to the BottomAppBar javadoc
PiperOrigin-RevId: 198596762
2018-05-30 17:44:54 -04:00
cketcham
bc9224e122 Add missing accessor methods for BottomAppBar
PiperOrigin-RevId: 198593477
2018-05-30 17:44:24 -04:00
Aleksander Ermakov
84663583b7 Set indicator bottom padding to always be 0.
There was extra padding at the bottom of the indicator view (i.e. the helper or error TextView underneath the text field. This commit removes that extra padding.

PiperOrigin-RevId: 198578652
2018-05-30 17:43:55 -04:00
connieshi
bb8f8388e7 Prevent users from setting the background attribute because Chip manages its own background drawable.
Allow setBackground to be called by Chip itself internally to set the background to be chipDrawable or ripple.

PiperOrigin-RevId: 198572908
2018-05-30 17:43:30 -04:00
marianomartin
663fd7abff add res-public files
PiperOrigin-RevId: 198567215
2018-05-30 17:42:48 -04:00