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

Commit 661f38cd authored by Jon Miranda's avatar Jon Miranda Committed by Android (Google) Code Review
Browse files

Merge "Add transient taskbar UI" into tm-qpr-dev

parents f7abb69d 184a0426
Loading
Loading
Loading
Loading
+81 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -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>
+4 −1
Original line number Diff line number Diff line
@@ -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;
        }
+8 −1
Original line number Diff line number Diff line
@@ -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
+32 −11
Original line number Diff line number Diff line
@@ -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() {
        if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) {
        Resources resources = getResources();

        if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) {
            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());
    }

Loading