From 64d987a35a884efdd0e7bb5be836f73bb129e0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Kwiecie=C5=84?= Date: Sat, 11 Jul 2015 18:16:07 +0200 Subject: [PATCH] logs and concurency fixes --- switcher-library/build.gradle | 4 ++-- .../pl/aprilapps/switcher/Animations.java | 24 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/switcher-library/build.gradle b/switcher-library/build.gradle index 1187e02..3ffbe23 100644 --- a/switcher-library/build.gradle +++ b/switcher-library/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 22 - versionCode 11 - versionName "1.1.1" + versionCode 12 + versionName "1.1.2" renderscriptTargetApi 22 renderscriptSupportModeEnabled true } diff --git a/switcher-library/src/main/java/pl/aprilapps/switcher/Animations.java b/switcher-library/src/main/java/pl/aprilapps/switcher/Animations.java index c933375..4c6c230 100644 --- a/switcher-library/src/main/java/pl/aprilapps/switcher/Animations.java +++ b/switcher-library/src/main/java/pl/aprilapps/switcher/Animations.java @@ -54,14 +54,22 @@ public FadeInListener(View view) { this.view = view; } + @Override + public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); + Log.i(Switcher.class.getSimpleName(), String.format("fadeIn START: %s", view.getContext().getResources().getResourceName(view.getId()))); + } + @Override public void onAnimationEnd(Animator animation) { onAnimationEnd(); } public void onAnimationEnd() { - Log.i(Switcher.class.getSimpleName(), String.format("fadeIn END: %s", view.getContext().getResources().getResourceName(view.getId()))); - view.setVisibility(View.VISIBLE); + if (view.getVisibility() != View.VISIBLE) { + Log.i(Switcher.class.getSimpleName(), String.format("fadeIn END: %s", view.getContext().getResources().getResourceName(view.getId()))); + view.setVisibility(View.VISIBLE); + } } } @@ -73,14 +81,22 @@ public FadeOutListener(View view) { this.view = view; } + @Override + public void onAnimationStart(Animator animation) { + super.onAnimationStart(animation); + Log.i(Switcher.class.getSimpleName(), String.format("fadeOut START: %s", view.getContext().getResources().getResourceName(view.getId()))); + } + @Override public void onAnimationEnd(Animator animation) { onAnimationEnd(); } public void onAnimationEnd() { - Log.i(Switcher.class.getSimpleName(), String.format("fadeOut END: %s", view.getContext().getResources().getResourceName(view.getId()))); - view.setVisibility(View.INVISIBLE); + if (view.getVisibility() == View.VISIBLE) { + Log.i(Switcher.class.getSimpleName(), String.format("fadeOut END: %s", view.getContext().getResources().getResourceName(view.getId()))); + view.setVisibility(View.INVISIBLE); + } } } }