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

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

Merge "Hide Clear all button during quick switch" into ub-launcher3-qt-dev

parents a6f19699 66d1c2fa
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
 */
 */
package com.android.launcher3.uioverrides;
package com.android.launcher3.uioverrides;


import static com.android.launcher3.LauncherState.RECENTS_CLEAR_ALL_BUTTON;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;


import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
@@ -22,15 +24,17 @@ import android.annotation.TargetApi;
import android.os.Build;
import android.os.Build;
import android.util.FloatProperty;
import android.util.FloatProperty;


import androidx.annotation.NonNull;

import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.PropertySetter;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;


import androidx.annotation.NonNull;

/**
/**
 * State handler for handling UI changes for {@link LauncherRecentsView}. In addition to managing
 * State handler for handling UI changes for {@link LauncherRecentsView}. In addition to managing
 * the basic view properties, this class also manages changes in the task visuals.
 * the basic view properties, this class also manages changes in the task visuals.
@@ -50,6 +54,7 @@ public final class RecentsViewStateController extends
            mRecentsView.updateEmptyMessage();
            mRecentsView.updateEmptyMessage();
            mRecentsView.resetTaskVisuals();
            mRecentsView.resetTaskVisuals();
        }
        }
        setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state.getVisibleElements(mLauncher));
    }
    }


    @Override
    @Override
@@ -71,6 +76,14 @@ public final class RecentsViewStateController extends
            builder.play(updateAnim);
            builder.play(updateAnim);
            mRecentsView.updateEmptyMessage();
            mRecentsView.updateEmptyMessage();
        }
        }

        setAlphas(config.getPropertySetter(builder), toState.getVisibleElements(mLauncher));
    }

    private void setAlphas(PropertySetter propertySetter, int visibleElements) {
        boolean hasClearAllButton = (visibleElements & RECENTS_CLEAR_ALL_BUTTON) != 0;
        propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
                hasClearAllButton ? 1f : 0f, LINEAR);
    }
    }


    @Override
    @Override
+5 −2
Original line number Original line Diff line number Diff line
@@ -18,11 +18,10 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;


import android.os.RemoteException;
import android.os.RemoteException;

import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
@@ -75,4 +74,8 @@ public class BackgroundAppState extends OverviewState {
        return new ScaleAndTranslation(scale, 0f, 0f);
        return new ScaleAndTranslation(scale, 0f, 0f);
    }
    }


    @Override
    public int getVisibleElements(Launcher launcher) {
        return super.getVisibleElements(launcher) & ~RECENTS_CLEAR_ALL_BUTTON;
    }
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -116,9 +116,9 @@ public class OverviewState extends LauncherState {
    @Override
    @Override
    public int getVisibleElements(Launcher launcher) {
    public int getVisibleElements(Launcher launcher) {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return VERTICAL_SWIPE_INDICATOR;
            return VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON;
        } else {
        } else {
            return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR |
            return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON |
                    (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
                    (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
                            ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
                            ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
        }
        }
+8 −5
Original line number Original line Diff line number Diff line
@@ -26,11 +26,13 @@ import android.content.Context;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;
@@ -39,9 +41,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import java.util.function.BiPredicate;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
import java.util.function.Consumer;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
/**
 * {@link ActivityControlHelper} for recents when the default launcher is different than the
 * {@link ActivityControlHelper} for recents when the default launcher is different than the
 * currently running one and apps should interact with the {@link RecentsActivity} as opposed
 * currently running one and apps should interact with the {@link RecentsActivity} as opposed
@@ -72,7 +71,9 @@ public final class FallbackActivityControllerHelper implements


    @Override
    @Override
    public void onSwipeUpComplete(RecentsActivity activity) {
    public void onSwipeUpComplete(RecentsActivity activity) {
        // TODO:
        RecentsView recentsView = activity.getOverviewPanel();
        recentsView.getClearAllButton().setVisibilityAlpha(1);
        recentsView.setDisallowScrollToClearAll(false);
    }
    }


    @Override
    @Override
@@ -121,6 +122,8 @@ public final class FallbackActivityControllerHelper implements


        RecentsView rv = activity.getOverviewPanel();
        RecentsView rv = activity.getOverviewPanel();
        rv.setContentAlpha(0);
        rv.setContentAlpha(0);
        rv.getClearAllButton().setVisibilityAlpha(0);
        rv.setDisallowScrollToClearAll(true);


        return new AnimationFactory() {
        return new AnimationFactory() {


+1 −10
Original line number Original line Diff line number Diff line
@@ -747,14 +747,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
        float endShift;
        float endShift;
        final float startShift;
        final float startShift;
        Interpolator interpolator = DEACCEL;
        Interpolator interpolator = DEACCEL;
        int nextPage = 0;
        int taskToLaunch = 0;
        final boolean goingToNewTask;
        final boolean goingToNewTask;
        if (mRecentsView != null) {
        if (mRecentsView != null) {
            nextPage = mRecentsView.getNextPage();
            final int lastTaskIndex = mRecentsView.getTaskViewCount() - 1;
            final int runningTaskIndex = mRecentsView.getRunningTaskIndex();
            final int runningTaskIndex = mRecentsView.getRunningTaskIndex();
            taskToLaunch = nextPage <= lastTaskIndex ? nextPage : lastTaskIndex;
            final int taskToLaunch = mRecentsView.getNextPage();
            goingToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex;
            goingToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex;
        } else {
        } else {
            goingToNewTask = false;
            goingToNewTask = false;
@@ -820,11 +816,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
            }
            }
        }
        }


        if (mRecentsView != null && !endTarget.isLauncher && taskToLaunch != nextPage) {
            // Scrolled to Clear all button, snap back to last task and launch it.
            mRecentsView.snapToPage(taskToLaunch, Math.toIntExact(duration), interpolator);
        }

        if (endTarget == HOME) {
        if (endTarget == HOME) {
            setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
            setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
            duration = Math.max(MIN_OVERSHOOT_DURATION, duration);
            duration = Math.max(MIN_OVERSHOOT_DURATION, duration);
Loading