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

Commit dfde4d96 authored by Alex Chau's avatar Alex Chau
Browse files

Focus running task in overview grid

- calculateTaskSize now returns the Rect for focused task
- Introduced calculateGridTaskSize for non-focused task, and translate non-focused tasks to fit the grid
- As Task Rect is now vertically centered, removed ClearAllButton's grid vertical translation
- When ClearAllButton is not shown (e.g. quickswitch), make sure ClearAllButton's scroll won't be used when page snapping. This happens when page scrolls are translated so they're negative.
- Added back ActionsView when task is focused below the TaskView, which become invisible as you scroll
- In Modal state, move the ActionsView down so it won't cover the TaskView

Bug: 175939487
Test: manual
Change-Id: Idfa94a51f856418adc0503cf04211dcb4b1814fe
parent 21dfadab
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -14,11 +14,12 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- NOTE! don't add dimensions for margins / gravity to root view in this file, they need to be
     loaded at runtime. -->
<com.android.quickstep.views.GoOverviewActionsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom">
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/action_buttons"
+3 −2
Original line number Diff line number Diff line
@@ -14,10 +14,11 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- NOTE! don't add dimensions for margins / gravity to root view in this file, they need to be
     loaded at runtime. -->
<com.android.quickstep.views.OverviewActionsView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom">
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/action_buttons"
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
    <dimen name="overview_grid_bottom_margin">90dp</dimen>
    <dimen name="overview_grid_side_margin">54dp</dimen>
    <dimen name="overview_grid_row_spacing">42dp</dimen>
    <dimen name="overview_grid_focus_vertical_margin">130dp</dimen>
    <dimen name="split_placeholder_size">110dp</dimen>

    <dimen name="recents_page_spacing">16dp</dimen>
+3 −4
Original line number Diff line number Diff line
@@ -103,12 +103,11 @@ public final class RecentsViewStateController extends

    private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config,
            LauncherState state) {
        float clearAllButtonAlpha = (state.getVisibleElements(mLauncher) & CLEAR_ALL_BUTTON) != 0
                ? 1 : 0;
        float clearAllButtonAlpha = state.areElementsVisible(mLauncher, CLEAR_ALL_BUTTON) ? 1 : 0;
        propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
                clearAllButtonAlpha, LINEAR);
        float overviewButtonAlpha = (state.getVisibleElements(mLauncher) & OVERVIEW_ACTIONS) != 0
                ? 1 : 0;
        float overviewButtonAlpha = state.areElementsVisible(mLauncher, OVERVIEW_ACTIONS)
                && mRecentsView.shouldShowOverviewActionsForState(state) ? 1 : 0;
        propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(),
                MultiValueAlpha.VALUE, overviewButtonAlpha, config.getInterpolator(
                        ANIM_OVERVIEW_ACTIONS_FADE, LINEAR));
+6 −6
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;

import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;

import com.android.launcher3.BaseDraggingActivity;
@@ -70,13 +71,12 @@ public class OverviewModalTaskState extends OverviewState {
    }

    public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
        Rect out = new Rect();
        activity.<RecentsView>getOverviewPanel().getTaskSize(out);
        int taskHeight = out.height();
        activity.<RecentsView>getOverviewPanel().getModalTaskSize(out);
        int newHeight = out.height();
        Point taskSize = activity.<RecentsView>getOverviewPanel().getSelectedTaskSize();
        Rect modalTaskSize = new Rect();
        activity.<RecentsView>getOverviewPanel().getModalTaskSize(modalTaskSize);

        float scale = (float) newHeight / taskHeight;
        float scale = Math.min((float) modalTaskSize.height() / taskSize.y,
                (float) modalTaskSize.width() / taskSize.x);

        return new float[] {scale, NO_OFFSET};
    }
Loading