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

Commit a596f589 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Allow app pairs in folders

This CL substantially refactors folders to be able to take contents of type AppPairInfo. App pairs can now be moved in and out of folders, and launch from folders.

This CL contains only logic and model changes; animation and style changes (for dropping items into folders, color changes to app pair surfaces, etc.) will be in a following CL. Another CL (hopefully) will contain tests. I'm planning to submit them together, but this patch should also be able to stand alone with no issues (except janky transitions).

Bug: 315731527
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TRUNKFOOD
Test: Manual, more to follow in another CL.
Change-Id: I73732fcaefbdc61bf6e02a5be365962b8bbc3e41
parent da4ba933
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
                FolderInfo fi = (FolderInfo) info;
                if (fi.anyMatch(matcher)) {
                    FolderDotInfo folderDotInfo = new FolderDotInfo();
                    for (WorkspaceItemInfo si : fi.getContents()) {
                    for (ItemInfo si : fi.getContents()) {
                        folderDotInfo.addDotInfo(mPopupDataProvider.getDotInfoForItem(si));
                    }
                    ((FolderIcon) v).setDotInfo(folderDotInfo);
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class AppPairsController {

        IconCache iconCache = LauncherAppState.getInstance(mContext).getIconCache();
        MODEL_EXECUTOR.execute(() -> {
            newAppPair.getContents().forEach(member -> {
            newAppPair.getAppContents().forEach(member -> {
                member.title = "";
                member.bitmap = iconCache.getDefaultIcon(newAppPair.user);
                iconCache.getTitleAndIcon(member, member.usingLowResIcon());
+1 −0
Original line number Diff line number Diff line
@@ -671,6 +671,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
                appIcon2,
                dividerPos
            )
        floatingView.bringToFront()

        // Launcher animation: animate the floating view, expanding to fill the display surface
        progressUpdater.addUpdateListener(
+39 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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.apppairs.AppPairIcon
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:focusable="true"
    launcher:iconDisplay="folder" >
    <com.android.launcher3.apppairs.AppPairIconGraphic
        android:id="@+id/app_pair_icon_graphic"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="false" />
    <com.android.launcher3.BubbleTextView
        style="@style/BaseIcon"
        android:id="@+id/app_pair_icon_name"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="false"
        android:layout_gravity="top"
        android:textColor="?attr/folderTextColor"
        launcher:iconDisplay="folder" />
</com.android.launcher3.apppairs.AppPairIcon>
 No newline at end of file
+10 −13
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.launcher3;

import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.EDIT_MODE;
import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE;
@@ -1873,12 +1873,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
            return false;
        }

        boolean aboveShortcut = (dropOverView.getTag() instanceof WorkspaceItemInfo
                && ((WorkspaceItemInfo) dropOverView.getTag()).container
                != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION);
        boolean willBecomeShortcut =
                (info.itemType == ITEM_TYPE_APPLICATION ||
                        info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT);
        boolean aboveShortcut = Folder.willAccept(dropOverView.getTag())
                && ((ItemInfo) dropOverView.getTag()).container != CONTAINER_HOTSEAT_PREDICTION;
        boolean willBecomeShortcut = Folder.willAcceptItemType(info.itemType);

        return (aboveShortcut && willBecomeShortcut);
    }
@@ -1925,12 +1922,12 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        mCreateUserFolderOnDrop = false;
        final int screenId = getCellLayoutId(target);

        boolean aboveShortcut = (v.getTag() instanceof WorkspaceItemInfo);
        boolean willBecomeShortcut = (newView.getTag() instanceof WorkspaceItemInfo);
        boolean aboveShortcut = Folder.willAccept(v.getTag());
        boolean willBecomeShortcut = Folder.willAccept(newView.getTag());

        if (aboveShortcut && willBecomeShortcut) {
            WorkspaceItemInfo sourceInfo = (WorkspaceItemInfo) newView.getTag();
            WorkspaceItemInfo destInfo = (WorkspaceItemInfo) v.getTag();
            ItemInfo sourceInfo = (ItemInfo) newView.getTag();
            ItemInfo destInfo = (ItemInfo) v.getTag();
            // if the drag started here, we need to remove it from the workspace
            if (!external) {
                getParentCellLayoutForView(mDragInfo.cell).removeView(mDragInfo.cell);
@@ -3314,7 +3311,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
                    }
                } else if (child instanceof FolderIcon) {
                    FolderInfo folderInfo = (FolderInfo) info;
                    List<WorkspaceItemInfo> matches = folderInfo.getContents().stream()
                    List<ItemInfo> matches = folderInfo.getContents().stream()
                            .filter(matcher)
                            .collect(Collectors.toList());
                    if (!matches.isEmpty()) {
@@ -3381,7 +3378,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
                FolderInfo fi = (FolderInfo) info;
                if (fi.anyMatch(matcher)) {
                    FolderDotInfo folderDotInfo = new FolderDotInfo();
                    for (WorkspaceItemInfo si : fi.getContents()) {
                    for (ItemInfo si : fi.getContents()) {
                        folderDotInfo.addDotInfo(mLauncher.getDotInfoForItem(si));
                    }
                    ((FolderIcon) v).setDotInfo(folderDotInfo);
Loading