This file contains hidden or 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 void runLayoutAnimation(final RecyclerView recyclerView) { | |
final Context context = recyclerView.getContext(); | |
final LayoutAnimationController controller = | |
AnimationUtils.loadLayoutAnimation(context, R.anim.layout_animation_fall_down); | |
recyclerView.setLayoutAnimation(controller); | |
recyclerView.getAdapter().notifyDataSetChanged(); | |
recyclerView.scheduleLayoutAnimation(); | |
} |
This file contains hidden or 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"?> | |
<layoutAnimation | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:animation="@anim/item_animation_fall_down" | |
android:delay="15%" | |
android:animationOrder="normal" | |
/> |
This file contains hidden or 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
<set xmlns:android="http://schemas.android.com/apk/res/android" | |
android:duration="@integer/anim_duration_medium"> | |
<translate | |
android:fromYDelta="-20%" | |
android:toYDelta="0" | |
android:interpolator="@android:anim/decelerate_interpolator" | |
/> | |
<alpha |
This file contains hidden or 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
int resId = R.anim.layout_animation_fall_down; | |
LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(ctx, resId); | |
recyclerview.setLayoutAnimation(animation); |
This file contains hidden or 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
@Override | |
protected void onDraw(Canvas canvas) { | |
// 1. The size of the base circle | |
// 2. Where the arc starts in degrees | |
// 3. The size of the arc in degrees, starting at #2 | |
// 4. If the arc should be drawn as a pie, false makes it a stroke | |
// 5. The paint to use | |
canvas.drawArc(mArcBounds, mArcStart, mArcSize, false, mPaint); | |
} |
This file contains hidden or 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 SpinnerLoaderView extends View { | |
private final RectF mArcBounds = new RectF(); | |
private final Paint mPaint = new Paint(); | |
// ... | |
@Override | |
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { | |
super.onSizeChanged(width, height, oldWidth, oldHeight); |
This file contains hidden or 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 float calculateArcSize(float animationProgress) { | |
final double adjustedProgress = Math.sin(animationProgress * Math.PI); | |
// ARC_MAX_DEGREES is the maximum size the arc will have in degrees. | |
// ARC_MAX_DEGREES = 180 means that at it's largest it will cover | |
// half the circle. | |
return (float) adjustedProgress * -ARC_MAX_DEGREES; | |
} | |
private float calculateArcStart(float animationProgress) { | |
final float deceleratedProgress = mDecelerateInterpolator.getInterpolation(animationProgress); |
This file contains hidden or 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 SpinnerLoaderView extends View { | |
private static final long ANIMATION_DURATION = 1250L; | |
private ValueAnimator mAnimator; | |
private float mArcStart; | |
private float mArcSize; | |
// ... | |
This file contains hidden or 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 SpinnerLoaderView extends View { | |
private final Paint mPaint = new Paint(); | |
/** @see View#View(Context) */ | |
public SpinnerLoaderView(Context context) { | |
super(context); | |
init(); | |
} |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# This pre-commit hook will prevent any commit to forbidden branches | |
# (by default, "staging" and "production"). | |
# Put this file in your local repo, in the .git/hooks folder | |
# and make sure it is executable. | |
# The name of the file *must* be "pre-commit" for Git to pick it up. | |
def current_branch() | |
branches = `git branch --no-color`.split(/\n/) |