Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c085bf83 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Changing some lambda to java 1.7 compatible code to allow using the lib...

Merge "Changing some lambda to java 1.7 compatible code to allow using the lib without the system classes"
parents c20873a2 bbc9b6fb
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.view.AppTransitionAnimationSpec;
import android.view.IAppTransitionAnimationSpecsFuture;

import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
@@ -31,8 +32,10 @@ import java.util.concurrent.FutureTask;
public abstract class AppTransitionAnimationSpecsFuture {

    private final Handler mHandler;
    private FutureTask<List<AppTransitionAnimationSpec>> mComposeTask = new FutureTask<>(() -> {
        synchronized (AppTransitionAnimationSpecsFuture.this) {
    private FutureTask<List<AppTransitionAnimationSpec>> mComposeTask = new FutureTask<>(
            new Callable<List<AppTransitionAnimationSpec>>() {
                @Override
                public List<AppTransitionAnimationSpec> call() throws Exception {
                    return composeSpecs();
                }
            });
+21 −13
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public class RecentsTransition {
     */
    public static ActivityOptions createAspectScaleAnimation(Context context, Handler handler,
            boolean scaleUp, AppTransitionAnimationSpecsFuture animationSpecsFuture,
            OnAnimationStartedListener animationStartCallback) {
            final OnAnimationStartedListener animationStartCallback) {
        final OnAnimationStartedListener animStartedListener = new OnAnimationStartedListener() {
            private boolean mHandled;

@@ -70,15 +70,20 @@ public class RecentsTransition {
    /**
     * Wraps a animation-start callback in a binder that can be called from window manager.
     */
    public static IRemoteCallback wrapStartedListener(Handler handler,
            OnAnimationStartedListener listener) {
    public static IRemoteCallback wrapStartedListener(final Handler handler,
            final OnAnimationStartedListener listener) {
        if (listener == null) {
            return null;
        }
        return new IRemoteCallback.Stub() {
            @Override
            public void sendResult(Bundle data) throws RemoteException {
                handler.post(listener::onAnimationStarted);
                handler.post(new Runnable() {
                                 @Override
                                 public void run() {
                                     listener.onAnimationStarted();
                                 }
                             });
            }
        };
    }
@@ -87,9 +92,11 @@ public class RecentsTransition {
     * @return a {@link GraphicBuffer} with the {@param view} drawn into it. Result can be null if
     *         we were unable to allocate a hardware bitmap.
     */
    public static GraphicBuffer drawViewIntoGraphicBuffer(int width, int height, View view,
            float scale, int eraseColor) {
        final Bitmap hwBitmap = createHardwareBitmap(width, height, (c) -> {
    public static GraphicBuffer drawViewIntoGraphicBuffer(int width, int height, final View view,
            final float scale, final int eraseColor) {
        final Bitmap hwBitmap = createHardwareBitmap(width, height, new Consumer<Canvas>() {
            @Override
            public void accept(Canvas c) {
                c.scale(scale, scale);
                if (eraseColor != 0) {
                    c.drawColor(eraseColor);
@@ -97,6 +104,7 @@ public class RecentsTransition {
                if (view != null) {
                    view.draw(c);
                }
            }
        });
        return hwBitmap != null ? hwBitmap.createGraphicBufferHandle() : null;
    }