Simplify on-fade listener
@@ -161,9 +161,7 @@ public class FadeDrawable extends ArrayDrawable {
*/
public void fadeInLayer(int index) {
mCallOnFadeFinishedListener = index == mActualImageLayer;
- if (index == mActualImageLayer) {
- maybeNotifyOnFadeStarted();
- }
+ maybeNotifyOnFadeStarted(index);
mTransitionState = TRANSITION_STARTING;
mIsLayerOn[index] = true;
@@ -336,6 +334,13 @@ public class FadeDrawable extends ArrayDrawable {
}
}
+ private void maybeNotifyOnFadeStarted(int index) {
+ if (mOnFadeListener != null && index == mActualImageLayer && mCallOnFadeStartedListener) {
+ mOnFadeListener.onFadeStarted();
+ mCallOnFadeStartedListener = false;
+ }
+ }
+
private void maybeNotifyOnFadeFinished() {
if (mOnFadeListener != null && mCallOnFadeFinishedListener) {
mOnFadeListener.onFadeFinished();
@@ -343,13 +348,6 @@ public class FadeDrawable extends ArrayDrawable {
}
}
- private void maybeNotifyOnFadeStarted() {
- if (mOnFadeListener != null && mCallOnFadeStartedListener) {
- mOnFadeListener.onFadeStarted();
- mCallOnFadeStartedListener = false;
- }
- }
-
private void drawDrawableWithAlpha(Canvas canvas, Drawable drawable, int alpha) {
if (drawable != null && alpha > 0) {
mPreventInvalidateCount++;
