Draw folder leave-behind when opening folder in taskbar

Previously there was only support for CellLayout to draw the
leave-behind. Added FolderIconParent interface so any parent can
draw the leave-behind, and implement that by TaskbarView.

Test: Open folder in Taskber, ensure leave-behind draws

Bug: 171917176
Change-Id: I08d1d939a34f971f893994fe05cac972d165ef53
This commit is contained in:
Tony Wickham
2021-02-10 12:35:28 -08:00
parent 7ba547cd2d
commit bb4de85c25
3 changed files with 72 additions and 18 deletions

View File

@@ -26,10 +26,11 @@ import android.view.View;
import android.view.ViewGroup;
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
public class ShortcutAndWidgetContainer extends ViewGroup {
public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.FolderIconParent {
static final String TAG = "ShortcutAndWidgetContainer";
// These are temporary variables to prevent having to allocate a new object just to
@@ -228,4 +229,24 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
child.cancelLongPress();
}
}
@Override
public void drawFolderLeaveBehindForIcon(FolderIcon child) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
// While the folder is open, the position of the icon cannot change.
lp.canReorder = false;
if (mContainerType == CellLayout.HOTSEAT) {
CellLayout cl = (CellLayout) getParent();
cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
}
}
@Override
public void clearFolderLeaveBehind(FolderIcon child) {
((CellLayout.LayoutParams) child.getLayoutParams()).canReorder = true;
if (mContainerType == CellLayout.HOTSEAT) {
CellLayout cl = (CellLayout) getParent();
cl.clearFolderLeaveBehind();
}
}
}