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

Commit 9c70e7e2 authored by Tony's avatar Tony
Browse files

Update task menu

- Remove widgets option
- Add Split screen
- Add Pin
- Tap as well as long press icon to show menu

Bug: 72320614
Bug: 70294936
Change-Id: I231160286426ac3d2a23524b2f4a0170f963190e
parent fde5505d
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24.0dp"
        android:height="24.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">

    <path
        android:fillColor="#FFffffff"
        android:pathData="M16,12L16,4l1,0L17,2L7,2l0,2l1,0l0,8l-2,2l0,2l5.2,0l0,6l1.6,0l0,-6L18,16l0,-2L16,12z"/>
</vector>
 No newline at end of file
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="88.0dp"
        android:height="88.0dp"
        android:viewportWidth="88.0"
        android:viewportHeight="88.0" >

    <path
        android:pathData="M 32,11
           C 32,11 68,11 68,11
             76.74,11.06 76.98,12.76 77,21
             77.01,25.97 78.50,38.23 73.85,40.98
             71.80,42.19 68.35,42 66,42
             66,42 22,42 22,42
             18.82,41.99 14.87,42.38 12.60,39.69
             10.71,37.44 11.01,33.77 11,31
             10.99,25.54 9.53,16.08 13.31,12.02
             18.07,10.21 26.66,11 32,11 Z
           M 32,46
           C 32,46 68,46 68,46
             76.74,46.06 76.98,47.76 77,56
             77.01,60.97 78.50,73.23 73.85,75.98
             71.80,77.19 68.35,77 66,77
             66,77 22,77 22,77
             18.82,76.99 14.87,77.38 12.60,74.69
             10.71,72.44 11.01,68.77 11,66
             10.99,60.54 9.53,51.08 13.31,47.02
             18.07,45.21 26.66,46 32,46 Z"
        android:fillColor="@android:color/white" />
</vector>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -20,4 +20,10 @@

    <!-- Application name -->
    <string name="derived_app_name" translatable="false">Quickstep</string>

    <!-- Options for recent tasks -->
    <!-- Title for an option to enter split screen mode for a given app -->
    <string name="recent_task_option_split_screen">Split screen</string>
    <!-- Title for an option to keep an app pinned to the screen until it is unpinned -->
    <string name="recent_task_option_pin">Pin</string>
</resources>
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.UserHandle;

import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan.PreloadOptions;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
@@ -66,6 +67,7 @@ public class RecentsModel extends TaskStackChangeListener {
    private RecentsTaskLoadPlan mLastLoadPlan;
    private int mLastLoadPlanId;
    private int mTaskChangeId;
    private ISystemUiProxy mSystemUiProxy;

    private RecentsModel(Context context) {
        mContext = context;
@@ -137,4 +139,12 @@ public class RecentsModel extends TaskStackChangeListener {
    public RecentsTaskLoadPlan getLastLoadPlan() {
        return mLastLoadPlan;
    }

    public void setSystemUiProxy(ISystemUiProxy systemUiProxy) {
        mSystemUiProxy = systemUiProxy;
    }

    public ISystemUiProxy getSystemUiProxy() {
        return mSystemUiProxy;
    }
}
+8 −28
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.systemui.shared.recents.model.Task;

/**
 * Contains options for a recent task when long-pressing its icon.
@@ -51,9 +50,10 @@ public class TaskMenuView extends AbstractFloatingView {

    /** Note that these will be shown in order from top to bottom, if available for the task. */
    private static final TaskSystemShortcut[] MENU_OPTIONS = new TaskSystemShortcut[] {
            new TaskSystemShortcut.Widgets(),
            new TaskSystemShortcut.AppInfo(),
            new TaskSystemShortcut.Install()
            new TaskSystemShortcut.SplitScreen(),
            new TaskSystemShortcut.Pin(),
            new TaskSystemShortcut.Install(),
    };

    private static final long OPEN_CLOSE_DURATION = 220;
@@ -62,7 +62,6 @@ public class TaskMenuView extends AbstractFloatingView {
    private TextView mTaskIconAndName;
    private AnimatorSet mOpenCloseAnimator;
    private TaskView mTaskView;
    private View mWidgetsOptionView;

    public TaskMenuView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
@@ -133,21 +132,21 @@ public class TaskMenuView extends AbstractFloatingView {
        }
        mLauncher.getDragLayer().addView(this);
        mTaskView = taskView;
        addMenuOptions(mTaskView.getTask());
        addMenuOptions(mTaskView);
        orientAroundTaskView(mTaskView);
        post(this::animateOpen);
        return true;
    }

    private void addMenuOptions(Task task) {
        Drawable icon = task.icon.getConstantState().newDrawable();
    private void addMenuOptions(TaskView taskView) {
        Drawable icon = taskView.getTask().icon.getConstantState().newDrawable();
        int iconSize = getResources().getDimensionPixelSize(R.dimen.task_thumbnail_icon_size);
        icon.setBounds(0, 0, iconSize, iconSize);
        mTaskIconAndName.setCompoundDrawables(null, icon, null, null);
        mTaskIconAndName.setText(TaskUtils.getTitle(mLauncher, task));
        mTaskIconAndName.setText(TaskUtils.getTitle(mLauncher, taskView.getTask()));

        for (TaskSystemShortcut menuOption : MENU_OPTIONS) {
            OnClickListener onClickListener = menuOption.getOnClickListener(mLauncher, task);
            OnClickListener onClickListener = menuOption.getOnClickListener(mLauncher, taskView);
            if (onClickListener != null) {
                addMenuOption(menuOption, onClickListener);
            }
@@ -161,10 +160,6 @@ public class TaskMenuView extends AbstractFloatingView {
        menuOptionView.getBubbleText().setText(menuOption.labelResId);
        menuOptionView.setOnClickListener(onClickListener);
        addView(menuOptionView);

        if (menuOption instanceof TaskSystemShortcut.Widgets) {
            mWidgetsOptionView = menuOptionView;
        }
    }

    private void orientAroundTaskView(TaskView taskView) {
@@ -231,19 +226,4 @@ public class TaskMenuView extends AbstractFloatingView {
            }
        };
    }

    @Override
    protected void onWidgetsBound() {
        TaskSystemShortcut widgetsOption = new TaskSystemShortcut.Widgets();
        View.OnClickListener onClickListener = widgetsOption.getOnClickListener(
                mLauncher, mTaskView.getTask());

        if (onClickListener != null && mWidgetsOptionView == null) {
            // We didn't have any widgets cached but now there are some, so add the option.
            addMenuOption(widgetsOption, onClickListener);
        } else if (onClickListener == null && mWidgetsOptionView != null) {
            // No widgets exist, but we previously added the option so remove it.
            removeView(mWidgetsOptionView);
        }
    }
}
Loading