Skip to content

Commit

Permalink
Use object animator for non v4 support activity
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh committed Aug 9, 2015
1 parent 91c9f34 commit a6734a3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,28 @@ public Builder onDismiss(OnDismissListener onDismissListener) {
return this;
}

/**
* pass in the exact animation delay mentioned in the animator resources
*
* @param enter fragment enter animation
* @param exit fragment exit animation
* @param animDelay delay of animation configured in the anim resources
* @return
*/
public Builder useAnimation(int enter, int exit, int animDelay) {
this.animationResources = new AnimationResources(enter, exit, animDelay);
return this;
}

public Confirm build() {
if (animationResources == null) {
animationResources = new AnimationResources(R.anim.slide_from_bottom, R.anim.slide_to_bottom,
ANIMATION_TIMER);
if (activity instanceof AppCompatActivity) {
animationResources = new AnimationResources(R.anim.slide_from_bottom,
R.anim.slide_to_bottom, ANIMATION_TIMER);
} else {
animationResources = new AnimationResources(R.anim.objanim_slide_from_bottom,
R.anim.objanim_slide_to_bottom, ANIMATION_TIMER);
}
}
return new Confirm(activity, confirmPhrase, askView, positiveText, negativeText,
onConfirm, onCancel, onDismissListener, animationResources);
Expand Down
10 changes: 10 additions & 0 deletions confirmdialog/src/main/res/anim/objanim_slide_from_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:propertyName="y"
android:valueFrom="1000"
android:valueTo="0"
android:valueType="floatType"/>
</set>
10 changes: 10 additions & 0 deletions confirmdialog/src/main/res/anim/objanim_slide_to_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:propertyName="y"
android:valueFrom="1"
android:valueTo="1000"
android:valueType="floatType"/>
</set>
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
VERSION_NAME=1.0.2
VERSION_CODE=3
VERSION_NAME=1.0.3
VERSION_CODE=4
GROUP=com.github.vignesh-iopex

POM_DESCRIPTION=A custom animated Android confirm dialog library
Expand Down

0 comments on commit a6734a3

Please sign in to comment.