Skip to content

Commit 73f7681

Browse files
melaniegoetzdsn5ft
authored andcommitted
Automated g4 rollback of changelist 224370498
PiperOrigin-RevId: 224522042
1 parent 16822d6 commit 73f7681

File tree

5 files changed

+3
-103
lines changed

5 files changed

+3
-103
lines changed

lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,14 @@
2121
import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
2222

2323
import android.content.Context;
24-
import android.content.res.ColorStateList;
2524
import android.content.res.TypedArray;
2625
import android.os.Build;
2726
import android.os.Parcel;
2827
import android.os.Parcelable;
2928
import android.support.annotation.IntDef;
3029
import android.support.annotation.NonNull;
31-
import android.support.annotation.Nullable;
3230
import android.support.annotation.RestrictTo;
3331
import android.support.annotation.VisibleForTesting;
34-
import com.google.android.material.resources.MaterialResources;
35-
import com.google.android.material.shape.MaterialShapeDrawable;
36-
import com.google.android.material.shape.ShapeAppearanceModel;
3732
import android.support.design.widget.CoordinatorLayout;
3833
import android.support.v4.math.MathUtils;
3934
import android.support.v4.view.AbsSavedState;
@@ -143,14 +138,6 @@ public abstract static class BottomSheetCallback {
143138
/** The last peek height calculated in onLayoutChild. */
144139
private int lastPeekHeight;
145140

146-
/** True if Behavior has a non-null value for the shapeAppearance attribute */
147-
private boolean shapeThemingEnabled;
148-
149-
private MaterialShapeDrawable materialShapeDrawable;
150-
151-
/** Default Shape Appearance to be used in bottomsheet */
152-
private ShapeAppearanceModel shapeAppearanceModelDefault;
153-
154141
int fitToContentsOffset;
155142

156143
int halfExpandedOffset;
@@ -194,16 +181,6 @@ public BottomSheetBehavior() {}
194181
public BottomSheetBehavior(Context context, AttributeSet attrs) {
195182
super(context, attrs);
196183
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Layout);
197-
this.shapeThemingEnabled = a.hasValue(R.styleable.BottomSheetBehavior_Layout_shapeAppearance);
198-
boolean hasBackgroundTint = a.hasValue(R.styleable.BottomSheetBehavior_Layout_backgroundTint);
199-
if (hasBackgroundTint) {
200-
ColorStateList bottomSheetColor =
201-
MaterialResources.getColorStateList(
202-
context, a, R.styleable.BottomSheetBehavior_Layout_backgroundTint);
203-
createMaterialShapeDrawable(context, attrs, hasBackgroundTint, bottomSheetColor);
204-
} else {
205-
createMaterialShapeDrawable(context, attrs, hasBackgroundTint, null);
206-
}
207184
TypedValue value = a.peekValue(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight);
208185
if (value != null && value.data == PEEK_HEIGHT_AUTO) {
209186
setPeekHeight(value.data);
@@ -244,12 +221,6 @@ public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirect
244221
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
245222
child.setFitsSystemWindows(true);
246223
}
247-
// Only set MaterialShapeDrawable as background if shapeTheming is enabled, otherwise will
248-
// default to android:background declared in styles or layout.
249-
if (shapeThemingEnabled && materialShapeDrawable != null) {
250-
ViewCompat.setBackground(child, materialShapeDrawable);
251-
}
252-
253224
int savedTop = child.getTop();
254225
// First let the parent lay it out
255226
parent.onLayoutChild(child, layoutDirection);
@@ -737,27 +708,11 @@ void setStateInternal(@State int state) {
737708
bottomSheet, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
738709
bottomSheet.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
739710

740-
updateDrawableOnStateChange(state);
741711
if (callback != null) {
742712
callback.onStateChanged(bottomSheet, state);
743713
}
744714
}
745715

746-
private void updateDrawableOnStateChange(@State int state) {
747-
if (materialShapeDrawable != null) {
748-
if (state == STATE_EXPANDED && (parentHeight <= viewRef.get().getHeight())) {
749-
// If the bottomsheet is fully expanded, change ShapeAppearance to sharp corners to
750-
// indicate the bottomsheet has no more content to scroll.
751-
// Overriding of this style may be performed in the bottomsheet callback.
752-
materialShapeDrawable.getShapeAppearanceModel().setCornerRadius(0);
753-
materialShapeDrawable.invalidateSelf();
754-
}
755-
if (state == STATE_COLLAPSED || state == STATE_DRAGGING) {
756-
materialShapeDrawable.setShapeAppearanceModel(shapeAppearanceModelDefault);
757-
}
758-
}
759-
}
760-
761716
private void calculateCollapsedOffset() {
762717
if (fitToContents) {
763718
collapsedOffset = Math.max(parentHeight - lastPeekHeight, fitToContentsOffset);
@@ -803,32 +758,6 @@ View findScrollingChild(View view) {
803758
return null;
804759
}
805760

806-
private void createMaterialShapeDrawable(
807-
Context context,
808-
AttributeSet attrs,
809-
boolean hasBackgroundTint,
810-
@Nullable ColorStateList bottomSheetColor) {
811-
if (this.shapeThemingEnabled) {
812-
this.shapeAppearanceModelDefault = new ShapeAppearanceModel(
813-
context,
814-
attrs,
815-
R.styleable.BottomSheetBehavior_Layout_shapeAppearance,
816-
R.styleable.BottomSheetBehavior_Layout_shapeAppearanceOverlay);
817-
818-
this.materialShapeDrawable =
819-
new MaterialShapeDrawable(shapeAppearanceModelDefault);
820-
821-
if (hasBackgroundTint && bottomSheetColor != null) {
822-
materialShapeDrawable.setFillColor(bottomSheetColor);
823-
} else {
824-
// If the tint isn't set, use the theme default background color.
825-
TypedValue defaultColor = new TypedValue();
826-
context.getTheme().resolveAttribute(android.R.attr.colorBackground, defaultColor, true);
827-
materialShapeDrawable.setTint(defaultColor.data);
828-
}
829-
}
830-
}
831-
832761
private float getYVelocity() {
833762
if (velocityTracker == null) {
834763
return 0;

lib/java/com/google/android/material/bottomsheet/res-public/values/public.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<public name="bottomSheetDialogTheme" type="attr"/>
2323
<public name="bottomSheetStyle" type="attr"/>
2424
<public name="behavior_peekHeight" type="attr"/>
25-
<public name="backgroundTint" type="attr"/>
2625
<public name="behavior_fitToContents" type="attr"/>
2726
<public name="Animation.Design.BottomSheetDialog" type="style"/>
2827
<public name="Widget.Design.BottomSheet.Modal" type="style"/>

lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@
3333
<attr name="behavior_skipCollapsed" format="boolean"/>
3434
<!-- Whether height of expanded sheet wraps content or not -->
3535
<attr name="behavior_fitToContents" format="boolean"/>
36-
<!-- Shape appearance style reference for BottomSheet. Attribute declaration is in the shape
37-
package. -->
38-
<attr name="shapeAppearance"/>
39-
<!-- Shape appearance overlay style reference for BottomSheet. To be used to augment attributes
40-
declared in the shapeAppearance. Attribute declaration is in the shape package. -->
41-
<attr name="shapeAppearanceOverlay"/>
42-
<!-- Background color used by the BottomSheetBehavior background drawable when shape theming is
43-
enabled. Accepts a ColorStateList or ColorInt. If shape theming is not enabled,
44-
android:background should instead be utilized to set the background resource. -->
45-
<attr name="backgroundTint"/>
4636
</declare-styleable>
4737

4838
</resources>

lib/java/com/google/android/material/bottomsheet/res/values/styles.xml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,15 @@
2727
</style>
2828

2929
<style name="Widget.Design.BottomSheet.Modal" parent="android:Widget">
30-
<item name="enforceMaterialTheme">false</item>
3130
<item name="android:background">?android:attr/colorBackground</item>
3231
<item name="android:elevation" tools:ignore="NewApi">
3332
@dimen/design_bottom_sheet_modal_elevation
3433
</item>
3534
<item name="behavior_peekHeight">auto</item>
3635
<item name="behavior_hideable">true</item>
3736
<item name="behavior_skipCollapsed">false</item>
38-
<item name="shapeAppearance">@null</item>
39-
<item name="shapeAppearanceOverlay">@null</item>
40-
<item name="backgroundTint">?android:attr/colorBackground</item>
4137
</style>
4238

43-
<style name="Widget.MaterialComponents.BottomSheet.Modal" parent="Widget.Design.BottomSheet.Modal">
44-
<item name="android:background">@null</item>
45-
<item name="enforceMaterialTheme">true</item>
46-
<item name="shapeAppearance">?attr/shapeAppearanceLargeComponent</item>
47-
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.MaterialComponents.BottomSheet.Modal</item>
48-
<item name="backgroundTint">?android:attr/colorBackground</item>
49-
</style>
50-
51-
<style name="ShapeAppearanceOverlay.MaterialComponents.BottomSheet.Modal" parent="">
52-
<item name="cornerSizeTopRight">0dp</item>
53-
<item name="cornerSizeTopLeft">0dp</item>
54-
<item name="cornerFamilyTopLeft">rounded</item>
55-
<item name="cornerFamilyTopRight">rounded</item>
56-
</style>
39+
<style name="Widget.MaterialComponents.BottomSheet.Modal" parent="Widget.Design.BottomSheet.Modal" />
5740

58-
</resources>
41+
</resources>

lib/java/com/google/android/material/shape/ShapeAppearanceModel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ public ShapeAppearanceModel(
8787
TypedArray a =
8888
context.obtainStyledAttributes(attrs, R.styleable.MaterialShape, defStyleAttr, defStyleRes);
8989

90-
int shapeAppearanceResId =
91-
a.getResourceId(R.styleable.MaterialShape_shapeAppearance, 0);
90+
int shapeAppearanceResId = a.getResourceId(R.styleable.MaterialShape_shapeAppearance, 0);
9291
int shapeAppearanceOverlayResId =
9392
a.getResourceId(R.styleable.MaterialShape_shapeAppearanceOverlay, 0);
9493
a.recycle();

0 commit comments

Comments
 (0)