diff --git a/quickstep/recents_ui_overrides/res/layout/overview_panel.xml b/quickstep/recents_ui_overrides/res/layout/overview_panel.xml index eac0bfa8eb..fe57e9b3d5 100644 --- a/quickstep/recents_ui_overrides/res/layout/overview_panel.xml +++ b/quickstep/recents_ui_overrides/res/layout/overview_panel.xml @@ -13,12 +13,20 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + + + + + + diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 2b13a1e756..2f55fda8f0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -15,20 +15,14 @@ */ package com.android.launcher3.uioverrides; -import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS; -import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import android.annotation.TargetApi; import android.os.Build; import android.util.FloatProperty; -import android.view.Surface; -import android.view.View; -import android.view.animation.Interpolator; import androidx.annotation.NonNull; @@ -38,6 +32,7 @@ import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.states.StateAnimationConfig; +import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.views.ClearAllButton; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsView; @@ -61,7 +56,7 @@ public final class RecentsViewStateController extends mRecentsView.updateEmptyMessage(); mRecentsView.resetTaskVisuals(); } - setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state, LINEAR); + setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state); mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress()); } @@ -79,23 +74,17 @@ public final class RecentsViewStateController extends AnimationSuccessListener.forRunnable(mRecentsView::resetTaskVisuals)); } - setAlphas(builder, toState, - config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); + setAlphas(builder, toState); builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), LINEAR); } - private void setAlphas(PropertySetter propertySetter, LauncherState state, - Interpolator actionInterpolator) { + private void setAlphas(PropertySetter propertySetter, LauncherState state) { float buttonAlpha = (state.getVisibleElements(mLauncher) & OVERVIEW_BUTTONS) != 0 ? 1 : 0; propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA, buttonAlpha, LINEAR); - - View actionsView = mLauncher.getActionsView(); - int launcherRotation = mRecentsView.getPagedViewOrientedState().getLauncherRotation(); - if (actionsView != null && launcherRotation == Surface.ROTATION_0) { - propertySetter.setViewAlpha(actionsView, buttonAlpha, actionInterpolator); - } + propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(), + MultiValueAlpha.VALUE, buttonAlpha, LINEAR); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java index 33fe5a9e0a..fd17551892 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/ImageActionsApi.java @@ -42,9 +42,10 @@ import java.util.function.Supplier; public class ImageActionsApi { private static final String TAG = BuildConfig.APPLICATION_ID + "ImageActionsApi"; - private final Context mContext; - private final Supplier mBitmapSupplier; - private final SystemUiProxy mSystemUiProxy; + + protected final Context mContext; + protected final Supplier mBitmapSupplier; + protected final SystemUiProxy mSystemUiProxy; public ImageActionsApi(Context context, Supplier bitmapSupplier) { mContext = context; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java index 42d944fb78..52a25589a6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java @@ -71,6 +71,7 @@ public final class RecentsActivity extends BaseRecentsActivity { mRecentsRootView = findViewById(R.id.drag_layer); mFallbackRecentsView = findViewById(R.id.overview_panel); mRecentsRootView.recreateControllers(); + mFallbackRecentsView.init(findViewById(R.id.overview_actions_view)); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java index fbf29af9fb..147f9330c7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java @@ -16,7 +16,6 @@ package com.android.quickstep; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.util.MainThreadInitializedObject.forOverride; import android.content.Context; @@ -84,47 +83,47 @@ public class TaskOverlayFactory implements ResourceBasedOverride { /** * Overlay on each task handling Overview Action Buttons. */ - public static class TaskOverlay { + public static class TaskOverlay { private final Context mApplicationContext; - private OverviewActionsView mActionsView; - private final TaskThumbnailView mThumbnailView; + protected final TaskThumbnailView mThumbnailView; + private T mActionsView; protected TaskOverlay(TaskThumbnailView taskThumbnailView) { mApplicationContext = taskThumbnailView.getContext().getApplicationContext(); mThumbnailView = taskThumbnailView; } + protected T getActionsView() { + if (mActionsView == null) { + mActionsView = BaseActivity.fromContext(mThumbnailView.getContext()).findViewById( + R.id.overview_actions_view); + } + return mActionsView; + } + /** * Called when the current task is interactive for the user */ public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix) { ImageActionsApi imageApi = new ImageActionsApi( mApplicationContext, mThumbnailView::getThumbnail); + getActionsView().setCallbacks(new OverlayUICallbacks() { + @Override + public void onShare() { + imageApi.startShareActivity(); + } - if (mActionsView == null && ENABLE_OVERVIEW_ACTIONS.get() - && SysUINavigationMode.removeShelfFromOverview(mApplicationContext)) { - mActionsView = BaseActivity.fromContext(mThumbnailView.getContext()).findViewById( - R.id.overview_actions_view); - } - if (mActionsView != null) { - mActionsView.setListener(new OverviewActionsView.Listener() { - @Override - public void onShare() { - imageApi.startShareActivity(); - } - - @Override - public void onScreenshot() { - imageApi.saveScreenshot(mThumbnailView.getThumbnail(), - getTaskSnapshotBounds(), getTaskSnapshotInsets(), task.key.id); - } - }); - } - + @Override + public void onScreenshot() { + imageApi.saveScreenshot(mThumbnailView.getThumbnail(), + getTaskSnapshotBounds(), getTaskSnapshotInsets(), task.key.id); + } + }); } + /** * Called when the overlay is no longer used. */ @@ -161,4 +160,16 @@ public class TaskOverlayFactory implements ResourceBasedOverride { return Insets.of(0, 0, 0, 0); } } + + /** + * Callbacks the Ui can generate. This is the only way for a Ui to call methods on the + * controller. + */ + public interface OverlayUICallbacks { + /** User has indicated they want to share the current task. */ + void onShare(); + + /** User has indicated they want to screenshot the current task. */ + void onScreenshot(); + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java index dc0c194812..6d1bf11135 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -30,6 +30,7 @@ import com.android.launcher3.LauncherState.ScaleAndTranslation; import com.android.launcher3.Utilities; import com.android.quickstep.RecentsActivity; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; @@ -67,6 +68,11 @@ public class FallbackRecentsView extends RecentsView { public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); + } + + @Override + public void init(OverviewActionsView actionsView) { + super.init(actionsView); setOverviewStateEnabled(true); setOverlayEnabled(true); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java index 87b0ad266b..78d75c5e82 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java @@ -47,7 +47,6 @@ import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.appprediction.PredictionUiStateManager.Client; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statehandlers.DepthController; -import com.android.launcher3.states.RotationHelper; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.views.ScrimView; @@ -98,10 +97,15 @@ public class LauncherRecentsView extends RecentsView public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - setContentAlpha(0); mActivity.getStateManager().addStateListener(this); } + @Override + public void init(OverviewActionsView actionsView) { + super.init(actionsView); + setContentAlpha(0); + } + @Override public void startHome() { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java index 6a37e2b7de..93e68c0f5d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java @@ -16,34 +16,59 @@ package com.android.quickstep.views; +import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; +import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; + import android.content.Context; import android.util.AttributeSet; -import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnClickListener; import android.widget.FrameLayout; +import androidx.annotation.IntDef; import androidx.annotation.Nullable; import com.android.launcher3.R; +import com.android.launcher3.util.MultiValueAlpha; +import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; +import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; /** * View for showing action buttons in Overview */ -public class OverviewActionsView extends FrameLayout { +public class OverviewActionsView extends FrameLayout + implements OnClickListener { - private final View mScreenshotButton; - private final View mShareButton; + @IntDef(flag = true, value = { + HIDDEN_UNSUPPORTED_NAVIGATION, + HIDDEN_DISABLED_FEATURE, + HIDDEN_NON_ZERO_ROTATION, + HIDDEN_NO_TASKS, + HIDDEN_GESTURE_RUNNING, + HIDDEN_NO_RECENTS}) + @Retention(RetentionPolicy.SOURCE) + public @interface ActionsHiddenFlags { } - /** - * Listener for taps on the various actions. - */ - public interface Listener { - /** User has initiated the share actions. */ - void onShare(); + public static final int HIDDEN_UNSUPPORTED_NAVIGATION = 1 << 0; + public static final int HIDDEN_DISABLED_FEATURE = 1 << 1; + public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 2; + public static final int HIDDEN_NO_TASKS = 1 << 3; + public static final int HIDDEN_GESTURE_RUNNING = 1 << 4; + public static final int HIDDEN_NO_RECENTS = 1 << 5; - /** User has initiated the screenshot action. */ - void onScreenshot(); - } + private static final int INDEX_CONTENT_ALPHA = 0; + private static final int INDEX_VISIBILITY_ALPHA = 1; + private static final int INDEX_HIDDEN_FLAGS_ALPHA = 2; + + private final MultiValueAlpha mMultiValueAlpha; + + @ActionsHiddenFlags + private int mHiddenFlags; + + protected T mCallbacks; public OverviewActionsView(Context context) { this(context, null); @@ -54,26 +79,62 @@ public class OverviewActionsView extends FrameLayout { } public OverviewActionsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - this(context, attrs, defStyleAttr, 0); + super(context, attrs, defStyleAttr, 0); + mMultiValueAlpha = new MultiValueAlpha(this, 3); } - public OverviewActionsView(Context context, AttributeSet attrs, int defStyleAttr, - int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - LayoutInflater.from(context).inflate(R.layout.overview_actions, this, true); - mShareButton = findViewById(R.id.action_share); - mScreenshotButton = findViewById(R.id.action_screenshot); + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + findViewById(R.id.action_share).setOnClickListener(this); + findViewById(R.id.action_screenshot).setOnClickListener(this); } /** * Set listener for callbacks on action button taps. * - * @param listener for callbacks, or {@code null} to clear the listener. + * @param callbacks for callbacks, or {@code null} to clear the listener. */ - public void setListener(@Nullable OverviewActionsView.Listener listener) { - mShareButton.setOnClickListener( - listener == null ? null : view -> listener.onShare()); - mScreenshotButton.setOnClickListener( - listener == null ? null : view -> listener.onScreenshot()); + public void setCallbacks(T callbacks) { + mCallbacks = callbacks; + } + + @Override + public void onClick(View view) { + if (mCallbacks == null) { + return; + } + int id = view.getId(); + if (id == R.id.action_share) { + mCallbacks.onShare(); + } else if (id == R.id.action_screenshot) { + mCallbacks.onScreenshot(); + } + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + updateHiddenFlags(HIDDEN_DISABLED_FEATURE, !ENABLE_OVERVIEW_ACTIONS.get()); + updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext())); + } + + public void updateHiddenFlags(@ActionsHiddenFlags int visibilityFlags, boolean enable) { + if (enable) { + mHiddenFlags |= visibilityFlags; + } else { + mHiddenFlags &= ~visibilityFlags; + } + boolean isHidden = mHiddenFlags != 0; + mMultiValueAlpha.getProperty(INDEX_HIDDEN_FLAGS_ALPHA).setValue(isHidden ? 0 : 1); + setVisibility(isHidden ? INVISIBLE : VISIBLE); + } + + public AlphaProperty getContentAlpha() { + return mMultiValueAlpha.getProperty(INDEX_CONTENT_ALPHA); + } + + public AlphaProperty getVisibilityAlpha() { + return mMultiValueAlpha.getProperty(INDEX_VISIBILITY_ALPHA); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index e8d314dc95..24eae188df 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -28,7 +28,6 @@ import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.TASK_DISMISS_SWIPE_UP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.TASK_LAUNCH_SWIPE_DOWN; @@ -39,6 +38,10 @@ import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType. import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; +import static com.android.quickstep.views.OverviewActionsView.HIDDEN_GESTURE_RUNNING; +import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION; +import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS; +import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS; import android.animation.AnimatorSet; import android.animation.LayoutTransition; @@ -67,7 +70,6 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Property; import android.util.SparseBooleanArray; -import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -87,7 +89,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.BaseActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; -import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherState; import com.android.launcher3.PagedView; @@ -117,7 +118,6 @@ import com.android.quickstep.RecentsAnimationController; import com.android.quickstep.RecentsAnimationTargets; import com.android.quickstep.RecentsModel; import com.android.quickstep.RecentsModel.TaskVisualsChangeListener; -import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskThumbnailCache; import com.android.quickstep.TaskUtils; @@ -331,8 +331,7 @@ public abstract class RecentsView extends PagedView impl // Keeps track of the index where the first TaskView should be private int mTaskViewStartIndex = 0; - private View mActionsView; - private boolean mGestureRunning = false; + private OverviewActionsView mActionsView; private BaseActivity.MultiWindowModeChangedListener mMultiWindowModeChangedListener = (inMultiWindowMode) -> { @@ -393,11 +392,6 @@ public abstract class RecentsView extends PagedView impl int rotation = RecentsOrientedState.getRotationForUserDegreesRotated(i); if (mPreviousRotation != rotation) { animateRecentsRotationInPlace(rotation); - if (rotation == 0) { - showActionsView(); - } else { - hideActionsView(); - } mPreviousRotation = rotation; } } @@ -472,6 +466,10 @@ public abstract class RecentsView extends PagedView impl reset(); } + public void init(OverviewActionsView actionsView) { + mActionsView = actionsView; + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -485,7 +483,6 @@ public abstract class RecentsView extends PagedView impl mIPinnedStackAnimationListener.setActivity(mActivity); SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener( mIPinnedStackAnimationListener); - setActionsView(); mOrientationState.init(); } @@ -513,6 +510,7 @@ public abstract class RecentsView extends PagedView impl TaskView taskView = (TaskView) child; mHasVisibleTaskData.delete(taskView.getTask().key.id); mTaskViewPool.recycle(taskView); + mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, getTaskViewCount() == 0); } updateTaskStartIndex(child); } @@ -525,6 +523,7 @@ public abstract class RecentsView extends PagedView impl // child direction back to match system settings. child.setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL); updateTaskStartIndex(child); + mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, false); } private void updateTaskStartIndex(View affectingView) { @@ -688,7 +687,6 @@ public abstract class RecentsView extends PagedView impl if (getTaskViewCount() != requiredTaskCount) { if (indexOfChild(mClearAllButton) != -1) { removeView(mClearAllButton); - hideActionsView(); } for (int i = getTaskViewCount(); i < requiredTaskCount; i++) { addView(mTaskViewPool.getView()); @@ -698,7 +696,6 @@ public abstract class RecentsView extends PagedView impl } if (requiredTaskCount > 0) { addView(mClearAllButton); - showActionsView(); } } @@ -738,7 +735,6 @@ public abstract class RecentsView extends PagedView impl if (indexOfChild(mClearAllButton) != -1) { removeView(mClearAllButton); } - hideActionsView(); } public int getTaskViewCount() { @@ -1000,7 +996,7 @@ public abstract class RecentsView extends PagedView impl setEnableDrawingLiveTile(false); setRunningTaskHidden(true); setRunningTaskIconScaledDown(true); - mGestureRunning = true; + mActionsView.updateHiddenFlags(HIDDEN_GESTURE_RUNNING, true); } /** @@ -1066,7 +1062,7 @@ public abstract class RecentsView extends PagedView impl } setRunningTaskHidden(false); animateUpRunningTaskIconScale(); - mGestureRunning = false; + mActionsView.updateHiddenFlags(HIDDEN_GESTURE_RUNNING, false); } /** @@ -1083,7 +1079,6 @@ public abstract class RecentsView extends PagedView impl addView(taskView, mTaskViewStartIndex); if (wasEmpty) { addView(mClearAllButton); - showActionsView(); } // The temporary running task is only used for the duration between the start of the // gesture and the task list is loaded and applied @@ -1407,7 +1402,6 @@ public abstract class RecentsView extends PagedView impl if (getTaskViewCount() == 0) { removeViewInLayout(mClearAllButton); - hideActionsView(); startHome(); } else { snapToPageImmediately(pageToSnapTo); @@ -1550,14 +1544,12 @@ public abstract class RecentsView extends PagedView impl int alphaInt = Math.round(alpha * 255); mEmptyMessagePaint.setAlpha(alphaInt); mEmptyIcon.setAlpha(alphaInt); + mActionsView.getContentAlpha().setValue(mContentAlpha); + if (alpha > 0) { setVisibility(VISIBLE); - if (!mGestureRunning) { - showActionsView(); - } } else if (!mFreezeViewVisibility) { setVisibility(GONE); - hideActionsView(); } } @@ -1568,18 +1560,20 @@ public abstract class RecentsView extends PagedView impl public void setFreezeViewVisibility(boolean freezeViewVisibility) { if (mFreezeViewVisibility != freezeViewVisibility) { mFreezeViewVisibility = freezeViewVisibility; - if (!mFreezeViewVisibility) { setVisibility(mContentAlpha > 0 ? VISIBLE : GONE); - if (mContentAlpha > 0) { - showActionsView(); - } else { - hideActionsView(); - } } } } + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + if (mActionsView != null) { + mActionsView.updateHiddenFlags(HIDDEN_NO_RECENTS, visibility != VISIBLE); + } + } + public void setLayoutRotation(int touchRotation, int displayRotation) { int launcherRotation = mOrientationState.getLauncherRotation(); setLayoutInternal(touchRotation, displayRotation, launcherRotation); @@ -1592,6 +1586,7 @@ public abstract class RecentsView extends PagedView impl setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated()); mActivity.getDragLayer().recreateControllers(); + mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, touchRotation != 0); requestLayout(); } } @@ -2150,36 +2145,4 @@ public abstract class RecentsView extends PagedView impl mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS); } } - - private void showActionsView() { - if (mActionsView != null && getTaskViewCount() > 0) { - mActionsView.setVisibility(VISIBLE); - } - } - - private void hideActionsView() { - if (mActionsView != null) { - mActionsView.setVisibility(GONE); - } - } - - private void setActionsView() { - if (mActionsView == null && ENABLE_OVERVIEW_ACTIONS.get() - && SysUINavigationMode.removeShelfFromOverview(mActivity)) { - mActionsView = ((ViewGroup) getParent()).findViewById(R.id.overview_actions_view); - if (mActionsView != null) { - InsettableFrameLayout.LayoutParams layoutParams = - new InsettableFrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, - getResources().getDimensionPixelSize( - R.dimen.overview_actions_height)); - layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; - int margin = getResources().getDimensionPixelSize( - R.dimen.overview_actions_horizontal_margin); - layoutParams.setMarginStart(margin); - layoutParams.setMarginEnd(margin); - mActionsView.setLayoutParams(layoutParams); - showActionsView(); - } - } - } } diff --git a/quickstep/res/layout/overview_actions.xml b/quickstep/res/layout/overview_actions.xml deleted file mode 100644 index ad5efb6ae0..0000000000 --- a/quickstep/res/layout/overview_actions.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - -