private static void unsetClipToOutline(View view, boolean clipToOutline) { if (clipToOutline && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setClipToOutline(false); } }
private static void setClipToOutline(View view, boolean clipToOutline) { if (clipToOutline && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setClipToOutline(clipToOutline); } }
@Override @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void clearShapeStyle() { this.mView.setClipToOutline(false); }
@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)); }
@Override @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void setOvalRectShape(Rect rect){ this.mView.setClipToOutline(true); this.mView.setOutlineProvider(new ViewOvalRectOutlineProvider(rect)); }
@Test @Config(minSdk = LOLLIPOP) public void clipToOutline() { view.setClipToOutline(true); assertThat(view.getClipToOutline()).isTrue(); }
mainActivity.findViewById(R.id.resultLayout).setBackgroundResource(R.drawable.rounded_result_layout); mainActivity.listContainer.setClipToOutline(true); } else {
@Override public void setClipToOutline(View view, boolean clipToOutline) { view.setClipToOutline(clipToOutline); }
public void getOutline(View view, Outline outline) { int fabSize = view.getHeight(); outline.setOval(0, 0, fabSize, fabSize); view.setClipToOutline(true); }
@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()); } }); } }
public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(outlineProvider); revealView.setClipToOutline(true); revealView.setTranslationZ(-elevation); }
@Override public void initialize(CardViewDelegate cardView, Context context, int backgroundColor, float radius) { cardView.setBackgroundDrawable(new RoundRectDrawable(backgroundColor, radius)); View view = (View) cardView; view.setClipToOutline(true); view.setElevation(context.getResources().getDimension(R.dimen.cardview_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); } } }
public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(RevealOutlineAnimation.this); revealView.setClipToOutline(true); if (shouldRemoveElevationDuringAnimation()) { revealView.setTranslationZ(-elevation); } }
@Override public void initialize(CardViewDelegate cardView, Context context, int backgroundColor, float radius, float elevation, float maxElevation, int cornerFlag, int edgesFlag) { final OptRoundRectDrawable backgroundDrawable = new OptRoundRectDrawable(backgroundColor, radius, cornerFlag); cardView.setBackgroundDrawable(backgroundDrawable); View view = (View) cardView; view.setClipToOutline(true); view.setElevation(elevation); setMaxElevation(cardView, maxElevation); }
@Override public void initialize(ToggleGroupDelegate groupView, Context context, ColorStateList backgroundColor, float radius, float elevation, float maxElevation) { final RoundRectDrawable background = new RoundRectDrawable(backgroundColor, radius); groupView.setGroupBackground(background); View view = groupView.getToggleGroup(); view.setClipToOutline(true); view.setElevation(elevation); setMaxElevation(groupView, maxElevation); }