Skip to content

Commit 88c5d61

Browse files
committed
Add ability to add custom action title in and out animators
1 parent ee85d58 commit 88c5d61

File tree

15 files changed

+161
-26
lines changed

15 files changed

+161
-26
lines changed

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@ android:
77
components:
88
- platform-tools
99
- tools
10-
11-
# The BuildTools version used by your project
12-
- build-tools-24.0.1
13-
14-
# The SDK version used to compile your project
10+
- build-tools-24.0.3
1511
- android-24
16-
17-
# Additional components
1812
- extra-android-m2repository
1913

2014
before_script:

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 24
5-
buildToolsVersion "24.0.1"
5+
buildToolsVersion "24.0.3"
66

77
defaultConfig {
88
applicationId "com.ovenbits.quickactionview.sample"
@@ -26,8 +26,8 @@ android {
2626
dependencies {
2727
compile fileTree(include: ['*.jar'], dir: 'libs')
2828
testCompile 'junit:junit:4.12'
29-
compile 'com.android.support:appcompat-v7:24.1.1'
30-
compile 'com.android.support:design:24.1.1'
31-
compile 'com.android.support:recyclerview-v7:24.1.1'
29+
compile 'com.android.support:appcompat-v7:24.2.1'
30+
compile 'com.android.support:design:24.2.1'
31+
compile 'com.android.support:recyclerview-v7:24.2.1'
3232
compile project(':quickactionview')
3333
}

app/src/main/java/com/ovenbits/quickactionview/sample/Cheese.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
/**
44
* A fake model to show usage
5-
* Created by John on 11/24/15.
65
*/
76
public class Cheese {
87

app/src/main/java/com/ovenbits/quickactionview/sample/CheeseAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
/**
1616
* Adapter for the recyclerview, which holds cheeses
17-
* Created by John on 11/24/15.
1817
*/
1918
public class CheeseAdapter extends RecyclerView.Adapter<CheeseViewHolder> implements QuickActionView.OnActionSelectedListener {
2019

app/src/main/java/com/ovenbits/quickactionview/sample/CheeseViewHolder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
/**
1111
* The view holder related to each Cheese item
12-
* Created by John on 11/24/15.
1312
*/
1413
public class CheeseViewHolder extends RecyclerView.ViewHolder {
1514

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.ovenbits.quickactionview.sample;
2+
3+
import android.view.View;
4+
import android.view.animation.OvershootInterpolator;
5+
6+
import com.ovenbits.quickactionview.Action;
7+
import com.ovenbits.quickactionview.ActionsTitleInAnimator;
8+
import com.ovenbits.quickactionview.ActionsTitleOutAnimator;
9+
10+
/**
11+
* Default animator which animates the action title in and out
12+
*/
13+
public class CustomActionsTitleAnimator implements ActionsTitleInAnimator, ActionsTitleOutAnimator {
14+
15+
private static final int DURATION = 200; //ms
16+
17+
@Override
18+
public void animateActionTitleIn(Action action, int index, View view) {
19+
view.setAlpha(0.0f);
20+
view.setScaleX(0.0f);
21+
view.setScaleY(0.0f);
22+
view.animate()
23+
.alpha(1.0f)
24+
.scaleX(1.0f)
25+
.scaleY(1.0f)
26+
.setInterpolator(new OvershootInterpolator())
27+
.setDuration(DURATION);
28+
}
29+
30+
@Override
31+
public int animateActionTitleOut(Action action, int index, View view) {
32+
view.animate()
33+
.alpha(0.0f)
34+
.scaleX(0.0f)
35+
.scaleY(0.0f)
36+
.setDuration(DURATION);
37+
return DURATION;
38+
}
39+
}

app/src/main/java/com/ovenbits/quickactionview/sample/MainActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void onClick(View v) {
7878
.setTextColor(Color.MAGENTA);
7979

8080
PopAnimator popAnimator = new PopAnimator(true);
81+
CustomActionsTitleAnimator actionTitleAnimator = new CustomActionsTitleAnimator();
8182
QuickActionView qav = QuickActionView.make(this)
8283
.addActions(R.menu.actions_2)
8384
.setOnActionSelectedListener(mQuickActionListener)
@@ -89,6 +90,8 @@ public void onClick(View v) {
8990
.setIndicatorDrawable(ContextCompat.getDrawable(MainActivity.this, R.drawable.indicator))
9091
.setActionConfig(actionConfig, R.id.action_add_to_cart)
9192
.setActionsOutAnimator(popAnimator)
93+
.setActionsTitleInAnimator(actionTitleAnimator)
94+
.setActionsTitleOutAnimator(actionTitleAnimator)
9295
.register(findViewById(R.id.custom_parent));
9396
CustomActionsInAnimator customActionsInAnimator = new CustomActionsInAnimator(qav);
9497
qav.setActionsInAnimator(customActionsInAnimator);

app/src/main/java/com/ovenbits/quickactionview/sample/RecyclerViewActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
/**
1616
* Shows usage of the QuickActionView from within a RecyclerView
17-
* Created by John on 11/24/15.
1817
*/
1918
public class RecyclerViewActivity extends AppCompatActivity {
2019

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.1.2'
9-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
8+
classpath 'com.android.tools.build:gradle:2.2.0'
9+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Oct 21 11:34:03 PDT 2015
1+
#Mon Oct 10 22:22:39 CDT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

0 commit comments

Comments
 (0)