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

Commit 1ae42423 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Load folder names during LoaderTask

Bug: 147359653

Change-Id: I4d1b53c3a72d0773d4bc8819ee8118fc719944ad
parent 4db9ceb8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
    <!-- Various classes overriden by projects/build flavors. -->
    <string name="app_filter_class" translatable="false"></string>
    <string name="user_event_dispatcher_class" translatable="false"></string>
    <string name="folder_name_provider_class" translatable="false"></string>
    <string name="stats_log_manager_class" translatable="false"></string>
    <string name="app_transition_manager_class" translatable="false"></string>
    <string name="instant_app_resolver_class" translatable="false"></string>
+9 −1
Original line number Diff line number Diff line
@@ -16,11 +16,14 @@

package com.android.launcher3;

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

import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.folder.FolderNameProvider;

/**
 * Interface defining an object that can receive a drag.
@@ -67,7 +70,12 @@ public interface DropTarget {

        public DragViewStateAnnouncer stateAnnouncer;

        public DragObject() {
        public FolderNameProvider folderNameProvider;

        public DragObject(Context context) {
            if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
                folderNameProvider = FolderNameProvider.newInstance(context);
            }
        }

        /**
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.launcher3;

import android.content.Intent;
import android.os.Process;

import com.android.launcher3.model.ModelWriter;
@@ -49,6 +50,8 @@ public class FolderInfo extends ItemInfo {

    public int options;

    public Intent suggestedFolderNames;

    /**
     * The apps and shortcuts
     */
+3 −8
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.folder.FolderGridOrganizer;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.folder.FolderNameProvider;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.keyboard.CustomActionsPopup;
@@ -616,10 +615,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        return mStateManager;
    }

    public FolderNameProvider getFolderNameProvider() {
        return new FolderNameProvider();
    }

    @Override
    public <T extends View> T findViewById(int id) {
        return mLauncherView.findViewById(id);
@@ -1259,13 +1254,13 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
                cellXY[1] = cellY;
                foundCellSpan = true;

                DragObject dragObject = new DragObject(getApplicationContext());
                dragObject.dragInfo = info;
                // If appropriate, either create a folder or add to an existing folder
                if (mWorkspace.createUserFolderIfNecessary(view, container, layout, cellXY, 0,
                        true, null)) {
                        true, dragObject)) {
                    return;
                }
                DragObject dragObject = new DragObject();
                dragObject.dragInfo = info;
                if (mWorkspace.addToExistingFolderIfNecessary(view, layout, cellXY, 0, dragObject,
                        true)) {
                    return;
+6 −7
Original line number Diff line number Diff line
@@ -1673,7 +1673,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
    }

    boolean createUserFolderIfNecessary(View newView, int container, CellLayout target,
            int[] targetCell, float distance, boolean external, DragView dragView) {
            int[] targetCell, float distance, boolean external, DragObject d) {
        if (distance > mMaxDistanceForFolderCreation) return false;
        View v = target.getChildAt(targetCell[0], targetCell[1]);

@@ -1711,14 +1711,13 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
            sourceInfo.cellY = -1;

            // If the dragView is null, we can't animate
            boolean animate = dragView != null;
            boolean animate = d != null;
            if (animate) {
                // In order to keep everything continuous, we hand off the currently rendered
                // folder background to the newly created icon. This preserves animation state.
                fi.setFolderBackground(mFolderCreateBg);
                mFolderCreateBg = new PreviewBackground();
                fi.performCreateAnimation(destInfo, v, sourceInfo, dragView, folderLocation, scale
                );
                fi.performCreateAnimation(destInfo, v, sourceInfo, d, folderLocation, scale);
            } else {
                fi.prepareCreateAnimation(v);
                fi.addItem(destInfo);
@@ -1799,8 +1798,8 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                // If the item being dropped is a shortcut and the nearest drop
                // cell also contains a shortcut, then create a folder with the two shortcuts.
                if (createUserFolderIfNecessary(cell, container,
                        dropTargetLayout, mTargetCell, distance, false, d.dragView) ||
                        addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell,
                        dropTargetLayout, mTargetCell, distance, false, d)
                        || addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell,
                                distance, d, false)) {
                    mLauncher.getStateManager().goToState(NORMAL, SPRING_LOADED_EXIT_DELAY);
                    return;
@@ -2561,7 +2560,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                float distance = cellLayout.getDistanceFromCell(mDragViewVisualCenter[0],
                        mDragViewVisualCenter[1], mTargetCell);
                if (createUserFolderIfNecessary(view, container, cellLayout, mTargetCell, distance,
                        true, d.dragView)) {
                        true, d)) {
                    return;
                }
                if (addToExistingFolderIfNecessary(view, cellLayout, mTargetCell, distance, d,
Loading