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

Commit 740a52a2 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix bug with double-relayout of Overview Actions View

This CL refactors Overview Actions View so that a separate view, R.id.group_action_buttons, is used for buttons related to grouped tasks. This also changes the way visibility is handled with actions buttons -- instead of all buttons living on one bar and being toggled on and off, sometimes the whole bar is toggled on and off (to change from single task actions to group actions and vice versa).

This prevents the same view from having its visibility changed twice in in one layout and causing the wrong visibility to be rendered.

Fixes: 333844287
Test: Manual
Flag: ACONFIG com.android.wm.shell.enable_app_pairs NEXTFOOD
Change-Id: I1b6be4637ac8c8d424e7633c437fca376ecdd757
Merged-In: I1b6be4637ac8c8d424e7633c437fca376ecdd757
parent 531ede6f
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -121,6 +121,17 @@
            android:layout_weight="1"
            android:visibility="gone" />

    </LinearLayout>

    <!-- Unused. Included only for compatibility with parent class. -->
    <LinearLayout
        android:id="@+id/group_action_buttons"
        android:layout_width="match_parent"
        android:layout_height="@dimen/overview_actions_height"
        android:layout_gravity="top|center_horizontal"
        android:orientation="horizontal"
        android:visibility="gone">

        <Button
            android:id="@+id/action_save_app_pair"
            style="@style/GoOverviewActionButton"
@@ -128,8 +139,8 @@
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/ic_save_app_pair_up_down"
            android:text="@string/action_save_app_pair"
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />
            android:theme="@style/ThemeControlHighlightWorkspaceColor" />

    </LinearLayout>

</com.android.quickstep.views.GoOverviewActionsView>
 No newline at end of file
+12 −2
Original line number Diff line number Diff line
@@ -45,14 +45,24 @@
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/group_action_buttons"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/overview_actions_height"
        android:layout_gravity="bottom|center_horizontal"
        android:orientation="horizontal"
        android:visibility="gone">

        <Button
            android:id="@+id/action_save_app_pair"
            style="@style/OverviewActionButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/action_save_app_pair"
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />
            android:theme="@style/ThemeControlHighlightWorkspaceColor" />

    </LinearLayout>

</com.android.quickstep.views.OverviewActionsView>
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
@@ -50,6 +49,7 @@ import com.android.quickstep.util.AnimUtils;
import com.android.quickstep.util.SplitAnimationTimings;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;

/**
@@ -167,8 +167,8 @@ public final class RecentsViewStateController extends
        propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
                clearAllButtonAlpha, LINEAR);
        float overviewButtonAlpha = state.areElementsVisible(mLauncher, OVERVIEW_ACTIONS) ? 1 : 0;
        propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(),
                MULTI_PROPERTY_VALUE, overviewButtonAlpha, config.getInterpolator(
        propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlphaSetter(),
                OverviewActionsView.FLOAT_SETTER, overviewButtonAlpha, config.getInterpolator(
                        ANIM_OVERVIEW_ACTIONS_FADE, LINEAR));
    }

+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        TASK_THUMBNAIL_SPLASH_ALPHA.set(mRecentsView, fromState.showTaskThumbnailSplash() ? 1f : 0);
        mRecentsView.setContentAlpha(1);
        mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress());
        mLauncher.getActionsView().getVisibilityAlpha().setValue(
        mLauncher.getActionsView().getVisibilityAlphaSetter().accept(
                (fromState.getVisibleElements(mLauncher) & OVERVIEW_ACTIONS) != 0 ? 1f : 0f);
        mRecentsView.setTaskIconScaledDown(true);

+3 −3
Original line number Diff line number Diff line
@@ -46,9 +46,9 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.OverviewActionsView;

/**
 * State controller for fallback recents activity
@@ -95,8 +95,8 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
        setter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
                clearAllButtonAlpha, LINEAR);
        float overviewButtonAlpha = state.hasOverviewActions() ? 1 : 0;
        setter.setFloat(mActivity.getActionsView().getVisibilityAlpha(),
                MultiPropertyFactory.MULTI_PROPERTY_VALUE, overviewButtonAlpha, LINEAR);
        setter.setFloat(mActivity.getActionsView().getVisibilityAlphaSetter(),
                OverviewActionsView.FLOAT_SETTER, overviewButtonAlpha, LINEAR);

        float[] scaleAndOffset = state.getOverviewScaleAndOffset(mActivity);
        setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0],
Loading