Search in sources :

Example 1 with FallbackRecentsView

use of com.android.quickstep.fallback.FallbackRecentsView in project Neo-Launcher by NeoApplications.

the class FallbackActivityControllerHelper method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible, boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
    if (activityVisible) {
        return (transitionLength) -> {
        };
    }
    FallbackRecentsView rv = activity.getOverviewPanel();
    rv.setContentAlpha(0);
    rv.getClearAllButton().setVisibilityAlpha(0);
    rv.setDisallowScrollToClearAll(true);
    boolean fromState = !animateActivity;
    rv.setInOverviewState(fromState);
    return new AnimationFactory() {

        boolean isAnimatingToRecents = false;

        @Override
        public void onRemoteAnimationReceived(RemoteAnimationTargetSet targets) {
            isAnimatingToRecents = targets != null && targets.isAnimatingHome();
            if (!isAnimatingToRecents) {
                rv.setContentAlpha(1);
            }
            createActivityController(getSwipeUpDestinationAndLength(activity.getDeviceProfile(), activity, new Rect()));
        }

        @Override
        public void createActivityController(long transitionLength) {
            AnimatorSet animatorSet = new AnimatorSet();
            if (isAnimatingToRecents) {
                ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
                anim.setDuration(transitionLength).setInterpolator(LINEAR);
                animatorSet.play(anim);
            }
            ObjectAnimator anim = ObjectAnimator.ofFloat(rv, ZOOM_PROGRESS, 1, 0);
            anim.setDuration(transitionLength).setInterpolator(LINEAR);
            animatorSet.play(anim);
            AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(animatorSet, transitionLength);
            // Since we are changing the start position of the UI, reapply the state, at the end
            controller.setEndAction(() -> {
                boolean endState = true;
                rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5 ? endState : fromState);
            });
            callback.accept(controller);
        }
    };
}
Also used : RectF(android.graphics.RectF) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) Context(android.content.Context) Rect(android.graphics.Rect) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) CONTENT_ALPHA(com.android.quickstep.views.RecentsView.CONTENT_ALPHA) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet) NonNull(androidx.annotation.NonNull) ObjectAnimator(android.animation.ObjectAnimator) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Animator(android.animation.Animator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) DeviceProfile(com.android.launcher3.DeviceProfile) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) BiPredicate(java.util.function.BiPredicate) NO_BUTTON(com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON) Nullable(androidx.annotation.Nullable) AnimatorSet(android.animation.AnimatorSet) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener) RecentsView(com.android.quickstep.views.RecentsView) ZOOM_PROGRESS(com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS) LayoutUtils(com.android.quickstep.util.LayoutUtils) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Rect(android.graphics.Rect) ObjectAnimator(android.animation.ObjectAnimator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) AnimatorSet(android.animation.AnimatorSet) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet)

Example 2 with FallbackRecentsView

use of com.android.quickstep.fallback.FallbackRecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsActivityTest method testRecents_showCurrentTask.

@Test
public void testRecents_showCurrentTask() {
    ActivityController<RecentsActivity> controller = Robolectric.buildActivity(RecentsActivity.class);
    RecentsActivity activity = controller.setup().get();
    doLayout(activity);
    FallbackRecentsView frv = activity.getOverviewPanel();
    RunningTaskInfo placeholderTask = new RunningTaskInfo();
    placeholderTask.taskId = 22;
    frv.showCurrentTask(placeholderTask);
    doLayout(activity);
    ThumbnailData thumbnailData = new ThumbnailData();
    ReflectionHelpers.setField(thumbnailData, "thumbnail", Bitmap.createBitmap(300, 500, Config.ARGB_8888));
    frv.switchToScreenshot(thumbnailData, () -> {
    });
    ShadowLooper.idleMainLooper();
}
Also used : FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) RunningTaskInfo(android.app.ActivityManager.RunningTaskInfo) Test(org.junit.Test)

Example 3 with FallbackRecentsView

use of com.android.quickstep.fallback.FallbackRecentsView in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsActivityTest method testRecents_showCurrentTask.

@Test
public void testRecents_showCurrentTask() {
    ActivityController<RecentsActivity> controller = Robolectric.buildActivity(RecentsActivity.class);
    RecentsActivity activity = controller.setup().get();
    doLayout(activity);
    FallbackRecentsView frv = activity.getOverviewPanel();
    RunningTaskInfo dummyTask = new RunningTaskInfo();
    dummyTask.taskId = 22;
    frv.showCurrentTask(dummyTask);
    doLayout(activity);
    ThumbnailData thumbnailData = new ThumbnailData();
    ReflectionHelpers.setField(thumbnailData, "thumbnail", Bitmap.createBitmap(300, 500, Config.ARGB_8888));
    frv.switchToScreenshot(thumbnailData, () -> {
    });
    ShadowLooper.idleMainLooper();
}
Also used : FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) RunningTaskInfo(android.app.ActivityManager.RunningTaskInfo) Test(org.junit.Test)

Aggregations

FallbackRecentsView (com.android.quickstep.fallback.FallbackRecentsView)3 RunningTaskInfo (android.app.ActivityManager.RunningTaskInfo)2 ThumbnailData (com.android.systemui.shared.recents.model.ThumbnailData)2 Test (org.junit.Test)2 Animator (android.animation.Animator)1 AnimatorSet (android.animation.AnimatorSet)1 ObjectAnimator (android.animation.ObjectAnimator)1 Context (android.content.Context)1 Rect (android.graphics.Rect)1 RectF (android.graphics.RectF)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 DeviceProfile (com.android.launcher3.DeviceProfile)1 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)1 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)1 LINEAR (com.android.launcher3.anim.Interpolators.LINEAR)1 LauncherLogProto (com.android.launcher3.userevent.nano.LauncherLogProto)1 NO_BUTTON (com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON)1 ZOOM_PROGRESS (com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS)1 LayoutUtils (com.android.quickstep.util.LayoutUtils)1