@Override public void onAnimationEnd(Animator animation) { view.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { final int left = (view.getWidth() - fabBounds.width()) / 2; final int top = (view.getHeight() - fabBounds.height()) / 2; outline.setOval( left, top, left + fabBounds.width(), top + fabBounds.height()); view.setClipToOutline(true); } }); } });
private static void setOutlineProvider(View view, ViewOutlineProvider outlineProvider) { if (outlineProvider != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setOutlineProvider(outlineProvider); } }
private static void unsetOutlineProvider(View view, ViewOutlineProvider outlineProvider) { if (outlineProvider != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setOutlineProvider(ViewOutlineProvider.BACKGROUND); } }
static void setOutlineProvider(View marker, final BalloonMarkerDrawable balloonMarkerDrawable) { marker.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setConvexPath(balloonMarkerDrawable.getPath()); } }); }
@Override @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void setRoundRectShape(Rect rect, float radius){ this.mView.setClipToOutline(true); this.mView.setOutlineProvider(new ViewRoundRectOutlineProvider(radius, rect)); }
final ViewOutlineProvider fabOutlineProvider = view.getOutlineProvider(); view.setOutlineProvider(new ViewOutlineProvider() { boolean hasRun = false;
@Override @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void setOvalRectShape(Rect rect){ this.mView.setClipToOutline(true); this.mView.setOutlineProvider(new ViewOvalRectOutlineProvider(rect)); }
static void setBoundsViewOutlineProvider(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setOutlineProvider(ViewOutlineProvider.BOUNDS); } }
/** * Adds a rectangular outline to a view. This can be useful when you want to add a shadow * to a transparent view. See b/16856049. * @param view view that the outline is added to * @param res The resources file. */ public static void addRectangularOutlineProvider(View view, Resources res) { if (CompatUtils.isLollipopCompatible()) { view.setOutlineProvider(RECT_OUTLINE_PROVIDER); } }
/** * Configures the floating action button, clipping it to a circle and setting its translation z. * @param view The float action button's view. * @param res The resources file. */ public static void setupFloatingActionButton(View view, Resources res) { view.setOutlineProvider(OVAL_OUTLINE_PROVIDER); view.setTranslationZ( res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z)); }
static InsetsUpdater setInsetsOutlineProvider(final View view) { final InsetsOutlineProvider provider = new InsetsOutlineProvider(view); view.setOutlineProvider(provider); return provider; }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void initViewShapeProvider(View targetView) { targetView.setClipToOutline(true); targetView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); } }
@Override public void setOutlineProvider(View view, ViewOutlineProvider provider) { view.setOutlineProvider(new ViewOutlineProviderLollipop(provider)); }
/** * Configures the floating action button, clipping it to a circle and setting its translation z. * @param view The float action button's view. * @param res The resources file. */ public static void setupFloatingActionButton(View view, Resources res) { if (CompatUtils.isLollipopCompatible()) { view.setOutlineProvider(OVAL_OUTLINE_PROVIDER); view.setTranslationZ( res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z)); } }
public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(outlineProvider); revealView.setClipToOutline(true); revealView.setTranslationZ(-elevation); }
public void onAnimationEnd(Animator animation) { revealView.setOutlineProvider(originalProvider); revealView.setClipToOutline(false); revealView.setTranslationZ(0); }
public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(RevealOutlineAnimation.this); revealView.setClipToOutline(true); if (shouldRemoveElevationDuringAnimation()) { revealView.setTranslationZ(-elevation); } }
public void onAnimationEnd(Animator animation) { if (!mWasCanceled) { revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND); revealView.setClipToOutline(false); if (shouldRemoveElevationDuringAnimation()) { revealView.setTranslationZ(0); } } }
public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(RevealOutlineAnimation.this); revealView.setClipToOutline(true); if (shouldRemoveElevationDuringAnimation()) { revealView.setTranslationZ(-elevation); } }
public void onAnimationEnd(Animator animation) { if (!mWasCanceled) { revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND); revealView.setClipToOutline(false); if (shouldRemoveElevationDuringAnimation()) { revealView.setTranslationZ(0); } } }