From 39ee777dd531902ff1acccba726b9de57999a946 Mon Sep 17 00:00:00 2001 From: AJ Date: Mon, 8 Jun 2015 16:00:58 -0700 Subject: [PATCH] Fixed some style nits. --- .../multistateanimation/MultiStateAnimation.java | 16 +++++++++------- .../NotifyingAnimationDrawable.java | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) mode change 100755 => 100644 library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java mode change 100755 => 100644 library/src/main/java/com/getkeepsafe/android/multistateanimation/NotifyingAnimationDrawable.java diff --git a/library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java b/library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java old mode 100755 new mode 100644 index 72e70b8..3a19852 --- a/library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java +++ b/library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java @@ -1,6 +1,6 @@ package com.getkeepsafe.android.multistateanimation; -import android.annotation.SuppressLint; +import android.annotation.TargetApi; import android.content.Context; import android.graphics.drawable.AnimationDrawable; import android.os.Build; @@ -422,13 +422,14 @@ public String getTransitioningFromId() { * * @param drawable The drawable to play. */ - @SuppressLint("NewApi") + @TargetApi(16) private void playDrawable(NotifyingAnimationDrawable drawable) { mCurrentDrawable = drawable; mCurrentDrawable.setAnimationFinishedListener(this); - if (mListener.get() != null) { - mListener.get().onAnimationStarting(); + AnimationSeriesListener listener = mListener.get(); + if (listener != null) { + listener.onAnimationStarting(); } if (mView != null) { @@ -471,7 +472,7 @@ public void queueTransition(String id) { public void transitionNow(String id) { AnimationSection newSection = mSectionsById.get(id); if (newSection == null) { - throw new RuntimeException("transitionNow called with invalid id: " + id); + throw new IllegalArgumentException("transitionNow called with invalid id: " + id); } // If the section has a transition from the old section, play the @@ -514,8 +515,9 @@ public void clearAnimation() { */ @Override public void onAnimationFinished() { - if (mListener.get() != null) { - mListener.get().onAnimationFinished(); + AnimationSeriesListener listener = mListener.get(); + if (listener != null) { + listener.onAnimationFinished(); } if (mTransitioningFromId != null) { mTransitioningFromId = null; diff --git a/library/src/main/java/com/getkeepsafe/android/multistateanimation/NotifyingAnimationDrawable.java b/library/src/main/java/com/getkeepsafe/android/multistateanimation/NotifyingAnimationDrawable.java old mode 100755 new mode 100644 index 39f85e7..bd92a54 --- a/library/src/main/java/com/getkeepsafe/android/multistateanimation/NotifyingAnimationDrawable.java +++ b/library/src/main/java/com/getkeepsafe/android/multistateanimation/NotifyingAnimationDrawable.java @@ -67,8 +67,9 @@ public boolean selectDrawable(int idx) { if (idx != 0 && idx == getNumberOfFrames() - 1) { if (!mFinished || !isOneShot()) { mFinished = true; - if (mListener.get() != null) { - mListener.get().onAnimationFinished(); + OnAnimationFinishedListener listener = mListener.get(); + if (listener != null) { + listener.onAnimationFinished(); } } }