@Override public void setTranslationZ(@NonNull View view, float z) { view.setTranslationZ(z); } }
public void setTranslationZ(float translationZ) { if (translationZ == this.translationZ) return; if (Carbon.IS_PIE_OR_HIGHER) { super.setTranslationZ(translationZ); } else if (Carbon.IS_LOLLIPOP_OR_HIGHER) { if ((ambientShadowColor == null || spotShadowColor == null) && renderingMode == RenderingMode.Auto) { super.setTranslationZ(translationZ); } else { super.setTranslationZ(0); } } else if (translationZ != this.translationZ && getParent() != null) { ((android.view.View) getParent()).postInvalidate(); } this.translationZ = translationZ; }
@Override public void onAnimationEnd(Animator animation) { // Clean up view.getOverlay().clear(); if (!fromFab) { view.setTranslationX(0); view.setTranslationY(0); view.setTranslationZ(0); view.measure( makeMeasureSpec(endBounds.width(), View.MeasureSpec.EXACTLY), makeMeasureSpec(endBounds.height(), View.MeasureSpec.EXACTLY)); view.layout(endBounds.left, endBounds.top, endBounds.right, endBounds.bottom); } } });
@Override public void setElevation(float elevation) { if (Carbon.IS_PIE_OR_HIGHER) { super.setElevation(elevation); super.setTranslationZ(translationZ); } else if (Carbon.IS_LOLLIPOP_OR_HIGHER) { if ((ambientShadowColor == null || spotShadowColor == null) && renderingMode == RenderingMode.Auto) { super.setElevation(elevation); super.setTranslationZ(translationZ); } else { super.setElevation(0); super.setTranslationZ(0); } } else if (elevation != this.elevation && getParent() != null) { ((android.view.View) getParent()).postInvalidate(); } this.elevation = elevation; }
@Test @Config(minSdk = LOLLIPOP) public void translationZ() { view.setTranslationZ(10f); assertThat(view.getTranslationZ()).isEqualTo(10f); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setZTranslations() { //this is only needed to add shadows to cardviews on > lollipop if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int count = getChildCount(); for (int i = 0; i < count; ++i) { getChildAt(i).setTranslationZ(i * 10); } } }
@Override public void onItemClear() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { itemView.setTranslationZ(0); } }
@Override public void onItemSelectedChanged() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { itemView.setTranslationZ(30); } }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAnimationEnd(Animator animation) { holder.itemView.setTranslationZ(8f); } });
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAnimationEnd(Animator animation) { holder.itemView.setTranslationZ(0f); } });
/** * 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)); }
/** * 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); }
private void reset(ViewPropertyAnimator animator, OmegaExpandableRecyclerView.Adapter.ChildViewHolder holder) { animator.setUpdateListener(null); animator.setStartDelay(0); holder.itemView.setTranslationZ(ExpandableLayoutManager.DEFAULT_CHILD_Z); holder.contentView.setTranslationY(0f); ((ChildClippingFrameLayout) holder.itemView).invalidateClipping(); }
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); } }