diff --git a/lib/java/com/google/android/material/internal/ViewGroupOverlayApi14.java b/lib/java/com/google/android/material/internal/ViewGroupOverlayApi14.java
deleted file mode 100644
index 394d5a187f7..00000000000
--- a/lib/java/com/google/android/material/internal/ViewGroupOverlayApi14.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import androidx.annotation.NonNull;
-
-class ViewGroupOverlayApi14 extends ViewOverlayApi14 implements ViewGroupOverlayImpl {
-
- ViewGroupOverlayApi14(Context context, ViewGroup hostView, View requestingView) {
- super(context, hostView, requestingView);
- }
-
- static ViewGroupOverlayApi14 createFrom(ViewGroup viewGroup) {
- return (ViewGroupOverlayApi14) ViewOverlayApi14.createFrom(viewGroup);
- }
-
- @Override
- public void add(@NonNull View view) {
- overlayViewGroup.add(view);
- }
-
- @Override
- public void remove(@NonNull View view) {
- overlayViewGroup.remove(view);
- }
-}
diff --git a/lib/java/com/google/android/material/internal/ViewGroupOverlayApi18.java b/lib/java/com/google/android/material/internal/ViewGroupOverlayApi18.java
deleted file mode 100644
index f54745f5a7e..00000000000
--- a/lib/java/com/google/android/material/internal/ViewGroupOverlayApi18.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import android.graphics.drawable.Drawable;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewGroupOverlay;
-import androidx.annotation.NonNull;
-
-class ViewGroupOverlayApi18 implements ViewGroupOverlayImpl {
-
- private final ViewGroupOverlay viewGroupOverlay;
-
- ViewGroupOverlayApi18(@NonNull ViewGroup group) {
- viewGroupOverlay = group.getOverlay();
- }
-
- @Override
- public void add(@NonNull Drawable drawable) {
- viewGroupOverlay.add(drawable);
- }
-
- @Override
- public void remove(@NonNull Drawable drawable) {
- viewGroupOverlay.remove(drawable);
- }
-
- @Override
- public void add(@NonNull View view) {
- viewGroupOverlay.add(view);
- }
-
- @Override
- public void remove(@NonNull View view) {
- viewGroupOverlay.remove(view);
- }
-}
diff --git a/lib/java/com/google/android/material/internal/ViewGroupOverlayImpl.java b/lib/java/com/google/android/material/internal/ViewGroupOverlayImpl.java
deleted file mode 100644
index b8cca81c944..00000000000
--- a/lib/java/com/google/android/material/internal/ViewGroupOverlayImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import android.view.View;
-import androidx.annotation.NonNull;
-
-interface ViewGroupOverlayImpl extends ViewOverlayImpl {
-
- /**
- * Adds a View to the overlay. The bounds of the added view should be relative to the host view.
- * Any view added to the overlay should be removed when it is no longer needed or no longer
- * visible.
- *
- *
Views in the overlay are visual-only; they do not receive input events and do not
- * participate in focus traversal. Overlay views are intended to be transient, such as might be
- * needed by a temporary animation effect.
- *
- *
If the view has a parent, the view will be removed from that parent before being added to
- * the overlay. Also, if that parent is attached in the current view hierarchy, the view will be
- * repositioned such that it is in the same relative location inside the activity. For example, if
- * the view's current parent lies 100 pixels to the right and 200 pixels down from the origin of
- * the overlay's host view, then the view will be offset by (100, 200).
- *
- * @param view The View to be added to the overlay. The added view will be drawn when the overlay
- * is drawn.
- * @see #remove(View)
- * @see android.view.ViewOverlay#add(android.graphics.drawable.Drawable)
- */
- void add(@NonNull View view);
-
- /**
- * Removes the specified View from the overlay.
- *
- * @param view The View to be removed from the overlay.
- * @see #add(View)
- * @see android.view.ViewOverlay#remove(android.graphics.drawable.Drawable)
- */
- void remove(@NonNull View view);
-}
diff --git a/lib/java/com/google/android/material/internal/ViewOverlayApi14.java b/lib/java/com/google/android/material/internal/ViewOverlayApi14.java
deleted file mode 100644
index bf502328651..00000000000
--- a/lib/java/com/google/android/material/internal/ViewOverlayApi14.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-import androidx.annotation.NonNull;
-import androidx.annotation.RestrictTo;
-import androidx.core.view.ViewCompat;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
-class ViewOverlayApi14 implements ViewOverlayImpl {
-
- /**
- * The actual container for the drawables (and views, if it's a ViewGroupOverlay). All of the
- * management and rendering details for the overlay are handled in OverlayViewGroup.
- */
- protected OverlayViewGroup overlayViewGroup;
-
- ViewOverlayApi14(Context context, ViewGroup hostView, View requestingView) {
- overlayViewGroup = new OverlayViewGroup(context, hostView, requestingView, this);
- }
-
- static ViewOverlayApi14 createFrom(View view) {
- ViewGroup contentView = ViewUtils.getContentView(view);
- if (contentView != null) {
- final int numChildren = contentView.getChildCount();
- for (int i = 0; i < numChildren; ++i) {
- View child = contentView.getChildAt(i);
- if (child instanceof OverlayViewGroup) {
- return ((OverlayViewGroup) child).viewOverlay;
- }
- }
- return new ViewGroupOverlayApi14(contentView.getContext(), contentView, view);
- }
- return null;
- }
-
- @Override
- public void add(@NonNull Drawable drawable) {
- overlayViewGroup.add(drawable);
- }
-
- @Override
- public void remove(@NonNull Drawable drawable) {
- overlayViewGroup.remove(drawable);
- }
-
- /**
- * OverlayViewGroup is a container that View and ViewGroup use to host drawables and views added
- * to their overlays ({@code ViewOverlay} and {@code ViewGroupOverlay}, respectively). Drawables
- * are added to the overlay via the add/remove methods in ViewOverlay, Views are added/removed via
- * ViewGroupOverlay. These drawable and view objects are drawn whenever the view itself is drawn;
- * first the view draws its own content (and children, if it is a ViewGroup), then it draws its
- * overlay (if it has one).
- *
- *
Besides managing and drawing the list of drawables, this class serves two purposes: (1) it
- * noops layout calls because children are absolutely positioned and (2) it forwards all
- * invalidation calls to its host view. The invalidation redirect is necessary because the overlay
- * is not a child of the host view and invalidation cannot therefore follow the normal path up
- * through the parent hierarchy.
- *
- * @see View#getOverlay()
- * @see ViewGroup#getOverlay()
- */
- @SuppressLint({"ViewConstructor", "PrivateApi"})
- static class OverlayViewGroup extends ViewGroup {
-
- static Method invalidateChildInParentFastMethod;
-
- static {
- try {
- //noinspection JavaReflectionMemberAccess
- invalidateChildInParentFastMethod =
- ViewGroup.class.getDeclaredMethod(
- "invalidateChildInParentFast", int.class, int.class, Rect.class);
- } catch (NoSuchMethodException ignored) {
- // Ignore exception if method does not exist
- }
- }
-
- /**
- * The View for which this is an overlay. Invalidations of the overlay are redirected to this
- * host view.
- */
- ViewGroup hostView;
-
- View requestingView;
- /** The set of drawables to draw when the overlay is rendered. */
- ArrayList drawables = null;
- /** Reference to the hosting overlay object */
- ViewOverlayApi14 viewOverlay;
-
- private boolean disposed;
-
- OverlayViewGroup(
- Context context, ViewGroup hostView, View requestingView, ViewOverlayApi14 viewOverlay) {
- super(context);
- this.hostView = hostView;
- this.requestingView = requestingView;
- setRight(hostView.getWidth());
- setBottom(hostView.getHeight());
- hostView.addView(this);
- this.viewOverlay = viewOverlay;
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- // Intercept and noop all touch events - overlays do not allow touch events
- return false;
- }
-
- @SuppressWarnings("deprecation")
- public void add(Drawable drawable) {
- assertNotDisposed();
- if (drawables == null) {
-
- drawables = new ArrayList<>();
- }
- if (!drawables.contains(drawable)) {
- // Make each drawable unique in the overlay; can't add it more than once
- drawables.add(drawable);
- invalidate(drawable.getBounds());
- drawable.setCallback(this);
- }
- }
-
- @SuppressWarnings("deprecation")
- public void remove(Drawable drawable) {
- if (drawables != null) {
- drawables.remove(drawable);
- invalidate(drawable.getBounds());
- drawable.setCallback(null);
- disposeIfEmpty();
- }
- }
-
- @Override
- protected boolean verifyDrawable(@NonNull Drawable who) {
- return super.verifyDrawable(who) || (drawables != null && drawables.contains(who));
- }
-
- public void add(View child) {
- assertNotDisposed();
- if (child.getParent() instanceof ViewGroup) {
- ViewGroup parent = (ViewGroup) child.getParent();
- if (parent != hostView
- && parent.getParent() != null
- && parent.isAttachedToWindow()) {
- // Moving to different container; figure out how to position child such that
- // it is in the same location on the screen
- int[] parentLocation = new int[2];
- int[] hostViewLocation = new int[2];
- parent.getLocationOnScreen(parentLocation);
- hostView.getLocationOnScreen(hostViewLocation);
- ViewCompat.offsetLeftAndRight(child, parentLocation[0] - hostViewLocation[0]);
- ViewCompat.offsetTopAndBottom(child, parentLocation[1] - hostViewLocation[1]);
- }
- parent.removeView(child);
- // if (parent.getLayoutTransition() != null) {
- // // LayoutTransition will cause the child to delay removal - cancel it
- // parent.getLayoutTransition().cancel(LayoutTransition.DISAPPEARING);
- // }
- // fail-safe if view is still attached for any reason
- if (child.getParent() != null) {
- parent.removeView(child);
- }
- }
- super.addView(child);
- }
-
- public void remove(View view) {
- super.removeView(view);
- disposeIfEmpty();
- }
-
- private void assertNotDisposed() {
- if (disposed) {
- throw new IllegalStateException(
- "This overlay was disposed already. "
- + "Please use a new one via ViewGroupUtils.getOverlay()");
- }
- }
-
- private void disposeIfEmpty() {
- if (getChildCount() == 0 && (drawables == null || drawables.size() == 0)) {
- disposed = true;
- hostView.removeView(this);
- }
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void invalidateDrawable(@NonNull Drawable drawable) {
- invalidate(drawable.getBounds());
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- int[] contentViewLocation = new int[2];
- int[] hostViewLocation = new int[2];
- hostView.getLocationOnScreen(contentViewLocation);
- requestingView.getLocationOnScreen(hostViewLocation);
- canvas.translate(
- hostViewLocation[0] - contentViewLocation[0],
- hostViewLocation[1] - contentViewLocation[1]);
- canvas.clipRect(new Rect(0, 0, requestingView.getWidth(), requestingView.getHeight()));
- super.dispatchDraw(canvas);
- final int numDrawables = (drawables == null) ? 0 : drawables.size();
- for (int i = 0; i < numDrawables; ++i) {
- drawables.get(i).draw(canvas);
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- // Noop: children are positioned absolutely
- }
-
- /*
- The following invalidation overrides exist for the purpose of redirecting invalidation to
- the host view. The overlay is not parented to the host view (since a View cannot be a
- parent), so the invalidation cannot proceed through the normal parent hierarchy.
- There is a built-in assumption that the overlay exactly covers the host view, therefore
- the invalidation rectangles received do not need to be adjusted when forwarded to
- the host view.
- */
-
- private void getOffset(int[] offset) {
- int[] contentViewLocation = new int[2];
- int[] hostViewLocation = new int[2];
- hostView.getLocationOnScreen(contentViewLocation);
- requestingView.getLocationOnScreen(hostViewLocation);
- offset[0] = hostViewLocation[0] - contentViewLocation[0];
- offset[1] = hostViewLocation[1] - contentViewLocation[1];
- }
-
- /** @hide */
- @RestrictTo(LIBRARY_GROUP_PREFIX)
- protected ViewParent invalidateChildInParentFast(int left, int top, Rect dirty) {
- if (hostView != null && invalidateChildInParentFastMethod != null) {
- try {
- int[] offset = new int[2];
- getOffset(offset);
- invalidateChildInParentFastMethod.invoke(hostView, left, top, dirty);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
- if (hostView != null) {
- dirty.offset(location[0], location[1]);
- if (hostView != null) {
- location[0] = 0;
- location[1] = 0;
- int[] offset = new int[2];
- getOffset(offset);
- dirty.offset(offset[0], offset[1]);
- return super.invalidateChildInParent(location, dirty);
- // return hostView.invalidateChildInParent(location, dirty);
- } else {
- invalidate(dirty);
- }
- }
- return null;
- }
- }
-}
diff --git a/lib/java/com/google/android/material/internal/ViewOverlayApi18.java b/lib/java/com/google/android/material/internal/ViewOverlayApi18.java
deleted file mode 100644
index 078725251da..00000000000
--- a/lib/java/com/google/android/material/internal/ViewOverlayApi18.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import android.graphics.drawable.Drawable;
-import android.view.View;
-import android.view.ViewOverlay;
-import androidx.annotation.NonNull;
-
-class ViewOverlayApi18 implements ViewOverlayImpl {
-
- private final ViewOverlay viewOverlay;
-
- ViewOverlayApi18(@NonNull View view) {
- viewOverlay = view.getOverlay();
- }
-
- @Override
- public void add(@NonNull Drawable drawable) {
- viewOverlay.add(drawable);
- }
-
- @Override
- public void remove(@NonNull Drawable drawable) {
- viewOverlay.remove(drawable);
- }
-}
diff --git a/lib/java/com/google/android/material/internal/ViewOverlayImpl.java b/lib/java/com/google/android/material/internal/ViewOverlayImpl.java
deleted file mode 100644
index c9d83e01f3e..00000000000
--- a/lib/java/com/google/android/material/internal/ViewOverlayImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.material.internal;
-
-import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-
-import android.graphics.drawable.Drawable;
-import androidx.annotation.NonNull;
-import androidx.annotation.RestrictTo;
-
-/**
- * Backward-compatible implementation of {@link android.view.ViewOverlay}. TODO(b/144937975): Remove
- * and use the official version from androidx when it's available.
- *
- * @hide
- */
-@RestrictTo(LIBRARY_GROUP)
-public interface ViewOverlayImpl {
-
- /**
- * Adds a Drawable to the overlay. The bounds of the drawable should be relative to the host view.
- * Any drawable added to the overlay should be removed when it is no longer needed or no longer
- * visible.
- *
- * @param drawable The Drawable to be added to the overlay. This drawable will be drawn when the
- * view redraws its overlay.
- * @see #remove(Drawable)
- */
- void add(@NonNull Drawable drawable);
-
- /**
- * Removes the specified Drawable from the overlay.
- *
- * @param drawable The Drawable to be removed from the overlay.
- * @see #add(Drawable)
- */
- void remove(@NonNull Drawable drawable);
-}
diff --git a/lib/java/com/google/android/material/internal/ViewUtils.java b/lib/java/com/google/android/material/internal/ViewUtils.java
index 84cf92efe4f..dc65fbe0613 100644
--- a/lib/java/com/google/android/material/internal/ViewUtils.java
+++ b/lib/java/com/google/android/material/internal/ViewUtils.java
@@ -32,6 +32,7 @@
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.ViewGroup;
+import android.view.ViewOverlay;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
@@ -360,18 +361,6 @@ public static float getParentAbsoluteElevation(@NonNull View view) {
return absoluteElevation;
}
- /**
- * Backward-compatible {@link View#getOverlay()}. TODO(b/144937975): Remove and use the official
- * version from androidx when it's available.
- */
- @Nullable
- public static ViewOverlayImpl getOverlay(@Nullable View view) {
- if (view == null) {
- return null;
- }
- return new ViewOverlayApi18(view);
- }
-
/** Returns the content view that is the parent of the provided view. */
@Nullable
public static ViewGroup getContentView(@Nullable View view) {
@@ -400,8 +389,12 @@ public static ViewGroup getContentView(@Nullable View view) {
* Returns the content view overlay that can be used to add drawables on top of all other views.
*/
@Nullable
- public static ViewOverlayImpl getContentViewOverlay(@NonNull View view) {
- return getOverlay(getContentView(view));
+ public static ViewOverlay getContentViewOverlay(@NonNull View view) {
+ ViewGroup contentView = getContentView(view);
+ if (contentView == null) {
+ return null;
+ }
+ return contentView.getOverlay();
}
public static void addOnGlobalLayoutListener(
diff --git a/lib/java/com/google/android/material/slider/BaseSlider.java b/lib/java/com/google/android/material/slider/BaseSlider.java
index b4eacfaef2b..0e652aca6ea 100644
--- a/lib/java/com/google/android/material/slider/BaseSlider.java
+++ b/lib/java/com/google/android/material/slider/BaseSlider.java
@@ -75,6 +75,7 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.view.ViewOverlay;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
@@ -100,7 +101,6 @@
import com.google.android.material.drawable.DrawableUtils;
import com.google.android.material.internal.DescendantOffsetUtils;
import com.google.android.material.internal.ThemeEnforcement;
-import com.google.android.material.internal.ViewOverlayImpl;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.motion.MotionUtils;
import com.google.android.material.resources.MaterialResources;
@@ -2373,7 +2373,7 @@ protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
// When the visibility is set to VISIBLE, onDraw() is called again which adds or removes labels
// according to the setting.
if (visibility != VISIBLE) {
- ViewOverlayImpl contentViewOverlay = ViewUtils.getContentViewOverlay(this);
+ ViewOverlay contentViewOverlay = ViewUtils.getContentViewOverlay(this);
if (contentViewOverlay == null) {
return;
}
@@ -2458,7 +2458,7 @@ protected void onDetachedFromWindow() {
}
private void detachLabelFromContentView(TooltipDrawable label) {
- ViewOverlayImpl contentViewOverlay = ViewUtils.getContentViewOverlay(this);
+ ViewOverlay contentViewOverlay = ViewUtils.getContentViewOverlay(this);
if (contentViewOverlay != null) {
contentViewOverlay.remove(label);
label.detachView(ViewUtils.getContentView(this));
@@ -3500,7 +3500,7 @@ private void ensureLabelsRemoved() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- ViewOverlayImpl contentViewOverlay = ViewUtils.getContentViewOverlay(BaseSlider.this);
+ ViewOverlay contentViewOverlay = ViewUtils.getContentViewOverlay(BaseSlider.this);
for (TooltipDrawable label : labels) {
contentViewOverlay.remove(label);
}
diff --git a/lib/java/com/google/android/material/transition/MaterialContainerTransform.java b/lib/java/com/google/android/material/transition/MaterialContainerTransform.java
index 293d922fea4..633d6018569 100644
--- a/lib/java/com/google/android/material/transition/MaterialContainerTransform.java
+++ b/lib/java/com/google/android/material/transition/MaterialContainerTransform.java
@@ -70,7 +70,6 @@
import androidx.transition.TransitionValues;
import com.google.android.material.animation.AnimationUtils;
import com.google.android.material.canvas.CanvasCompat.CanvasOperation;
-import com.google.android.material.internal.ViewUtils;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
import com.google.android.material.shape.Shapeable;
@@ -976,7 +975,7 @@ public void onAnimationUpdate(ValueAnimator animation) {
@Override
public void onTransitionStart(@NonNull Transition transition) {
// Add the transition drawable to the root ViewOverlay
- ViewUtils.getOverlay(drawingView).add(transitionDrawable);
+ drawingView.getOverlay().add(transitionDrawable);
// Hide the actual views at the beginning of the transition
startView.setAlpha(0);
@@ -995,7 +994,7 @@ public void onTransitionEnd(@NonNull Transition transition) {
endView.setAlpha(1);
// Remove the transition drawable from the root ViewOverlay
- ViewUtils.getOverlay(drawingView).remove(transitionDrawable);
+ drawingView.getOverlay().remove(transitionDrawable);
}
});
diff --git a/lib/java/com/google/android/material/transition/platform/MaterialContainerTransform.java b/lib/java/com/google/android/material/transition/platform/MaterialContainerTransform.java
index 03b40f94520..eb7d221b75b 100644
--- a/lib/java/com/google/android/material/transition/platform/MaterialContainerTransform.java
+++ b/lib/java/com/google/android/material/transition/platform/MaterialContainerTransform.java
@@ -74,7 +74,6 @@
import android.transition.TransitionValues;
import com.google.android.material.animation.AnimationUtils;
import com.google.android.material.canvas.CanvasCompat.CanvasOperation;
-import com.google.android.material.internal.ViewUtils;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
import com.google.android.material.shape.Shapeable;
@@ -981,7 +980,7 @@ public void onAnimationUpdate(ValueAnimator animation) {
@Override
public void onTransitionStart(@NonNull Transition transition) {
// Add the transition drawable to the root ViewOverlay
- ViewUtils.getOverlay(drawingView).add(transitionDrawable);
+ drawingView.getOverlay().add(transitionDrawable);
// Hide the actual views at the beginning of the transition
startView.setAlpha(0);
@@ -1000,7 +999,7 @@ public void onTransitionEnd(@NonNull Transition transition) {
endView.setAlpha(1);
// Remove the transition drawable from the root ViewOverlay
- ViewUtils.getOverlay(drawingView).remove(transitionDrawable);
+ drawingView.getOverlay().remove(transitionDrawable);
}
});