From a6734a33ddbc4b5e9eae912189572d2e7801f5e2 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Sun, 9 Aug 2015 18:04:55 +0530 Subject: [PATCH] Use object animator for non v4 support activity #4 --- .../vignesh_iopex/confirmdialog/Confirm.java | 17 +++++++++++++++-- .../main/res/anim/objanim_slide_from_bottom.xml | 10 ++++++++++ .../main/res/anim/objanim_slide_to_bottom.xml | 10 ++++++++++ gradle.properties | 4 ++-- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 confirmdialog/src/main/res/anim/objanim_slide_from_bottom.xml create mode 100644 confirmdialog/src/main/res/anim/objanim_slide_to_bottom.xml diff --git a/confirmdialog/src/main/java/com/github/vignesh_iopex/confirmdialog/Confirm.java b/confirmdialog/src/main/java/com/github/vignesh_iopex/confirmdialog/Confirm.java index e85d494..16f5f67 100644 --- a/confirmdialog/src/main/java/com/github/vignesh_iopex/confirmdialog/Confirm.java +++ b/confirmdialog/src/main/java/com/github/vignesh_iopex/confirmdialog/Confirm.java @@ -156,6 +156,14 @@ 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; @@ -163,8 +171,13 @@ public Builder useAnimation(int enter, int exit, int animDelay) { 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); diff --git a/confirmdialog/src/main/res/anim/objanim_slide_from_bottom.xml b/confirmdialog/src/main/res/anim/objanim_slide_from_bottom.xml new file mode 100644 index 0000000..f306ed2 --- /dev/null +++ b/confirmdialog/src/main/res/anim/objanim_slide_from_bottom.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/confirmdialog/src/main/res/anim/objanim_slide_to_bottom.xml b/confirmdialog/src/main/res/anim/objanim_slide_to_bottom.xml new file mode 100644 index 0000000..e198336 --- /dev/null +++ b/confirmdialog/src/main/res/anim/objanim_slide_to_bottom.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 4db1721..3b7f2a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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