Skip to content

Commit

Permalink
Fixed some style nits.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt committed Jun 8, 2015
1 parent d48e5b7 commit 39ee777
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions library/src/main/java/com/getkeepsafe/android/multistateanimation/MultiStateAnimation.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit 39ee777

Please sign in to comment.