当前位置: 首页>>代码示例>>Java>>正文


Java FolderInfo类代码示例

本文整理汇总了Java中com.android.launcher3.FolderInfo的典型用法代码示例。如果您正苦于以下问题:Java FolderInfo类的具体用法?Java FolderInfo怎么用?Java FolderInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FolderInfo类属于com.android.launcher3包,在下文中一共展示了FolderInfo类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfirmationForIconDrop

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
@Override
protected String getConfirmationForIconDrop(int id) {
    int x = id % mView.getCountX();
    int y = id / mView.getCountX();
    LauncherAccessibilityDelegate.DragInfo dragInfo = mDelegate.getDragInfo();

    View child = mView.getChildAt(x, y);
    if (child == null || child == dragInfo.item) {
        return mContext.getString(R.string.item_moved);
    } else {
        ItemInfo info = (ItemInfo) child.getTag();
        if (info instanceof AppInfo || info instanceof ShortcutInfo) {
            return mContext.getString(R.string.folder_created);

        } else if (info instanceof FolderInfo) {
            return mContext.getString(R.string.added_to_folder);
        }
    }
    return "";
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:WorkspaceAccessibilityHelper.java

示例2: getDescriptionForDropOver

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public static String getDescriptionForDropOver(View overChild, Context context) {
    ItemInfo info = (ItemInfo) overChild.getTag();
    if (info instanceof ShortcutInfo) {
        return context.getString(R.string.create_folder_with, info.title);
    } else if (info instanceof FolderInfo) {
        if (TextUtils.isEmpty(info.title)) {
            // Find the first item in the folder.
            FolderInfo folder = (FolderInfo) info;
            ShortcutInfo firstItem = null;
            for (ShortcutInfo shortcut : folder.contents) {
                if (firstItem == null || firstItem.rank > shortcut.rank) {
                    firstItem = shortcut;
                }
            }

            if (firstItem != null) {
                return context.getString(R.string.add_to_folder_with_app, firstItem.title);
            }
        }
        return context.getString(R.string.add_to_folder, info.title);
    }
    return "";
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:24,代码来源:WorkspaceAccessibilityHelper.java

示例3: addActions

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
protected void addActions(View host, AccessibilityNodeInfo info) {
    if (!(host.getTag() instanceof ItemInfo)) return;
    ItemInfo item = (ItemInfo) host.getTag();

    if (host instanceof BubbleTextView && ((BubbleTextView) host).hasDeepShortcuts()) {
        info.addAction(mActions.get(DEEP_SHORTCUTS));
    }

    if (DeleteDropTarget.supportsAccessibleDrop(item)) {
        info.addAction(mActions.get(REMOVE));
    }
    if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
        info.addAction(mActions.get(UNINSTALL));
    }
    if (InfoDropTarget.supportsDrop(item)) {
        info.addAction(mActions.get(INFO));
    }

    if ((item instanceof ShortcutInfo)
            || (item instanceof LauncherAppWidgetInfo)
            || (item instanceof FolderInfo)) {
        info.addAction(mActions.get(MOVE));

        if (item.container >= 0) {
            info.addAction(mActions.get(MOVE_TO_WORKSPACE));
        } else if (item instanceof LauncherAppWidgetInfo) {
            if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
                info.addAction(mActions.get(RESIZE));
            }
        }
    }

    if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
        info.addAction(mActions.get(ADD_TO_WORKSPACE));
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:37,代码来源:LauncherAccessibilityDelegate.java

示例4: beginAccessibleDrag

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public void beginAccessibleDrag(View item, ItemInfo info) {
    mDragInfo = new DragInfo();
    mDragInfo.info = info;
    mDragInfo.item = item;
    mDragInfo.dragType = DragType.ICON;
    if (info instanceof FolderInfo) {
        mDragInfo.dragType = DragType.FOLDER;
    } else if (info instanceof LauncherAppWidgetInfo) {
        mDragInfo.dragType = DragType.WIDGET;
    }

    CellLayout.CellInfo cellInfo = new CellLayout.CellInfo(item, info);

    Rect pos = new Rect();
    mLauncher.getDragLayer().getDescendantRectRelativeToSelf(item, pos);
    mLauncher.getDragController().prepareAccessibleDrag(pos.centerX(), pos.centerY());

    Workspace workspace = mLauncher.getWorkspace();

    Folder folder = workspace.getOpenFolder();
    if (folder != null) {
        if (!folder.getItemsInReadingOrder().contains(item)) {
            mLauncher.closeFolder();
            folder = null;
        }
    }

    mLauncher.getDragController().addDragListener(this);

    DragOptions options = new DragOptions();
    options.isAccessibleDrag = true;
    if (folder != null) {
        folder.startDrag(cellInfo.cell, options);
    } else {
        workspace.startDrag(cellInfo, options);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:38,代码来源:LauncherAccessibilityDelegate.java

示例5: getLocationDescriptionForIconDrop

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
@Override
protected String getLocationDescriptionForIconDrop(int id) {
    int x = id % mView.getCountX();
    int y = id / mView.getCountX();
    LauncherAccessibilityDelegate.DragInfo dragInfo = mDelegate.getDragInfo();

    View child = mView.getChildAt(x, y);
    if (child == null || child == dragInfo.item) {
        if (mView.isHotseat()) {
            return mContext.getString(R.string.move_to_hotseat_position, id + 1);
        } else {
            return mContext.getString(R.string.move_to_empty_cell, y + 1, x + 1);
        }
    } else {
        ItemInfo info = (ItemInfo) child.getTag();
        if (info instanceof ShortcutInfo) {
            return mContext.getString(R.string.create_folder_with, info.title);
        } else if (info instanceof FolderInfo) {
            if (TextUtils.isEmpty(info.title)) {
                // Find the first item in the folder.
                FolderInfo folder = (FolderInfo) info;
                ShortcutInfo firstItem = null;
                for (ShortcutInfo shortcut : folder.contents) {
                    if (firstItem == null || firstItem.rank > shortcut.rank) {
                        firstItem = shortcut;
                    }
                }

                if (firstItem != null) {
                    return mContext.getString(R.string.add_to_folder_with_app, firstItem.title);
                }
            }
            return mContext.getString(R.string.add_to_folder, info.title);
        }
    }
    return "";
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:38,代码来源:WorkspaceAccessibilityHelper.java

示例6: onInitializeAccessibilityNodeInfo

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
    if (!(host.getTag() instanceof ItemInfo)) return;
    ItemInfo item = (ItemInfo) host.getTag();

    if (DeleteDropTarget.supportsDrop(item)) {
        info.addAction(mActions.get(REMOVE));
    }
    if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
        info.addAction(mActions.get(UNINSTALL));
    }
    if (InfoDropTarget.supportsDrop(host.getContext(), item)) {
        info.addAction(mActions.get(INFO));
    }

    if ((item instanceof ShortcutInfo)
            || (item instanceof LauncherAppWidgetInfo)
            || (item instanceof FolderInfo)) {
        info.addAction(mActions.get(MOVE));

        if (item.container >= 0) {
            info.addAction(mActions.get(MOVE_TO_WORKSPACE));
        } else if (item instanceof LauncherAppWidgetInfo) {
            if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
                info.addAction(mActions.get(RESIZE));
            }
        }
    } if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
        info.addAction(mActions.get(ADD_TO_WORKSPACE));
    }
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:33,代码来源:LauncherAccessibilityDelegate.java

示例7: beginAccessibleDrag

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public void beginAccessibleDrag(View item, ItemInfo info) {
    mDragInfo = new DragInfo();
    mDragInfo.info = info;
    mDragInfo.item = item;
    mDragInfo.dragType = DragType.ICON;
    if (info instanceof FolderInfo) {
        mDragInfo.dragType = DragType.FOLDER;
    } else if (info instanceof LauncherAppWidgetInfo) {
        mDragInfo.dragType = DragType.WIDGET;
    }

    CellLayout.CellInfo cellInfo = new CellLayout.CellInfo(item, info);

    Rect pos = new Rect();
    mLauncher.getDragLayer().getDescendantRectRelativeToSelf(item, pos);
    mLauncher.getDragController().prepareAccessibleDrag(pos.centerX(), pos.centerY());

    Workspace workspace = mLauncher.getWorkspace();

    Folder folder = workspace.getOpenFolder();
    if (folder != null) {
        if (folder.getItemsInReadingOrder().contains(item)) {
            mDragSource = folder;
        } else {
            mLauncher.closeFolder();
        }
    }
    if (mDragSource == null) {
        mDragSource = workspace;
    }
    mDragSource.enableAccessibleDrag(true);
    mDragSource.startDrag(cellInfo, true);

    if (mLauncher.getDragController().isDragging()) {
        mLauncher.getDragController().addDragListener(this);
    }
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:38,代码来源:LauncherAccessibilityDelegate.java

示例8: getInfo

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
/**
 * @return the FolderInfo object associated with this folder
 */
public FolderInfo getInfo() {
    return mInfo;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:7,代码来源:Folder.java

示例9: bind

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
void bind(FolderInfo info) {
    mInfo = info;
    ArrayList<ShortcutInfo> children = info.contents;
    Collections.sort(children, ITEM_POS_COMPARATOR);

    ArrayList<ShortcutInfo> overflow = mContent.bindItems(children);

    // If our folder has too many items we prune them from the list. This is an issue
    // when upgrading from the old Folders implementation which could contain an unlimited
    // number of items.
    // TODO: Remove this, as with multi-page folders, there will never be any overflow
    for (ShortcutInfo item: overflow) {
        mInfo.remove(item, false);
        LauncherModel.deleteItemFromDatabase(mLauncher, item);
    }

    DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
    if (lp == null) {
        lp = new DragLayer.LayoutParams(0, 0);
        lp.customPosition = true;
        setLayoutParams(lp);
    }
    centerAboutIcon();

    mItemsInvalidated = true;
    updateTextViewFocus();
    mInfo.addListener(this);

    if (!sDefaultFolderName.contentEquals(mInfo.title)) {
        mFolderName.setText(mInfo.title);
    } else {
        mFolderName.setText("");
    }

    // In case any children didn't come across during loading, clean up the folder accordingly
    mFolderIcon.post(new Runnable() {
        public void run() {
            if (getItemCount() <= 1) {
                replaceFolderWithFinalItem();
            }
        }
    });
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:44,代码来源:Folder.java

示例10: onDropCompleted

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public void onDropCompleted(final View target, final DragObject d,
        final boolean isFlingToDelete, final boolean success) {
    if (mDeferDropAfterUninstall) {
        Log.d(TAG, "Deferred handling drop because waiting for uninstall.");
        mDeferredAction = new Runnable() {
                public void run() {
                    onDropCompleted(target, d, isFlingToDelete, success);
                    mDeferredAction = null;
                }
            };
        return;
    }

    boolean beingCalledAfterUninstall = mDeferredAction != null;
    boolean successfulDrop =
            success && (!beingCalledAfterUninstall || mUninstallSuccessful);

    if (successfulDrop) {
        if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
            replaceFolderWithFinalItem();
        }
    } else if (!mDragController.isDeferringDrag()) {
        // The drag failed, we need to return the item to the folder
        ShortcutInfo info = (ShortcutInfo) d.dragInfo;
        View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info)
                ? mCurrentDragView : mContent.createNewView(info);
        ArrayList<View> views = getItemsInReadingOrder();
        views.add(info.rank, icon);
        mContent.arrangeChildren(views, views.size());
        mItemsInvalidated = true;

        try (SuppressInfoChanges s = new SuppressInfoChanges()) {
            mFolderIcon.onDrop(d);
        }
    }

    if (target != this) {
        if (mOnExitAlarm.alarmPending()) {
            mOnExitAlarm.cancelAlarm();
            if (!successfulDrop) {
                mSuppressFolderDeletion = true;
            }
            mScrollPauseAlarm.cancelAlarm();
            completeDragExit();
        }
    }

    mDeleteFolderOnDropCompleted = false;
    mDragInProgress = false;
    mItemAddedBackToSelfViaIcon = false;
    mCurrentDragView = null;

    // Reordering may have occured, and we need to save the new item locations. We do this once
    // at the end to prevent unnecessary database operations.
    updateItemLocationsInDatabaseBatch();

    // Use the item count to check for multi-page as the folder UI may not have
    // been refreshed yet.
    if (getItemCount() <= mContent.itemsPerPage()) {
        // Show the animation, next time something is added to the folder.
        mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, false, mLauncher);
    }

    if (!isFlingToDelete) {
        // Fling to delete already exits spring loaded mode after the animation finishes.
        mLauncher.exitSpringLoadedDragModeDelayed(successfulDrop,
                Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:70,代码来源:Folder.java

示例11: fromXml

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
        FolderInfo folderInfo, IconCache iconCache) {
    @SuppressWarnings("all") // suppress dead code warning
    final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
    if (error) {
        throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
                "INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
                "is dependent on this");
    }

    DeviceProfile grid = launcher.getDeviceProfile();
    FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);

    // For performance and compatibility reasons we render the preview using a software layer.
    // In particular, hardware path clipping has spotty ecosystem support and bad performance.
    // Software rendering also allows us to use shadow layers.
    icon.setLayerType(LAYER_TYPE_SOFTWARE, new Paint(Paint.FILTER_BITMAP_FLAG));

    icon.setClipToPadding(false);
    icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
    icon.mFolderName.setText(folderInfo.title);
    icon.mFolderName.setCompoundDrawablePadding(0);
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams();
    lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx;

    icon.setTag(folderInfo);
    icon.setOnClickListener(launcher);
    icon.mInfo = folderInfo;
    icon.mLauncher = launcher;
    icon.setContentDescription(launcher.getString(R.string.folder_name_format, folderInfo.title));
    Folder folder = Folder.fromXml(launcher);
    folder.setDragController(launcher.getDragController());
    folder.setFolderIcon(icon);
    folder.bind(folderInfo);
    icon.setFolder(folder);
    icon.setAccessibilityDelegate(launcher.getAccessibilityDelegate());

    folderInfo.addListener(icon);

    icon.setOnFocusChangeListener(launcher.mFocusHandler);
    return icon;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:43,代码来源:FolderIcon.java

示例12: getFolderInfo

import com.android.launcher3.FolderInfo; //导入依赖的package包/类
public FolderInfo getFolderInfo() {
    return mInfo;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:4,代码来源:FolderIcon.java


注:本文中的com.android.launcher3.FolderInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。