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
/* | |
* Copyright (C) 2014 Freddie (Musenkishi) Lust-Hed | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. | |
To use the support version of these attributes, remove the android namespace. | |
For instance, "android:colorControlNormal" becomes "colorControlNormal". | |
These attributes will be propagated to their corresponding attributes within the android namespace | |
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix. | |
All Clickable Views: | |
----------- |
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
#!/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/) |
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 SpinnerLoaderView extends View { | |
private final Paint mPaint = new Paint(); | |
/** @see View#View(Context) */ | |
public SpinnerLoaderView(Context context) { | |
super(context); | |
init(); | |
} |
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 SpinnerLoaderView extends View { | |
private static final long ANIMATION_DURATION = 1250L; | |
private ValueAnimator mAnimator; | |
private float mArcStart; | |
private float mArcSize; | |
// ... | |
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 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 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 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 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 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 |
OlderNewer