You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
call onAnimationStart() / onAnimationStop() callbacks from View.startAnimation()
This commit is contained in:
@@ -1732,7 +1732,15 @@ public class View implements Drawable.Callback {
|
|||||||
|
|
||||||
public void setOnCreateContextMenuListener (View.OnCreateContextMenuListener l) {}
|
public void setOnCreateContextMenuListener (View.OnCreateContextMenuListener l) {}
|
||||||
|
|
||||||
public void startAnimation(Animation animation) {}
|
protected void onAnimationStart() {}
|
||||||
|
|
||||||
|
protected void onAnimationEnd() {}
|
||||||
|
|
||||||
|
public void startAnimation(Animation animation) {
|
||||||
|
onAnimationStart();
|
||||||
|
animation.start();
|
||||||
|
onAnimationEnd();
|
||||||
|
}
|
||||||
|
|
||||||
public void getDrawingRect(Rect rect) {
|
public void getDrawingRect(Rect rect) {
|
||||||
rect.left = getScrollX();
|
rect.left = getScrollX();
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package android.view.animation;
|
package android.view.animation;
|
||||||
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
|
|
||||||
public class Animation {
|
public class Animation {
|
||||||
|
|
||||||
public interface AnimationListener {
|
public interface AnimationListener {
|
||||||
@@ -11,6 +8,8 @@ public class Animation {
|
|||||||
public void onAnimationStart(Animation animation);
|
public void onAnimationStart(Animation animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AnimationListener listener;
|
||||||
|
|
||||||
public void setDuration(long durationMillis) {}
|
public void setDuration(long durationMillis) {}
|
||||||
|
|
||||||
public void setInterpolator(Interpolator i) {}
|
public void setInterpolator(Interpolator i) {}
|
||||||
@@ -23,12 +22,7 @@ public class Animation {
|
|||||||
public void setStartOffset(long offset) {}
|
public void setStartOffset(long offset) {}
|
||||||
|
|
||||||
public void setAnimationListener(AnimationListener l) {
|
public void setAnimationListener(AnimationListener l) {
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
this.listener = l;
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
l.onAnimationEnd(Animation.this); // FIXME
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRepeatCount(int count) {}
|
public void setRepeatCount(int count) {}
|
||||||
@@ -37,5 +31,14 @@ public class Animation {
|
|||||||
|
|
||||||
public void reset() {}
|
public void reset() {}
|
||||||
|
|
||||||
public void start() {}
|
public void start() {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onAnimationStart(this);
|
||||||
|
listener.onAnimationEnd(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasStarted() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user