Merge "Add timestamp to ActivityOptions.OnAnimation*Listener" into tm-dev
This commit is contained in:
@@ -168,11 +168,11 @@ package android.app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static interface ActivityOptions.OnAnimationFinishedListener {
|
public static interface ActivityOptions.OnAnimationFinishedListener {
|
||||||
method public void onAnimationFinished();
|
method public void onAnimationFinished(long);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface ActivityOptions.OnAnimationStartedListener {
|
public static interface ActivityOptions.OnAnimationStartedListener {
|
||||||
method public void onAnimationStarted();
|
method public void onAnimationStarted(long);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActivityTaskManager {
|
public class ActivityTaskManager {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ResultReceiver;
|
import android.os.ResultReceiver;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.transition.TransitionManager;
|
import android.transition.TransitionManager;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
@@ -634,9 +635,10 @@ public class ActivityOptions extends ComponentOptions {
|
|||||||
mAnimationStartedListener = new IRemoteCallback.Stub() {
|
mAnimationStartedListener = new IRemoteCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void sendResult(Bundle data) throws RemoteException {
|
public void sendResult(Bundle data) throws RemoteException {
|
||||||
|
final long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
listener.onAnimationStarted();
|
listener.onAnimationStarted(elapsedRealtime);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -645,13 +647,15 @@ public class ActivityOptions extends ComponentOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation}
|
* Callback for finding out when the given animation has started running.
|
||||||
* to find out when the given animation has started running.
|
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@TestApi
|
@TestApi
|
||||||
public interface OnAnimationStartedListener {
|
public interface OnAnimationStartedListener {
|
||||||
void onAnimationStarted();
|
/**
|
||||||
|
* @param elapsedRealTime {@link SystemClock#elapsedRealTime} when animation started.
|
||||||
|
*/
|
||||||
|
void onAnimationStarted(long elapsedRealTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOnAnimationFinishedListener(final Handler handler,
|
private void setOnAnimationFinishedListener(final Handler handler,
|
||||||
@@ -660,10 +664,11 @@ public class ActivityOptions extends ComponentOptions {
|
|||||||
mAnimationFinishedListener = new IRemoteCallback.Stub() {
|
mAnimationFinishedListener = new IRemoteCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void sendResult(Bundle data) throws RemoteException {
|
public void sendResult(Bundle data) throws RemoteException {
|
||||||
|
final long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
listener.onAnimationFinished();
|
listener.onAnimationFinished(elapsedRealtime);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -672,13 +677,15 @@ public class ActivityOptions extends ComponentOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for use with {@link ActivityOptions#makeThumbnailAspectScaleDownAnimation}
|
* Callback for finding out when the given animation has drawn its last frame.
|
||||||
* to find out when the given animation has drawn its last frame.
|
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@TestApi
|
@TestApi
|
||||||
public interface OnAnimationFinishedListener {
|
public interface OnAnimationFinishedListener {
|
||||||
void onAnimationFinished();
|
/**
|
||||||
|
* @param elapsedRealTime {@link SystemClock#elapsedRealTime} when animation finished.
|
||||||
|
*/
|
||||||
|
void onAnimationFinished(long elapsedRealTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class RecentsTransition {
|
|||||||
private boolean mHandled;
|
private boolean mHandled;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStarted() {
|
public void onAnimationStarted(long elapsedRealTime) {
|
||||||
// OnAnimationStartedListener can be called numerous times, so debounce here to
|
// OnAnimationStartedListener can be called numerous times, so debounce here to
|
||||||
// prevent multiple callbacks
|
// prevent multiple callbacks
|
||||||
if (mHandled) {
|
if (mHandled) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public abstract class ActivityOptionsCompat {
|
|||||||
callbackHandler,
|
callbackHandler,
|
||||||
new ActivityOptions.OnAnimationStartedListener() {
|
new ActivityOptions.OnAnimationStartedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStarted() {
|
public void onAnimationStarted(long elapsedRealTime) {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callbackHandler.post(callback);
|
callbackHandler.post(callback);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user