-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to add custom action title in and out animators
- Loading branch information
Showing
15 changed files
with
161 additions
and
26 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
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
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
/** | ||
* A fake model to show usage | ||
* Created by John on 11/24/15. | ||
*/ | ||
public class Cheese { | ||
|
||
|
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
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
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/ovenbits/quickactionview/sample/CustomActionsTitleAnimator.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,39 @@ | ||
package com.ovenbits.quickactionview.sample; | ||
|
||
import android.view.View; | ||
import android.view.animation.OvershootInterpolator; | ||
|
||
import com.ovenbits.quickactionview.Action; | ||
import com.ovenbits.quickactionview.ActionsTitleInAnimator; | ||
import com.ovenbits.quickactionview.ActionsTitleOutAnimator; | ||
|
||
/** | ||
* Default animator which animates the action title in and out | ||
*/ | ||
public class CustomActionsTitleAnimator implements ActionsTitleInAnimator, ActionsTitleOutAnimator { | ||
|
||
private static final int DURATION = 200; //ms | ||
|
||
@Override | ||
public void animateActionTitleIn(Action action, int index, View view) { | ||
view.setAlpha(0.0f); | ||
view.setScaleX(0.0f); | ||
view.setScaleY(0.0f); | ||
view.animate() | ||
.alpha(1.0f) | ||
.scaleX(1.0f) | ||
.scaleY(1.0f) | ||
.setInterpolator(new OvershootInterpolator()) | ||
.setDuration(DURATION); | ||
} | ||
|
||
@Override | ||
public int animateActionTitleOut(Action action, int index, View view) { | ||
view.animate() | ||
.alpha(0.0f) | ||
.scaleX(0.0f) | ||
.scaleY(0.0f) | ||
.setDuration(DURATION); | ||
return DURATION; | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Oct 21 11:34:03 PDT 2015 | ||
#Mon Oct 10 22:22:39 CDT 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip |
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
17 changes: 17 additions & 0 deletions
17
quickactionview/src/main/java/com/ovenbits/quickactionview/ActionsTitleInAnimator.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,17 @@ | ||
package com.ovenbits.quickactionview; | ||
|
||
import android.view.View; | ||
|
||
/** | ||
* Custom animations for an {@link Action} label animating in | ||
*/ | ||
public interface ActionsTitleInAnimator { | ||
|
||
/** | ||
* Animate the action title view as the QuickActionView action title appears | ||
* @param action The action being animated | ||
* @param index The position of the action in its parent | ||
* @param view The action title view | ||
*/ | ||
void animateActionTitleIn(Action action, int index, View view); | ||
} |
19 changes: 19 additions & 0 deletions
19
quickactionview/src/main/java/com/ovenbits/quickactionview/ActionsTitleOutAnimator.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,19 @@ | ||
package com.ovenbits.quickactionview; | ||
|
||
import android.view.View; | ||
|
||
/** | ||
* Custom animations for an {@link Action} label animating in | ||
*/ | ||
public interface ActionsTitleOutAnimator { | ||
|
||
/** | ||
* Animate the action title view as the QuickActionView action title disappears | ||
* @param action The action being animated | ||
* @param index The position of the action in its parent | ||
* @param view The action title view | ||
* @return The duration of this animation, in milliseconds, so that the view can be properly | ||
* hidden when the animation completes | ||
*/ | ||
int animateActionTitleOut(Action action, int index, View view); | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...rc/main/java/com/ovenbits/quickactionview/animator/FadeInFadeOutActionsTitleAnimator.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,35 @@ | ||
package com.ovenbits.quickactionview.animator; | ||
|
||
import android.view.View; | ||
|
||
import com.ovenbits.quickactionview.Action; | ||
import com.ovenbits.quickactionview.ActionsTitleInAnimator; | ||
import com.ovenbits.quickactionview.ActionsTitleOutAnimator; | ||
|
||
/** | ||
* Default animator which animates the action title in and out | ||
*/ | ||
public class FadeInFadeOutActionsTitleAnimator implements ActionsTitleInAnimator, ActionsTitleOutAnimator { | ||
|
||
private int mDuration; //ms | ||
|
||
public FadeInFadeOutActionsTitleAnimator() { | ||
this(100); | ||
} | ||
|
||
public FadeInFadeOutActionsTitleAnimator(int duration) { | ||
mDuration = duration; | ||
} | ||
|
||
@Override | ||
public void animateActionTitleIn(Action action, int index, View view) { | ||
view.setAlpha(0.0f); | ||
view.animate().alpha(1.0f).setDuration(mDuration); | ||
} | ||
|
||
@Override | ||
public int animateActionTitleOut(Action action, int index, View view) { | ||
view.animate().alpha(0.0f).setDuration(mDuration); | ||
return mDuration; | ||
} | ||
} |