@Override public void onAnimationEnd(Animator animation) { v.setLayerType(View.LAYER_TYPE_NONE, null); } });
@Override public void onAnimationEnd(Animator animation) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { v.setLayerType(View.LAYER_TYPE_NONE, null); } } });
@Override public void run() { mView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } });
@Override public void run() { mView.setLayerType(View.LAYER_TYPE_NONE, null); } });
@Override public void onAnimationEnd(Animator animation) { mView.setLayerType(View.LAYER_TYPE_NONE, null); }
@Override public void onAnimationCancel(Animator animation) { mView.setLayerType(View.LAYER_TYPE_NONE, null); }
@Override public void onAnimationEnd(Animator animator) { mView.setAlpha(mEndListenerAlpha); if (mLayerTypeChanged) { mView.setLayerType(View.LAYER_TYPE_NONE, null); } }
/** * Enables the `LAYER_TYPE_SOFTWARE` for the view holding this icon, * to enable correct shadowLayer drawing * * @param view the view holding this `IconicsDrawable` * @return The current IconicsDrawable for chaining. * @see View#setLayerType(int, Paint) */ @NonNull public IconicsDrawable enableShadowSupport(@NonNull View view) { view.setLayerType(LAYER_TYPE_SOFTWARE, null); return this; }
private void translateWidgets(int deltaX, View... views) { for (final View v : views) { v.setLayerType(View.LAYER_TYPE_HARDWARE, null); v.animate().translationXBy(deltaX).setDuration(ANIM_DURATION) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { v.setLayerType(View.LAYER_TYPE_NONE, null); } }); } }
private void setSheetLayerTypeIfEnabled(int layerType) { if (useHardwareLayerWhileAnimating) { getSheetView().setLayerType(layerType, null); } }
@Override public void onAnimationEnd(Animator animation) { mReveal.setRevealEnable(false); if (!API_SUPPORT_CANVAS_CLIP_PATH) { mView.setLayerType(View.LAYER_TYPE_NONE, null); } } }
@Override public void onAnimationStart(Animator animation) { if (!API_SUPPORT_CANVAS_CLIP_PATH) { mView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } mReveal.setRevealEnable(true); }
@Override public void onAnimationEnd(Animator animation) { ((View) mReference.get()).setLayerType(mLayerType, null); super.onAnimationEnd(animation); } }
@Override public void onAnimationStart(Animator animation) { ((View) mReference.get()).setLayerType(mFeaturedLayerType, null); super.onAnimationStart(animation); }
@Override public void onAnimationCancel(Animator animation) { ((View) mReference.get()).setLayerType(mLayerType, null); super.onAnimationEnd(animation); }
/** * Constructor * {@inheritDoc} */ public WaveView(Context context) { super(context); // setUpPaint(); final View thisView = this; float density = thisView.getResources().getDisplayMetrics().density; mPaint = new Paint(); mPaint.setColor(0xff2196F3); mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.FILL); mPaint.setShadowLayer((int) (0.5f + 2.0f * density), 0f, 0f, SHADOW_COLOR); // setUpPath(); mWavePath = new Path(); mDropTangentPath = new Path(); mDropCirclePath = new Path(); mShadowPath = new Path(); resetAnimator(); mDropRect = new RectF(); thisView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); thisView.getViewTreeObserver().addOnPreDrawListener(this); }
public WaterDropView(Context context) { super(context); final View thisView = this; topCircle = new Circle(); bottomCircle = new Circle(); mPath = new Path(); mPaint = new Paint(); mPaint.setColor(Color.GRAY); mPaint.setAntiAlias(true); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStrokeWidth(STROKE_WIDTH = DensityUtil.dp2px(1f)); mPaint.setShadowLayer(STROKE_WIDTH, STROKE_WIDTH/2, STROKE_WIDTH, 0x99000000); thisView.setLayerType(LAYER_TYPE_SOFTWARE, null); int padding = 4 * STROKE_WIDTH; thisView.setPadding(padding, padding, padding, padding); mPaint.setColor(Color.GRAY); mMaxCircleRadius = DensityUtil.dp2px(20); mMinCircleRadius = mMaxCircleRadius / 5; topCircle.radius = (mMaxCircleRadius); bottomCircle.radius = (mMaxCircleRadius); topCircle.x = (STROKE_WIDTH + mMaxCircleRadius); topCircle.y = (STROKE_WIDTH + mMaxCircleRadius); bottomCircle.x = (STROKE_WIDTH + mMaxCircleRadius); bottomCircle.y = (STROKE_WIDTH + mMaxCircleRadius); }
@Override public void onAnimationStart(Animator animator) { if (AnimatorUtils.hasOverlappingRendering(mView) && mView.getLayerType() == View.LAYER_TYPE_NONE) { mLayerTypeChanged = true; mView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } }
@SuppressWarnings("deprecation") public CircleImageView(Context context, int color) { super(context); final View thisView = this; final float density = thisView.getResources().getDisplayMetrics().density; final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_OFFSET); mShadowRadius = (int) (density * SHADOW_RADIUS); ShapeDrawable circle; if (android.os.Build.VERSION.SDK_INT >= 21) { circle = new ShapeDrawable(new OvalShape()); thisView.setElevation(SHADOW_ELEVATION * density); } else { OvalShape oval = new OvalShadow(mShadowRadius); circle = new ShapeDrawable(oval); thisView.setLayerType(LAYER_TYPE_SOFTWARE, circle.getPaint()); circle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); final int padding = mShadowRadius; // set padding so the inner image sits correctly within the shadow. thisView.setPadding(padding, padding, padding, padding); } circle.getPaint().setColor(color); if (Build.VERSION.SDK_INT >= 16) { thisView.setBackground(circle); } else { thisView.setBackgroundDrawable(circle); } }
@Test public void layerType() throws Exception { assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_NONE); view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_SOFTWARE); }