This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimatedLayout extends ConstraintLayout { | |
... | |
private CircleImageView mWeatherIcon; | |
... | |
@Override | |
protected void onFinishInflate() { | |
super.onFinishInflate(); | |
... | |
mWeatherIcon = findViewById(R.id.weatherIconIV); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<com.example.animated.article.custom.AnimatedLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/transformItem" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean draw(Canvas canvas) { | |
canvas.clipRect(mBounds.left, | |
mBounds.top, | |
mBounds.right, | |
mBounds.bottom + mBounds.bottom * BlUR_RADIUS_FACTOR); | |
... | |
// mPaint.setAlpha((int) (0xff * mGlowAlpha)); alpha is not going to be changed during animation | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setSize(int width, int height) { | |
... | |
mPaint.setMaskFilter(new BlurMaskFilter(mBounds.bottom * BlUR_RADIUS_FACTOR, | |
BlurMaskFilter.Blur.NORMAL)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GlowingEdgeEffectFactory extends RecyclerView.EdgeEffectFactory { | |
@NonNull | |
@Override | |
protected EdgeEffect createEdgeEffect(@NonNull RecyclerView view, int direction) { | |
return new GlowingEdgeEffect(view.getContext()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DistortEdgeEffect { | |
... | |
private static final float RADIUS_FACTOR = 1f; //not nessesary but I have changed it from 0.6 to 1 | |
private final int HORIZONTAL_STEPS_COUNT = 40; // as more steps as more smoother it looks | |
private float[] mDistrotedVertices; | |
private float mStepWidth; | |
... | |
public void setSize(int width, int height) { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DistortEdgeEffect { | |
... | |
private int mFulHeight; | |
private int mFullWidth; | |
private float maxDistortionHeight; | |
... | |
public void setSize(int width, int height) { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
private Bitmap mBitmap; | |
... | |
private void initScrollView() { | |
... | |
Resources res = getResources(); | |
mBitmap = BitmapFactory.decodeResource(res, R.drawable.hand_rope); | |
mBitmap = Bitmap.createScaledBitmap(mBitmap, mBitmap.getWidth() / 2, | |
mBitmap.getHeight() / 2, false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<com.example.replica.NestedScrollView | |
android:layout_height="match_parent" | |
android:layout_width="match_parent" | |
android:background="@color/overscroll_background"> | |
<androidx.cardview.widget.CardView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:elevation="8dp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean useEdgeEffect = false; | |
... | |
@Override | |
public boolean onTouchEvent(MotionEvent ev) { | |
... | |
// if (canOverscroll) { | |
if (useEdgeEffect) { | |
deltaY -= mScrollConsumed[1]; |