mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Merge "Add transient taskbar UI" into tm-qpr-dev
This commit is contained in:
81
quickstep/res/layout/transient_taskbar.xml
Normal file
81
quickstep/res/layout/transient_taskbar.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 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.
|
||||
-->
|
||||
<com.android.launcher3.taskbar.TaskbarDragLayer
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/taskbar_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false">
|
||||
|
||||
<com.android.launcher3.taskbar.TaskbarView
|
||||
android:id="@+id/taskbar_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:forceHasOverlappingRendering="false"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="@dimen/transient_taskbar_margin"
|
||||
android:clipChildren="false" />
|
||||
|
||||
<com.android.launcher3.taskbar.TaskbarScrimView
|
||||
android:id="@+id/taskbar_scrim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/navbuttons_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/start_contextual_buttons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/taskbar_contextual_button_padding"
|
||||
android:paddingEnd="@dimen/taskbar_contextual_button_padding"
|
||||
android:paddingTop="@dimen/taskbar_contextual_padding_top"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="start"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/end_nav_buttons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="end"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/end_contextual_buttons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="@dimen/taskbar_contextual_padding_top"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="end"/>
|
||||
</FrameLayout>
|
||||
|
||||
<com.android.launcher3.taskbar.StashedHandleView
|
||||
android:id="@+id/stashed_handle"
|
||||
tools:comment1="The actual size and shape will be set as a ViewOutlineProvider at runtime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/taskbar_stashed_handle_dark_color"
|
||||
android:clipToOutline="true"
|
||||
android:layout_gravity="bottom"/>
|
||||
|
||||
</com.android.launcher3.taskbar.TaskbarDragLayer>
|
||||
@@ -283,6 +283,12 @@
|
||||
<dimen name="taskbar_home_button_left_margin_kids">48dp</dimen>
|
||||
<dimen name="taskbar_icon_size_kids">32dp</dimen>
|
||||
|
||||
<!-- Transient taskbar -->
|
||||
<dimen name="transient_taskbar_size">76dp</dimen>
|
||||
<dimen name="transient_taskbar_margin">24dp</dimen>
|
||||
<dimen name="transient_taskbar_shadow_blur">40dp</dimen>
|
||||
<dimen name="transient_taskbar_key_shadow_distance">10dp</dimen>
|
||||
|
||||
<!-- Taskbar 3 button spacing -->
|
||||
<dimen name="taskbar_button_space_inbetween">24dp</dimen>
|
||||
<dimen name="taskbar_button_space_inbetween_phone">40dp</dimen>
|
||||
|
||||
@@ -109,6 +109,7 @@ import com.android.launcher3.testing.shared.ResourceUtils;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DynamicResource;
|
||||
import com.android.launcher3.util.ObjectWrapper;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
@@ -451,7 +452,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
4 - rotationChange);
|
||||
}
|
||||
}
|
||||
if (mDeviceProfile.isTaskbarPresentInApps && !target.willShowImeOnTarget) {
|
||||
if (mDeviceProfile.isTaskbarPresentInApps
|
||||
&& !target.willShowImeOnTarget
|
||||
&& !DisplayController.isTransientTaskbar(mLauncher)) {
|
||||
// Animate to above the taskbar.
|
||||
bounds.bottom -= target.contentInsets.bottom;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
@@ -227,7 +228,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
} else {
|
||||
// Adjust task transition spec to account for taskbar being visible
|
||||
@ColorInt int taskAnimationBackgroundColor =
|
||||
mLauncher.getColor(R.color.taskbar_background);
|
||||
DisplayController.isTransientTaskbar(mLauncher)
|
||||
? mLauncher.getColor(R.color.transient_taskbar_background)
|
||||
: mLauncher.getColor(R.color.taskbar_background);
|
||||
|
||||
TaskTransitionSpec customTaskAnimationSpec = new TaskTransitionSpec(
|
||||
taskAnimationBackgroundColor,
|
||||
@@ -286,6 +289,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
@Override
|
||||
public void setSystemGestureInProgress(boolean inProgress) {
|
||||
super.setSystemGestureInProgress(inProgress);
|
||||
if (DisplayController.isTransientTaskbar(mLauncher)) {
|
||||
forceHideBackground(false);
|
||||
return;
|
||||
}
|
||||
if (!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
|
||||
// Launcher's ScrimView will draw the background throughout the gesture. But once the
|
||||
// gesture ends, start drawing taskbar's background again since launcher might stop
|
||||
|
||||
@@ -135,14 +135,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private boolean mBindingItems = false;
|
||||
private boolean mAddedWindow = false;
|
||||
|
||||
// The bounds of the taskbar items relative to TaskbarDragLayer
|
||||
private final Rect mTransientTaskbarBounds = new Rect();
|
||||
|
||||
private final TaskbarShortcutMenuAccessibilityDelegate mAccessibilityDelegate;
|
||||
|
||||
public TaskbarActivityContext(Context windowContext, DeviceProfile dp,
|
||||
public TaskbarActivityContext(Context windowContext, DeviceProfile launcherDp,
|
||||
TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider
|
||||
unfoldTransitionProgressProvider) {
|
||||
super(windowContext);
|
||||
mDeviceProfile = dp.copy(this);
|
||||
mDeviceProfile = launcherDp.copy(this);
|
||||
|
||||
final Resources resources = getResources();
|
||||
|
||||
@@ -172,8 +174,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mRightCorner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT);
|
||||
|
||||
// Inflate views.
|
||||
mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(
|
||||
R.layout.taskbar, null, false);
|
||||
int taskbarLayout = DisplayController.isTransientTaskbar(this)
|
||||
? R.layout.transient_taskbar
|
||||
: R.layout.taskbar;
|
||||
mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(taskbarLayout, null, false);
|
||||
TaskbarView taskbarView = mDragLayer.findViewById(R.id.taskbar_view);
|
||||
TaskbarScrimView taskbarScrimView = mDragLayer.findViewById(R.id.taskbar_scrim);
|
||||
FrameLayout navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
|
||||
@@ -212,7 +216,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
new TaskbarAutohideSuspendController(this),
|
||||
new TaskbarPopupController(this),
|
||||
new TaskbarForceVisibleImmersiveController(this),
|
||||
new TaskbarOverlayController(this, dp),
|
||||
new TaskbarOverlayController(this, launcherDp),
|
||||
new TaskbarAllAppsController(),
|
||||
new TaskbarInsetsController(this),
|
||||
new VoiceInteractionWindowController(this),
|
||||
@@ -243,10 +247,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
/** Updates {@link DeviceProfile} instances for any Taskbar windows. */
|
||||
public void updateDeviceProfile(DeviceProfile dp, NavigationMode navMode) {
|
||||
public void updateDeviceProfile(DeviceProfile launcherDp, NavigationMode navMode) {
|
||||
mNavMode = navMode;
|
||||
mControllers.taskbarOverlayController.updateDeviceProfile(dp);
|
||||
mDeviceProfile = dp.copy(this);
|
||||
mControllers.taskbarOverlayController.updateLauncherDeviceProfile(launcherDp);
|
||||
mDeviceProfile = launcherDp.copy(this);
|
||||
updateIconSize(getResources());
|
||||
|
||||
AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE);
|
||||
@@ -257,12 +261,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
private void updateIconSize(Resources resources) {
|
||||
float taskbarIconSize = resources.getDimension(R.dimen.taskbar_icon_size);
|
||||
float taskbarIconSize = DisplayController.isTransientTaskbar(this)
|
||||
? resources.getDimension(R.dimen.transient_taskbar_icon_size)
|
||||
: resources.getDimension(R.dimen.taskbar_icon_size);
|
||||
mDeviceProfile.updateIconSize(1, resources);
|
||||
float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx;
|
||||
mDeviceProfile.updateIconSize(iconScale, resources);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the View bounds of transient taskbar.
|
||||
*/
|
||||
public Rect getTransientTaskbarBounds() {
|
||||
return mTransientTaskbarBounds;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@Override
|
||||
public StatsLogManager getStatsLogManager() {
|
||||
@@ -623,16 +636,24 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
* Returns the default height of the window, including the static corner radii above taskbar.
|
||||
*/
|
||||
public int getDefaultTaskbarWindowHeight() {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) {
|
||||
Resources resources = getResources();
|
||||
return isThreeButtonNav() ?
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_size) :
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
|
||||
}
|
||||
|
||||
if (!isUserSetupComplete()) {
|
||||
return getResources().getDimensionPixelSize(R.dimen.taskbar_suw_frame);
|
||||
return resources.getDimensionPixelSize(R.dimen.taskbar_suw_frame);
|
||||
}
|
||||
|
||||
if (DisplayController.isTransientTaskbar(this)) {
|
||||
return resources.getDimensionPixelSize(R.dimen.transient_taskbar_size)
|
||||
+ (2 * resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin))
|
||||
+ resources.getDimensionPixelSize(R.dimen.transient_taskbar_shadow_blur);
|
||||
}
|
||||
|
||||
return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,16 @@
|
||||
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound
|
||||
import com.android.launcher3.Utilities.mapToRange
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Path
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.anim.Interpolators
|
||||
import com.android.launcher3.util.DisplayController
|
||||
|
||||
/**
|
||||
* Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners.
|
||||
@@ -29,6 +35,13 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
|
||||
val paint: Paint = Paint()
|
||||
var backgroundHeight = context.deviceProfile.taskbarSize.toFloat()
|
||||
|
||||
private var maxBackgroundHeight = context.deviceProfile.taskbarSize.toFloat()
|
||||
private val transientBackgroundBounds = context.transientTaskbarBounds
|
||||
|
||||
private var shadowBlur = 0f
|
||||
private var keyShadowDistance = 0f
|
||||
private var bottomMargin = 0
|
||||
|
||||
private val leftCornerRadius = context.leftCornerRadius.toFloat()
|
||||
private val rightCornerRadius = context.rightCornerRadius.toFloat()
|
||||
private val invertedLeftCornerPath: Path = Path()
|
||||
@@ -39,6 +52,15 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
|
||||
paint.flags = Paint.ANTI_ALIAS_FLAG
|
||||
paint.style = Paint.Style.FILL
|
||||
|
||||
if (DisplayController.isTransientTaskbar(context)) {
|
||||
paint.color = context.getColor(R.color.transient_taskbar_background)
|
||||
|
||||
val res = context.resources
|
||||
bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_margin)
|
||||
shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur)
|
||||
keyShadowDistance = res.getDimension(R.dimen.transient_taskbar_key_shadow_distance)
|
||||
}
|
||||
|
||||
// Create the paths for the inverted rounded corners above the taskbar. Start with a filled
|
||||
// square, and then subtract out a circle from the appropriate corner.
|
||||
val square = Path()
|
||||
@@ -58,17 +80,42 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
|
||||
*/
|
||||
fun draw(canvas: Canvas) {
|
||||
canvas.save()
|
||||
canvas.translate(0f, canvas.height - backgroundHeight)
|
||||
canvas.translate(0f, canvas.height - backgroundHeight - bottomMargin)
|
||||
if (transientBackgroundBounds.isEmpty) {
|
||||
// Draw the background behind taskbar content.
|
||||
canvas.drawRect(0f, 0f, canvas.width.toFloat(), backgroundHeight, paint)
|
||||
|
||||
// Draw the background behind taskbar content.
|
||||
canvas.drawRect(0f, 0f, canvas.width.toFloat(), backgroundHeight, paint)
|
||||
// Draw the inverted rounded corners above the taskbar.
|
||||
canvas.translate(0f, -leftCornerRadius)
|
||||
canvas.drawPath(invertedLeftCornerPath, paint)
|
||||
canvas.translate(0f, leftCornerRadius)
|
||||
canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius)
|
||||
canvas.drawPath(invertedRightCornerPath, paint)
|
||||
} else {
|
||||
val scaleFactor = backgroundHeight / maxBackgroundHeight
|
||||
val width = transientBackgroundBounds.width()
|
||||
val widthScale = mapToRange(scaleFactor, 0f, 1f, 0.4f, 1f, Interpolators.LINEAR)
|
||||
val newWidth = widthScale * width
|
||||
val delta = width - newWidth
|
||||
|
||||
// Draw the inverted rounded corners above the taskbar.
|
||||
canvas.translate(0f, -leftCornerRadius)
|
||||
canvas.drawPath(invertedLeftCornerPath, paint)
|
||||
canvas.translate(0f, leftCornerRadius)
|
||||
canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius)
|
||||
canvas.drawPath(invertedRightCornerPath, paint)
|
||||
// Draw shadow.
|
||||
val shadowAlpha = mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, 25f,
|
||||
Interpolators.LINEAR)
|
||||
paint.setShadowLayer(shadowBlur, 0f, keyShadowDistance,
|
||||
setColorAlphaBound(Color.BLACK, Math.round(shadowAlpha))
|
||||
)
|
||||
|
||||
// Draw background.
|
||||
val radius = backgroundHeight / 2f;
|
||||
|
||||
canvas.drawRoundRect(
|
||||
transientBackgroundBounds.left + (delta / 2f),
|
||||
0f,
|
||||
transientBackgroundBounds.right - (delta / 2f),
|
||||
backgroundHeight,
|
||||
radius, radius, paint
|
||||
)
|
||||
}
|
||||
|
||||
canvas.restore()
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.android.launcher3.icons.ThemedIconDrawable;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.views.DoubleShadowBubbleTextView;
|
||||
@@ -61,7 +62,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
public int mThemeIconsBackground;
|
||||
|
||||
private final int[] mTempOutLocation = new int[2];
|
||||
private final Rect mIconLayoutBounds = new Rect();
|
||||
private final Rect mIconLayoutBounds;
|
||||
private final int mIconTouchSize;
|
||||
private final int mItemMarginLeftRight;
|
||||
private final int mItemPadding;
|
||||
@@ -107,11 +108,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
mActivityContext = ActivityContext.lookupContext(context);
|
||||
mIconLayoutBounds = mActivityContext.getTransientTaskbarBounds();
|
||||
|
||||
Resources resources = getResources();
|
||||
mIconTouchSize = resources.getDimensionPixelSize(R.dimen.taskbar_icon_touch_size);
|
||||
|
||||
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
|
||||
int actualMargin = DisplayController.isTransientTaskbar(mActivityContext)
|
||||
? resources.getDimensionPixelSize(R.dimen.transient_taskbar_icon_spacing)
|
||||
: resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
|
||||
int actualIconSize = mActivityContext.getDeviceProfile().iconSizePx;
|
||||
|
||||
// We layout the icons to be of mIconTouchSize in width and height
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.Utilities.squaredHypot;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP;
|
||||
@@ -47,6 +48,7 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.icons.ThemedIconDrawable;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.HorizontalInsettableView;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
@@ -88,6 +90,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
private AnimatedFloat mTaskbarNavButtonTranslationY;
|
||||
private AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay;
|
||||
|
||||
private final int mTaskbarBottomMargin;
|
||||
|
||||
private final AnimatedFloat mThemeIconsBackground = new AnimatedFloat(
|
||||
this::updateIconsBackground);
|
||||
|
||||
@@ -112,6 +116,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS);
|
||||
mTaskbarIconAlpha.setUpdateVisibility(true);
|
||||
mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView);
|
||||
mTaskbarBottomMargin = DisplayController.isTransientTaskbar(activity)
|
||||
? activity.getResources().getDimensionPixelSize(R.dimen.transient_taskbar_margin)
|
||||
: 0;
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
@@ -317,6 +324,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
float scale = ((float) taskbarDp.iconSizePx) / launcherDp.hotseatQsbVisualHeight;
|
||||
setter.addFloat(child, SCALE_PROPERTY, scale, 1f, LINEAR);
|
||||
|
||||
setter.setFloat(child, VIEW_TRANSLATE_Y, mTaskbarBottomMargin, LINEAR);
|
||||
|
||||
setter.addFloat(child, VIEW_ALPHA, 0f, 1f,
|
||||
isToHome
|
||||
? Interpolators.clampToProgress(LINEAR, 0f, 0.35f)
|
||||
@@ -342,6 +351,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
float childCenter = (child.getLeft() + child.getRight()) / 2f;
|
||||
setter.setFloat(child, ICON_TRANSLATE_X, hotseatIconCenter - childCenter, LINEAR);
|
||||
|
||||
setter.setFloat(child, VIEW_TRANSLATE_Y, mTaskbarBottomMargin, LINEAR);
|
||||
|
||||
setter.setFloat(child, SCALE_PROPERTY, scaleUp, LINEAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
|
||||
@Override
|
||||
public DeviceProfile getDeviceProfile() {
|
||||
return mOverlayController.getDeviceProfile();
|
||||
return mOverlayController.getLauncherDeviceProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,17 +63,17 @@ public final class TaskbarOverlayController {
|
||||
}
|
||||
};
|
||||
|
||||
private DeviceProfile mDeviceProfile;
|
||||
private DeviceProfile mLauncherDeviceProfile;
|
||||
private @Nullable TaskbarOverlayContext mOverlayContext;
|
||||
private TaskbarControllers mControllers; // Initialized in init.
|
||||
|
||||
public TaskbarOverlayController(
|
||||
TaskbarActivityContext taskbarContext, DeviceProfile deviceProfile) {
|
||||
TaskbarActivityContext taskbarContext, DeviceProfile launcherDeviceProfile) {
|
||||
mTaskbarContext = taskbarContext;
|
||||
mWindowContext = mTaskbarContext.createWindowContext(TYPE_APPLICATION_OVERLAY, null);
|
||||
mProxyView = new TaskbarOverlayProxyView();
|
||||
mLayoutParams = createLayoutParams();
|
||||
mDeviceProfile = deviceProfile;
|
||||
mLauncherDeviceProfile = launcherDeviceProfile;
|
||||
}
|
||||
|
||||
/** Initialize the controller. */
|
||||
@@ -132,13 +132,13 @@ public final class TaskbarOverlayController {
|
||||
}
|
||||
|
||||
/** The current device profile for the overlay window. */
|
||||
public DeviceProfile getDeviceProfile() {
|
||||
return mDeviceProfile;
|
||||
public DeviceProfile getLauncherDeviceProfile() {
|
||||
return mLauncherDeviceProfile;
|
||||
}
|
||||
|
||||
/** Updates {@link DeviceProfile} instance for Taskbar's overlay window. */
|
||||
public void updateDeviceProfile(DeviceProfile dp) {
|
||||
mDeviceProfile = dp;
|
||||
public void updateLauncherDeviceProfile(DeviceProfile dp) {
|
||||
mLauncherDeviceProfile = dp;
|
||||
Optional.ofNullable(mOverlayContext).ifPresent(c -> {
|
||||
AbstractFloatingView.closeAllOpenViewsExcept(c, false, TYPE_REBIND_SAFE);
|
||||
c.dispatchDeviceProfileChanged();
|
||||
|
||||
@@ -79,6 +79,7 @@ import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
@@ -1574,9 +1575,12 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
/** The current scale we apply to the thumbnail to adjust for new left/right insets. */
|
||||
public float mScale = 1;
|
||||
|
||||
private boolean mIsTaskbarTransient;
|
||||
|
||||
public FullscreenDrawParams(Context context) {
|
||||
mCornerRadius = TaskCornerRadius.get(context);
|
||||
mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context);
|
||||
mIsTaskbarTransient = DisplayController.isTransientTaskbar(context);
|
||||
|
||||
mCurrentDrawnCornerRadius = mCornerRadius;
|
||||
}
|
||||
@@ -1586,7 +1590,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
*/
|
||||
public void setProgress(float fullscreenProgress, float parentScale, float taskViewScale,
|
||||
int previewWidth, DeviceProfile dp, PreviewPositionHelper pph) {
|
||||
RectF insets = getInsetsToDrawInFullscreen(pph, dp);
|
||||
RectF insets = getInsetsToDrawInFullscreen(pph, dp, mIsTaskbarTransient);
|
||||
|
||||
float currentInsetsLeft = insets.left * fullscreenProgress;
|
||||
float currentInsetsTop = insets.top * fullscreenProgress;
|
||||
@@ -1609,7 +1613,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
/**
|
||||
* Insets to used for clipping the thumbnail (in case it is drawing outside its own space)
|
||||
*/
|
||||
private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph, DeviceProfile dp) {
|
||||
private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph,
|
||||
DeviceProfile dp, boolean isTaskbarTransient) {
|
||||
if (isTaskbarTransient) {
|
||||
return pph.getClippedInsets();
|
||||
}
|
||||
return dp.isTaskbarPresent && !dp.isTaskbarPresentInApps
|
||||
? pph.getClippedInsets() : EMPTY_RECT_F;
|
||||
}
|
||||
|
||||
19
res/color-v31/transient_taskbar_background.xml
Normal file
19
res/color-v31/transient_taskbar_background.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@android:color/system_neutral1_500" android:lStar="95" />
|
||||
</selector>
|
||||
|
||||
@@ -361,6 +361,13 @@
|
||||
<dimen name="min_hotseat_icon_space">18dp</dimen>
|
||||
<dimen name="min_hotseat_qsb_width">0dp</dimen>
|
||||
<dimen name="taskbar_icon_size">44dp</dimen>
|
||||
<dimen name="transient_taskbar_icon_size">57dp</dimen>
|
||||
<!-- Transient taskbar (placeholders to compile in Launcher3 without Quickstep) -->
|
||||
<dimen name="transient_taskbar_size">0dp</dimen>
|
||||
<dimen name="transient_taskbar_margin">0dp</dimen>
|
||||
<dimen name="transient_taskbar_shadow_blur">0dp</dimen>
|
||||
<dimen name="transient_taskbar_key_shadow_distance">0dp</dimen>
|
||||
<dimen name="transient_taskbar_icon_spacing">10dp</dimen>
|
||||
<!-- Note that this applies to both sides of all icons, so visible space is double this. -->
|
||||
<dimen name="taskbar_icon_spacing">8dp</dimen>
|
||||
<dimen name="taskbar_nav_buttons_size">0dp</dimen>
|
||||
|
||||
@@ -312,7 +312,9 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
if (isTaskbarPresent) {
|
||||
taskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_size);
|
||||
taskbarSize = DisplayController.isTransientTaskbar(context)
|
||||
? res.getDimensionPixelSize(R.dimen.transient_taskbar_size)
|
||||
: res.getDimensionPixelSize(R.dimen.taskbar_size);
|
||||
stashedTaskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||
|
||||
import static com.android.launcher3.Utilities.dpiFromPx;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_TRANSIENT_TASKBAR;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter;
|
||||
import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH;
|
||||
@@ -123,6 +124,14 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
return INSTANCE.get(context).getInfo().navigationMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether taskbar is transient.
|
||||
*/
|
||||
public static boolean isTransientTaskbar(Context context) {
|
||||
return ENABLE_TRANSIENT_TASKBAR.get()
|
||||
&& getNavigationMode(context) == NavigationMode.NO_BUTTON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
mDestroyed = true;
|
||||
|
||||
Reference in New Issue
Block a user