-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
235 additions
and
4 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
library/src/main/java/me/donnie/adapter/animation/AlphaInAnimation.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package me.donnie.adapter.animation; | ||
|
||
import android.animation.Animator; | ||
import android.animation.ObjectAnimator; | ||
import android.view.View; | ||
|
||
/** | ||
* @author donnieSky | ||
* @created_at 2017/5/2. | ||
* @description | ||
*/ | ||
|
||
public class AlphaInAnimation implements BaseAnimation { | ||
|
||
private static final float DEFAULT_ALPHA_FROM = 0f; | ||
private final float mFrom; | ||
|
||
public AlphaInAnimation() { | ||
this(DEFAULT_ALPHA_FROM); | ||
} | ||
|
||
public AlphaInAnimation(float from) { | ||
mFrom = from; | ||
} | ||
|
||
@Override | ||
public Animator[] getAnimators(View view) { | ||
return new Animator[]{ObjectAnimator.ofFloat(view, "alpha", mFrom, 1f)}; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
library/src/main/java/me/donnie/adapter/animation/BaseAnimation.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package me.donnie.adapter.animation; | ||
|
||
import android.animation.Animator; | ||
import android.view.View; | ||
|
||
/** | ||
* @author donnieSky | ||
* @created_at 2017/5/2. | ||
* @description | ||
*/ | ||
|
||
public interface BaseAnimation { | ||
|
||
Animator[] getAnimators(View view); | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
library/src/main/java/me/donnie/adapter/animation/ScaleInAnimation.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package me.donnie.adapter.animation; | ||
|
||
import android.animation.Animator; | ||
import android.animation.ObjectAnimator; | ||
import android.view.View; | ||
|
||
/** | ||
* @author donnieSky | ||
* @created_at 2017/5/2. | ||
* @description | ||
*/ | ||
|
||
public class ScaleInAnimation implements BaseAnimation { | ||
|
||
private static final float DEFAULT_SCALE_FROM = .5f; | ||
private final float mFrom; | ||
|
||
public ScaleInAnimation() { | ||
this(DEFAULT_SCALE_FROM); | ||
} | ||
|
||
public ScaleInAnimation(float from) { | ||
mFrom = from; | ||
} | ||
|
||
|
||
@Override | ||
public Animator[] getAnimators(View view) { | ||
ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", mFrom, 1f); | ||
ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", mFrom, 1f); | ||
return new ObjectAnimator[] { scaleX, scaleY }; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
library/src/main/java/me/donnie/adapter/animation/SlideInBottomAnimation.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package me.donnie.adapter.animation; | ||
|
||
import android.animation.Animator; | ||
import android.animation.ObjectAnimator; | ||
import android.view.View; | ||
|
||
/** | ||
* @author donnieSky | ||
* @created_at 2017/5/2. | ||
* @description | ||
*/ | ||
|
||
public class SlideInBottomAnimation implements BaseAnimation { | ||
|
||
@Override | ||
public Animator[] getAnimators(View view) { | ||
return new Animator[]{ | ||
ObjectAnimator.ofFloat(view, "translationY", view.getMeasuredHeight(), 0) | ||
}; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
library/src/main/java/me/donnie/adapter/animation/SlideInLeftAnimation.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package me.donnie.adapter.animation; | ||
|
||
import android.animation.Animator; | ||
import android.animation.ObjectAnimator; | ||
import android.view.View; | ||
|
||
/** | ||
* @author donnieSky | ||
* @created_at 2017/5/2. | ||
* @description | ||
*/ | ||
|
||
public class SlideInLeftAnimation implements BaseAnimation { | ||
@Override | ||
public Animator[] getAnimators(View view) { | ||
return new Animator[] { | ||
ObjectAnimator.ofFloat(view, "translationX", -view.getRootView().getWidth(), 0) | ||
}; | ||
} | ||
} |