Search in sources :

Example 31 with ItemOperator

use of com.android.launcher3.Workspace.ItemOperator in project android_packages_apps_404Launcher by P-404.

the class Workspace method widgetsRestored.

public void widgetsRestored(final ArrayList<LauncherAppWidgetInfo> changedInfo) {
    if (!changedInfo.isEmpty()) {
        DeferredWidgetRefresh widgetRefresh = new DeferredWidgetRefresh(changedInfo, mLauncher.getAppWidgetHost());
        LauncherAppWidgetInfo item = changedInfo.get(0);
        final AppWidgetProviderInfo widgetInfo;
        WidgetManagerHelper widgetHelper = new WidgetManagerHelper(getContext());
        if (item.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_ID_NOT_VALID)) {
            widgetInfo = widgetHelper.findProvider(item.providerName, item.user);
        } else {
            widgetInfo = widgetHelper.getLauncherAppWidgetInfo(item.appWidgetId);
        }
        if (widgetInfo != null) {
            // Re-inflate the widgets which have changed status
            widgetRefresh.run();
        } else {
            // widgetRefresh will automatically run when the packages are updated.
            // For now just update the progress bars
            mapOverItems(new ItemOperator() {

                @Override
                public boolean evaluate(ItemInfo info, View view) {
                    if (view instanceof PendingAppWidgetHostView && changedInfo.contains(info)) {
                        ((LauncherAppWidgetInfo) info).installProgress = 100;
                        ((PendingAppWidgetHostView) view).applyState();
                    }
                    // process all the shortcuts
                    return false;
                }
            });
        }
    }
}
Also used : WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) SearchActionItemInfo(com.android.launcher3.model.data.SearchActionItemInfo) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) DraggableView(com.android.launcher3.dragndrop.DraggableView) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) AppWidgetHostView(android.appwidget.AppWidgetHostView) View(android.view.View) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) DragView(com.android.launcher3.dragndrop.DragView)

Example 32 with ItemOperator

use of com.android.launcher3.Workspace.ItemOperator in project android_packages_apps_404Launcher by P-404.

the class Workspace method updateNotificationDots.

public void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
    final PackageUserKey packageUserKey = new PackageUserKey(null, null);
    Predicate<ItemInfo> matcher = info -> !packageUserKey.updateFromItemInfo(info) || updatedDots.test(packageUserKey);
    ItemOperator op = (info, v) -> {
        if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView) {
            if (matcher.test(info)) {
                ((BubbleTextView) v).applyDotState(info, true);
            }
        } else if (info instanceof FolderInfo && v instanceof FolderIcon) {
            FolderInfo fi = (FolderInfo) info;
            if (fi.contents.stream().anyMatch(matcher)) {
                FolderDotInfo folderDotInfo = new FolderDotInfo();
                for (WorkspaceItemInfo si : fi.contents) {
                    folderDotInfo.addDotInfo(mLauncher.getDotInfoForItem(si));
                }
                ((FolderIcon) v).setDotInfo(folderDotInfo);
            }
        }
        // process all the shortcuts
        return false;
    };
    mapOverItems(op);
    Folder folder = Folder.getOpen(mLauncher);
    if (folder != null) {
        folder.iterateOverItems(op);
    }
}
Also used : BitmapRenderer(com.android.launcher3.icons.BitmapRenderer) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) LAUNCHER_SWIPELEFT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) Drawable(android.graphics.drawable.Drawable) DraggableView(com.android.launcher3.dragndrop.DraggableView) WallpaperManager(android.app.WallpaperManager) FolderDotInfo(com.android.launcher3.dot.FolderDotInfo) LayoutTransition(android.animation.LayoutTransition) Interpolators(com.android.launcher3.anim.Interpolators) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Handler(android.os.Handler) Log(android.util.Log) WallpaperOffsetInterpolator(com.android.launcher3.util.WallpaperOffsetInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) OverlayEdgeEffect(com.android.launcher3.util.OverlayEdgeEffect) Nullable(androidx.annotation.Nullable) Message(android.os.Message) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) NORMAL(com.android.launcher3.LauncherState.NORMAL) AccessibleDragListenerAdapter(com.android.launcher3.accessibility.AccessibleDragListenerAdapter) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) AppWidgetHostViewDragListener(com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener) ITEM_TYPE_APPLICATION(com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) SpringLoadedDragController(com.android.launcher3.dragndrop.SpringLoadedDragController) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) PreviewBackground(com.android.launcher3.folder.PreviewBackground) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AnimatorListeners.forSuccessCallback(com.android.launcher3.anim.AnimatorListeners.forSuccessCallback) UserHandle(android.os.UserHandle) Toast(android.widget.Toast) IntArray(com.android.launcher3.util.IntArray) ProviderChangedListener(com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener) Parcelable(android.os.Parcelable) InstanceId(com.android.launcher3.logging.InstanceId) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) DragController(com.android.launcher3.dragndrop.DragController) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) FeatureFlags(com.android.launcher3.config.FeatureFlags) IntSet(com.android.launcher3.util.IntSet) LauncherAppWidgetHost(com.android.launcher3.widget.LauncherAppWidgetHost) LAUNCHER_SWIPERIGHT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT) WorkspaceTouchListener(com.android.launcher3.touch.WorkspaceTouchListener) RunnableList(com.android.launcher3.util.RunnableList) DragPreviewProvider(com.android.launcher3.graphics.DragPreviewProvider) ValueAnimator(android.animation.ValueAnimator) WorkspaceAccessibilityHelper(com.android.launcher3.accessibility.WorkspaceAccessibilityHelper) Rect(android.graphics.Rect) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) Animator(android.animation.Animator) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) FLAG_WORKSPACE_INACCESSIBLE(com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE) AttributeSet(android.util.AttributeSet) FolderInfo(com.android.launcher3.model.data.FolderInfo) View(android.view.View) LauncherEvent(com.android.launcher3.logging.StatsLogManager.LauncherEvent) Predicate(java.util.function.Predicate) EdgeEffectCompat(com.android.launcher3.util.EdgeEffectCompat) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) DragOptions(com.android.launcher3.dragndrop.DragOptions) SparseArray(android.util.SparseArray) WidgetSizes(com.android.launcher3.widget.util.WidgetSizes) List(java.util.List) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) LAUNCHER_STATE_HOME(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) ALPHA_INDEX_OVERLAY(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY) Folder(com.android.launcher3.folder.Folder) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) AppInfo(com.android.launcher3.model.data.AppInfo) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) FolderIcon(com.android.launcher3.folder.FolderIcon) SearchActionItemInfo(com.android.launcher3.model.data.SearchActionItemInfo) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) LauncherBindableItemsContainer(com.android.launcher3.util.LauncherBindableItemsContainer) SuppressLint(android.annotation.SuppressLint) MotionEvent(android.view.MotionEvent) FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED(com.android.launcher3.LauncherState.FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) DragLayer(com.android.launcher3.dragndrop.DragLayer) Executors(com.android.launcher3.util.Executors) Iterator(java.util.Iterator) LayoutInflater(android.view.LayoutInflater) PackageUserKey(com.android.launcher3.util.PackageUserKey) Point(android.graphics.Point) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) Consumer(java.util.function.Consumer) StatsLogManager(com.android.launcher3.logging.StatsLogManager) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Bitmap(android.graphics.Bitmap) WorkspacePageIndicator(com.android.launcher3.pageindicators.WorkspacePageIndicator) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ViewTreeObserver(android.view.ViewTreeObserver) IntSparseArrayMap(com.android.launcher3.util.IntSparseArrayMap) Thunk(com.android.launcher3.util.Thunk) HINT_STATE(com.android.launcher3.LauncherState.HINT_STATE) Collections(java.util.Collections) PendingAnimation(com.android.launcher3.anim.PendingAnimation) DragView(com.android.launcher3.dragndrop.DragView) Resources(android.content.res.Resources) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) SearchActionItemInfo(com.android.launcher3.model.data.SearchActionItemInfo) FolderIcon(com.android.launcher3.folder.FolderIcon) PackageUserKey(com.android.launcher3.util.PackageUserKey) FolderDotInfo(com.android.launcher3.dot.FolderDotInfo) Folder(com.android.launcher3.folder.Folder) FolderInfo(com.android.launcher3.model.data.FolderInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo)

Example 33 with ItemOperator

use of com.android.launcher3.Workspace.ItemOperator in project android_packages_apps_Launcher3 by crdroidandroid.

the class Workspace method updateShortcuts.

void updateShortcuts(List<WorkspaceItemInfo> shortcuts) {
    final HashSet<WorkspaceItemInfo> updates = new HashSet<>(shortcuts);
    ItemOperator op = (info, v) -> {
        if (v instanceof BubbleTextView && updates.contains(info)) {
            WorkspaceItemInfo si = (WorkspaceItemInfo) info;
            BubbleTextView shortcut = (BubbleTextView) v;
            Drawable oldIcon = shortcut.getIcon();
            boolean oldPromiseState = (oldIcon instanceof PreloadIconDrawable) && ((PreloadIconDrawable) oldIcon).hasNotCompleted();
            shortcut.applyFromWorkspaceItem(si, si.isPromise() != oldPromiseState);
        } else if (info instanceof FolderInfo && v instanceof FolderIcon) {
            ((FolderIcon) v).updatePreviewItems(updates::contains);
        }
        // Iterate all items
        return false;
    };
    mapOverItems(op);
    Folder openFolder = Folder.getOpen(mLauncher);
    if (openFolder != null) {
        openFolder.iterateOverItems(op);
    }
}
Also used : BitmapRenderer(com.android.launcher3.icons.BitmapRenderer) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) LAUNCHER_SWIPELEFT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) Drawable(android.graphics.drawable.Drawable) DraggableView(com.android.launcher3.dragndrop.DraggableView) WallpaperManager(android.app.WallpaperManager) FolderDotInfo(com.android.launcher3.dot.FolderDotInfo) LayoutTransition(android.animation.LayoutTransition) Interpolators(com.android.launcher3.anim.Interpolators) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Handler(android.os.Handler) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) Log(android.util.Log) WallpaperOffsetInterpolator(com.android.launcher3.util.WallpaperOffsetInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) OverlayEdgeEffect(com.android.launcher3.util.OverlayEdgeEffect) Message(android.os.Message) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) NORMAL(com.android.launcher3.LauncherState.NORMAL) AccessibleDragListenerAdapter(com.android.launcher3.accessibility.AccessibleDragListenerAdapter) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) AppWidgetHostViewDragListener(com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener) ITEM_TYPE_APPLICATION(com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) SpringLoadedDragController(com.android.launcher3.dragndrop.SpringLoadedDragController) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) PreviewBackground(com.android.launcher3.folder.PreviewBackground) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AnimatorListeners.forSuccessCallback(com.android.launcher3.anim.AnimatorListeners.forSuccessCallback) UserHandle(android.os.UserHandle) Toast(android.widget.Toast) IntArray(com.android.launcher3.util.IntArray) ProviderChangedListener(com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener) Parcelable(android.os.Parcelable) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) DragController(com.android.launcher3.dragndrop.DragController) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) LauncherAppWidgetHost(com.android.launcher3.widget.LauncherAppWidgetHost) LAUNCHER_SWIPERIGHT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT) WorkspaceTouchListener(com.android.launcher3.touch.WorkspaceTouchListener) RunnableList(com.android.launcher3.util.RunnableList) DragPreviewProvider(com.android.launcher3.graphics.DragPreviewProvider) ValueAnimator(android.animation.ValueAnimator) WorkspaceAccessibilityHelper(com.android.launcher3.accessibility.WorkspaceAccessibilityHelper) Rect(android.graphics.Rect) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) Animator(android.animation.Animator) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) FLAG_WORKSPACE_INACCESSIBLE(com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE) AttributeSet(android.util.AttributeSet) FolderInfo(com.android.launcher3.model.data.FolderInfo) View(android.view.View) LauncherEvent(com.android.launcher3.logging.StatsLogManager.LauncherEvent) Predicate(java.util.function.Predicate) EdgeEffectCompat(com.android.launcher3.util.EdgeEffectCompat) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) DragOptions(com.android.launcher3.dragndrop.DragOptions) SparseArray(android.util.SparseArray) WidgetSizes(com.android.launcher3.widget.util.WidgetSizes) List(java.util.List) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) LAUNCHER_STATE_HOME(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) ALPHA_INDEX_OVERLAY(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY) Folder(com.android.launcher3.folder.Folder) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) AppInfo(com.android.launcher3.model.data.AppInfo) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) FolderIcon(com.android.launcher3.folder.FolderIcon) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) HashSet(java.util.HashSet) SuppressLint(android.annotation.SuppressLint) MotionEvent(android.view.MotionEvent) FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED(com.android.launcher3.LauncherState.FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) DragLayer(com.android.launcher3.dragndrop.DragLayer) Executors(com.android.launcher3.util.Executors) ADAPTIVE_ICON_WINDOW_ANIM(com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM) LayoutInflater(android.view.LayoutInflater) PackageUserKey(com.android.launcher3.util.PackageUserKey) Point(android.graphics.Point) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) StatsLogManager(com.android.launcher3.logging.StatsLogManager) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Bitmap(android.graphics.Bitmap) WorkspacePageIndicator(com.android.launcher3.pageindicators.WorkspacePageIndicator) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ViewTreeObserver(android.view.ViewTreeObserver) IntSparseArrayMap(com.android.launcher3.util.IntSparseArrayMap) Thunk(com.android.launcher3.util.Thunk) HINT_STATE(com.android.launcher3.LauncherState.HINT_STATE) Collections(java.util.Collections) PendingAnimation(com.android.launcher3.anim.PendingAnimation) DragView(com.android.launcher3.dragndrop.DragView) Resources(android.content.res.Resources) FolderIcon(com.android.launcher3.folder.FolderIcon) Drawable(android.graphics.drawable.Drawable) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) Folder(com.android.launcher3.folder.Folder) FolderInfo(com.android.launcher3.model.data.FolderInfo) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) HashSet(java.util.HashSet)

Example 34 with ItemOperator

use of com.android.launcher3.Workspace.ItemOperator in project android_packages_apps_Launcher3 by crdroidandroid.

the class Workspace method updateRestoreItems.

public void updateRestoreItems(final HashSet<ItemInfo> updates) {
    ItemOperator op = (info, v) -> {
        if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView && updates.contains(info)) {
            ((BubbleTextView) v).applyLoadingState(false);
        } else if (v instanceof PendingAppWidgetHostView && info instanceof LauncherAppWidgetInfo && updates.contains(info)) {
            ((PendingAppWidgetHostView) v).applyState();
        } else if (v instanceof FolderIcon && info instanceof FolderInfo) {
            ((FolderIcon) v).updatePreviewItems(updates::contains);
        }
        // process all the shortcuts
        return false;
    };
    mapOverItems(op);
    Folder folder = Folder.getOpen(mLauncher);
    if (folder != null) {
        folder.iterateOverItems(op);
    }
}
Also used : BitmapRenderer(com.android.launcher3.icons.BitmapRenderer) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) LAUNCHER_SWIPELEFT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) Drawable(android.graphics.drawable.Drawable) DraggableView(com.android.launcher3.dragndrop.DraggableView) WallpaperManager(android.app.WallpaperManager) FolderDotInfo(com.android.launcher3.dot.FolderDotInfo) LayoutTransition(android.animation.LayoutTransition) Interpolators(com.android.launcher3.anim.Interpolators) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Handler(android.os.Handler) PreloadIconDrawable(com.android.launcher3.graphics.PreloadIconDrawable) Log(android.util.Log) WallpaperOffsetInterpolator(com.android.launcher3.util.WallpaperOffsetInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) OverlayEdgeEffect(com.android.launcher3.util.OverlayEdgeEffect) Message(android.os.Message) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) NORMAL(com.android.launcher3.LauncherState.NORMAL) AccessibleDragListenerAdapter(com.android.launcher3.accessibility.AccessibleDragListenerAdapter) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) AppWidgetHostViewDragListener(com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener) ITEM_TYPE_APPLICATION(com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) SpringLoadedDragController(com.android.launcher3.dragndrop.SpringLoadedDragController) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) PreviewBackground(com.android.launcher3.folder.PreviewBackground) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AnimatorListeners.forSuccessCallback(com.android.launcher3.anim.AnimatorListeners.forSuccessCallback) UserHandle(android.os.UserHandle) Toast(android.widget.Toast) IntArray(com.android.launcher3.util.IntArray) ProviderChangedListener(com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener) Parcelable(android.os.Parcelable) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) DragController(com.android.launcher3.dragndrop.DragController) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) LauncherAppWidgetHost(com.android.launcher3.widget.LauncherAppWidgetHost) LAUNCHER_SWIPERIGHT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT) WorkspaceTouchListener(com.android.launcher3.touch.WorkspaceTouchListener) RunnableList(com.android.launcher3.util.RunnableList) DragPreviewProvider(com.android.launcher3.graphics.DragPreviewProvider) ValueAnimator(android.animation.ValueAnimator) WorkspaceAccessibilityHelper(com.android.launcher3.accessibility.WorkspaceAccessibilityHelper) Rect(android.graphics.Rect) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) Animator(android.animation.Animator) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) FLAG_WORKSPACE_INACCESSIBLE(com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE) AttributeSet(android.util.AttributeSet) FolderInfo(com.android.launcher3.model.data.FolderInfo) View(android.view.View) LauncherEvent(com.android.launcher3.logging.StatsLogManager.LauncherEvent) Predicate(java.util.function.Predicate) EdgeEffectCompat(com.android.launcher3.util.EdgeEffectCompat) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) DragOptions(com.android.launcher3.dragndrop.DragOptions) SparseArray(android.util.SparseArray) WidgetSizes(com.android.launcher3.widget.util.WidgetSizes) List(java.util.List) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) LAUNCHER_STATE_HOME(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) ALPHA_INDEX_OVERLAY(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY) Folder(com.android.launcher3.folder.Folder) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) AppInfo(com.android.launcher3.model.data.AppInfo) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) FolderIcon(com.android.launcher3.folder.FolderIcon) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) HashSet(java.util.HashSet) SuppressLint(android.annotation.SuppressLint) MotionEvent(android.view.MotionEvent) FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED(com.android.launcher3.LauncherState.FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) DragLayer(com.android.launcher3.dragndrop.DragLayer) Executors(com.android.launcher3.util.Executors) ADAPTIVE_ICON_WINDOW_ANIM(com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM) LayoutInflater(android.view.LayoutInflater) PackageUserKey(com.android.launcher3.util.PackageUserKey) Point(android.graphics.Point) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) StatsLogManager(com.android.launcher3.logging.StatsLogManager) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Bitmap(android.graphics.Bitmap) WorkspacePageIndicator(com.android.launcher3.pageindicators.WorkspacePageIndicator) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ViewTreeObserver(android.view.ViewTreeObserver) IntSparseArrayMap(com.android.launcher3.util.IntSparseArrayMap) Thunk(com.android.launcher3.util.Thunk) HINT_STATE(com.android.launcher3.LauncherState.HINT_STATE) Collections(java.util.Collections) PendingAnimation(com.android.launcher3.anim.PendingAnimation) DragView(com.android.launcher3.dragndrop.DragView) Resources(android.content.res.Resources) FolderIcon(com.android.launcher3.folder.FolderIcon) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) Folder(com.android.launcher3.folder.Folder) FolderInfo(com.android.launcher3.model.data.FolderInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo)

Example 35 with ItemOperator

use of com.android.launcher3.Workspace.ItemOperator in project android_packages_apps_Launcher3 by crdroidandroid.

the class RequestPinItemTest method testPinShortcut.

@Test
public void testPinShortcut() throws Throwable {
    // Command to set the shortcut id
    Intent command = RequestPinItemActivity.getCommandIntent(RequestPinItemActivity.class, "setShortcutId").putExtra(RequestPinItemActivity.EXTRA_PARAM + "0", mShortcutId);
    runTest("pinShortcut", false, new ItemOperator() {

        @Override
        public boolean evaluate(ItemInfo info, View view) {
            return info instanceof WorkspaceItemInfo && info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT && ShortcutKey.fromItemInfo(info).getId().equals(mShortcutId);
        }
    }, command);
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) RequestPinItemActivity(com.android.launcher3.testcomponent.RequestPinItemActivity) ItemOperator(com.android.launcher3.Workspace.ItemOperator) View(android.view.View) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AbstractLauncherUiTest(com.android.launcher3.ui.AbstractLauncherUiTest) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

View (android.view.View)42 PendingAppWidgetHostView (com.android.launcher3.widget.PendingAppWidgetHostView)35 ItemInfo (com.android.launcher3.model.data.ItemInfo)30 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)30 AppWidgetHostView (android.appwidget.AppWidgetHostView)27 DragView (com.android.launcher3.dragndrop.DragView)27 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)27 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)24 DraggableView (com.android.launcher3.dragndrop.DraggableView)22 Bitmap (android.graphics.Bitmap)21 Drawable (android.graphics.drawable.Drawable)21 Folder (com.android.launcher3.folder.Folder)21 FolderIcon (com.android.launcher3.folder.FolderIcon)21 SuppressLint (android.annotation.SuppressLint)20 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)20 Point (android.graphics.Point)20 FolderInfo (com.android.launcher3.model.data.FolderInfo)18 PreloadIconDrawable (com.android.launcher3.graphics.PreloadIconDrawable)17 HashSet (java.util.HashSet)17 List (java.util.List)15