mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Add placeholder divider view when starting split tasks
* This prevents launcher underneath from peaking through while the split apps are loading Bug: 299640096 Test: Launched from recents, home and all apps Doesn't seem to affect small screen since recents scrolls away and the scrim is only left Change-Id: I32e394a0bc361489473ee657161c8f3bcbf1e422
This commit is contained in:
@@ -24,6 +24,7 @@ import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.app.ActivityManager.RunningTaskInfo
|
||||
import android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
@@ -41,8 +42,10 @@ import androidx.annotation.VisibleForTesting
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.Flags.enableOverviewIconMenu
|
||||
import com.android.launcher3.InsettableFrameLayout
|
||||
import com.android.launcher3.Launcher
|
||||
import com.android.launcher3.QuickstepTransitionManager
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.anim.PendingAnimation
|
||||
import com.android.launcher3.apppairs.AppPairIcon
|
||||
@@ -268,6 +271,51 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a view to fade in at .4 animation progress and adds it to the provided
|
||||
* [pendingAnimation]. Assumes that animation will be the final split placeholder launch anim.
|
||||
*
|
||||
* [secondPlaceholderEndingBounds] refers to the second placeholder view that gets added on
|
||||
* screen, not the logical second app.
|
||||
* For landscape it's the left app and for portrait the top one.
|
||||
*/
|
||||
fun addDividerPlaceholderViewToAnim(pendingAnimation: PendingAnimation,
|
||||
launcher: StatefulActivity<*>,
|
||||
secondPlaceholderEndingBounds: Rect,
|
||||
context: Context) : View {
|
||||
val mSplitDividerPlaceholderView = View(context)
|
||||
val recentsView = launcher.getOverviewPanel<RecentsView<*, *>>()
|
||||
val dp : com.android.launcher3.DeviceProfile = launcher.getDeviceProfile()
|
||||
// Add it before/under the most recently added first floating taskView
|
||||
val firstAddedSplitViewIndex: Int = launcher.getDragLayer().indexOfChild(
|
||||
recentsView.splitSelectController.firstFloatingTaskView)
|
||||
launcher.getDragLayer().addView(mSplitDividerPlaceholderView, firstAddedSplitViewIndex)
|
||||
val lp = mSplitDividerPlaceholderView.layoutParams as InsettableFrameLayout.LayoutParams
|
||||
lp.topMargin = 0
|
||||
|
||||
if (dp.isLeftRightSplit) {
|
||||
lp.height = secondPlaceholderEndingBounds.height()
|
||||
lp.width = launcher.resources
|
||||
.getDimensionPixelSize(R.dimen.split_divider_handle_region_height)
|
||||
mSplitDividerPlaceholderView.translationX = secondPlaceholderEndingBounds.right - lp.width / 2f
|
||||
mSplitDividerPlaceholderView.translationY = 0f
|
||||
} else {
|
||||
lp.height = launcher.resources
|
||||
.getDimensionPixelSize(R.dimen.split_divider_handle_region_height)
|
||||
lp.width = secondPlaceholderEndingBounds.width()
|
||||
mSplitDividerPlaceholderView.translationY = secondPlaceholderEndingBounds.top - lp.height / 2f
|
||||
mSplitDividerPlaceholderView.translationX = 0f
|
||||
}
|
||||
|
||||
mSplitDividerPlaceholderView.alpha = 0f
|
||||
mSplitDividerPlaceholderView.setBackgroundColor(launcher.resources
|
||||
.getColor(R.color.taskbar_background_dark))
|
||||
val timings = AnimUtils.getDeviceSplitToConfirmTimings(dp.isTablet)
|
||||
pendingAnimation.setViewAlpha(mSplitDividerPlaceholderView, 1f,
|
||||
Interpolators.clampToProgress(timings.stagedRectScaleXInterpolator, 0.4f, 1f))
|
||||
return mSplitDividerPlaceholderView
|
||||
}
|
||||
|
||||
/** Does not play any animation if user is not currently in split selection state. */
|
||||
fun playPlaceholderDismissAnim(launcher: StatefulActivity<*>, splitDismissEvent: EventEnum) {
|
||||
if (!splitSelectStateController.isSplitSelectActive) {
|
||||
|
||||
@@ -162,6 +162,10 @@ public class SplitToWorkspaceController {
|
||||
new RectF(firstTaskStartingBounds), firstTaskEndingBounds,
|
||||
false /* fadeWithThumbnail */, true /* isStagedTask */);
|
||||
|
||||
View mSplitDividerPlaceholderView = recentsView.getSplitSelectController()
|
||||
.getSplitAnimationController().addDividerPlaceholderViewToAnim(pendingAnimation,
|
||||
mLauncher, secondTaskEndingBounds, view.getContext());
|
||||
|
||||
FloatingTaskView secondFloatingTaskView = FloatingTaskView.getFloatingTaskView(mLauncher,
|
||||
view, bitmap, icon, secondTaskStartingBounds);
|
||||
secondFloatingTaskView.setAlpha(1);
|
||||
@@ -188,6 +192,7 @@ public class SplitToWorkspaceController {
|
||||
private void cleanUp() {
|
||||
mLauncher.getDragLayer().removeView(firstFloatingTaskView);
|
||||
mLauncher.getDragLayer().removeView(secondFloatingTaskView);
|
||||
mLauncher.getDragLayer().removeView(mSplitDividerPlaceholderView);
|
||||
mController.getSplitAnimationController().removeSplitInstructionsView(mLauncher);
|
||||
mController.resetState();
|
||||
}
|
||||
|
||||
@@ -299,7 +299,6 @@ public class FloatingTaskView extends FrameLayout {
|
||||
|
||||
ValueAnimator transitionAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
animation.add(transitionAnimator);
|
||||
long animDuration = animation.getDuration();
|
||||
RectF floatingTaskViewBounds = new RectF();
|
||||
|
||||
if (fadeWithThumbnail) {
|
||||
|
||||
@@ -61,7 +61,6 @@ import static com.android.quickstep.util.TaskGridNavHelper.DIRECTION_RIGHT;
|
||||
import static com.android.quickstep.util.TaskGridNavHelper.DIRECTION_TAB;
|
||||
import static com.android.quickstep.util.TaskGridNavHelper.DIRECTION_UP;
|
||||
import static com.android.quickstep.views.ClearAllButton.DISMISS_ALPHA;
|
||||
import static com.android.window.flags.Flags.enableDesktopWindowingMode;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_ACTIONS_IN_MENU;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_DESKTOP;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION;
|
||||
@@ -69,6 +68,7 @@ import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SCREEN;
|
||||
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SELECT_ACTIVE;
|
||||
import static com.android.window.flags.Flags.enableDesktopWindowingMode;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -721,6 +721,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
private int mSplitHiddenTaskViewIndex = -1;
|
||||
@Nullable
|
||||
private FloatingTaskView mSecondFloatingTaskView;
|
||||
private View mSplitDividerPlaceholderView;
|
||||
|
||||
/**
|
||||
* The task to be removed and immediately re-added. Should not be added to task pool.
|
||||
@@ -4839,6 +4840,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mSplitSelectStateController.getActiveSplitStagePosition(), firstTaskEndingBounds,
|
||||
secondTaskEndingBounds);
|
||||
|
||||
mSplitDividerPlaceholderView = mSplitSelectStateController
|
||||
.getSplitAnimationController().addDividerPlaceholderViewToAnim(pendingAnimation,
|
||||
mActivity, secondTaskEndingBounds, getContext());
|
||||
FloatingTaskView firstFloatingTaskView =
|
||||
mSplitSelectStateController.getFirstFloatingTaskView();
|
||||
firstFloatingTaskView.getBoundsOnScreen(firstTaskStartingBounds);
|
||||
@@ -4893,6 +4897,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
safeRemoveDragLayerView(mSplitSelectStateController.getFirstFloatingTaskView());
|
||||
safeRemoveDragLayerView(mSecondFloatingTaskView);
|
||||
safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
|
||||
safeRemoveDragLayerView(mSplitDividerPlaceholderView);
|
||||
mSecondFloatingTaskView = null;
|
||||
mSplitSelectSource = null;
|
||||
mSplitSelectStateController.getSplitAnimationController()
|
||||
|
||||
21
res/color/taskbar_background_dark.xml
Normal file
21
res/color/taskbar_background_dark.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2024 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<!-- Should be the same as in packages/apps/Launcher3/res/color-night-v31/taskbar_background.xml -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Want to use @android:color/system_neutral1_500, but that causes build errors -->
|
||||
<item android:color="#76777D" android:lStar="6" />
|
||||
</selector>
|
||||
@@ -447,6 +447,8 @@
|
||||
<dimen name="split_instructions_bottom_margin_phone_landscape">24dp</dimen>
|
||||
<dimen name="split_instructions_bottom_margin_phone_portrait">60dp</dimen>
|
||||
<dimen name="split_instructions_start_margin_cancel">8dp</dimen>
|
||||
<dimen name="split_divider_handle_region_width">96dp</dimen>
|
||||
<dimen name="split_divider_handle_region_height">48dp</dimen>
|
||||
|
||||
<dimen name="focus_outline_radius">16dp</dimen>
|
||||
<dimen name="focus_inner_outline_radius">14dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user