Search in sources :

Example 6 with RecentsModel

use of com.android.quickstep.RecentsModel in project android_packages_apps_Launcher3 by ArrowOS.

the class TaskView method onTaskListVisibilityChanged.

/**
 * See {@link TaskDataChanges}
 * @param visible If this task view will be visible to the user in overview or hidden
 */
public void onTaskListVisibilityChanged(boolean visible, @TaskDataChanges int changes) {
    if (mTask == null) {
        return;
    }
    cancelPendingLoadTasks();
    if (visible) {
        // These calls are no-ops if the data is already loaded, try and load the high
        // resolution thumbnail if the state permits
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mThumbnailLoadRequest = thumbnailCache.updateThumbnailInBackground(mTask, thumbnail -> {
                mSnapshotView.setThumbnail(mTask, thumbnail);
            });
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            mIconLoadRequest = iconCache.updateIconInBackground(mTask, (task) -> {
                setIcon(mIconView, task.icon);
                mDigitalWellBeingToast.initialize(mTask);
            });
        }
    } else {
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mSnapshotView.setThumbnail(null, null);
            // Reset the task thumbnail reference as well (it will be fetched from the cache or
            // reloaded next time we need it)
            mTask.thumbnail = null;
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            setIcon(mIconView, null);
        }
    }
}
Also used : Rect(android.graphics.Rect) Task(com.android.systemui.shared.recents.model.Task) Arrays(java.util.Arrays) Bundle(android.os.Bundle) Utilities.getDescendantCoordRelativeToAncestor(com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor) NonNull(androidx.annotation.NonNull) TestProtocol(com.android.launcher3.testing.TestProtocol) FrameLayout(android.widget.FrameLayout) Animator(android.animation.Animator) LauncherSettings(com.android.launcher3.LauncherSettings) SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) Drawable(android.graphics.drawable.Drawable) TouchDelegate(android.view.TouchDelegate) FloatProperty(android.util.FloatProperty) ActivityOptions(android.app.ActivityOptions) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) Interpolators(com.android.launcher3.anim.Interpolators) TaskViewUtils(com.android.quickstep.TaskViewUtils) STAGE_POSITION_BOTTOM_OR_RIGHT(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) MAIN_EXECUTOR(com.android.launcher3.util.Executors.MAIN_EXECUTOR) View(android.view.View) TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) Log(android.util.Log) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) Interpolator(android.view.animation.Interpolator) ObjectAnimator(android.animation.ObjectAnimator) LAUNCHER_TASK_LAUNCH_TAP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP) TaskUtils(com.android.quickstep.TaskUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) DeviceProfile(com.android.launcher3.DeviceProfile) Outline(android.graphics.Outline) List(java.util.List) Nullable(androidx.annotation.Nullable) Stream(java.util.stream.Stream) CancellableTask(com.android.quickstep.util.CancellableTask) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) IdRes(android.annotation.IdRes) RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) TYPE_TASK_MENU(com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU) ACCEL_DEACCEL(com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) SplitConfigurationOptions(com.android.launcher3.util.SplitConfigurationOptions) ViewOutlineProvider(android.view.ViewOutlineProvider) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) Intent(android.content.Intent) HashMap(java.util.HashMap) SystemUiProxy(com.android.quickstep.SystemUiProxy) IntDef(androidx.annotation.IntDef) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) Retention(java.lang.annotation.Retention) Utilities.comp(com.android.launcher3.Utilities.comp) TransformParams(com.android.quickstep.util.TransformParams) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) STAGE_POSITION_UNDEFINED(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED) Toast(android.widget.Toast) AnimatorSet(android.animation.AnimatorSet) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) SystemShortcut(com.android.launcher3.popup.SystemShortcut) TaskCornerRadius(com.android.quickstep.util.TaskCornerRadius) Reusable(com.android.launcher3.util.ViewPool.Reusable) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) TaskIconCache(com.android.quickstep.TaskIconCache) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) OVERVIEW_SPLIT_SELECT(com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT) PreviewPositionHelper(com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper) R(com.android.launcher3.R) TestLogging(com.android.launcher3.testing.TestLogging) RecentsModel(com.android.quickstep.RecentsModel) ComponentKey(com.android.launcher3.util.ComponentKey) SOURCE(java.lang.annotation.RetentionPolicy.SOURCE) LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RunnableList(com.android.launcher3.util.RunnableList) Collections(java.util.Collections) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Example 7 with RecentsModel

use of com.android.quickstep.RecentsModel in project android_packages_apps_Launcher3 by ProtonAOSP.

the class TaskView method onTaskListVisibilityChanged.

/**
 * See {@link TaskDataChanges}
 * @param visible If this task view will be visible to the user in overview or hidden
 */
public void onTaskListVisibilityChanged(boolean visible, @TaskDataChanges int changes) {
    if (mTask == null) {
        return;
    }
    cancelPendingLoadTasks();
    if (visible) {
        // These calls are no-ops if the data is already loaded, try and load the high
        // resolution thumbnail if the state permits
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mThumbnailLoadRequest = thumbnailCache.updateThumbnailInBackground(mTask, thumbnail -> {
                mSnapshotView.setThumbnail(mTask, thumbnail);
            });
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            mIconLoadRequest = iconCache.updateIconInBackground(mTask, (task) -> {
                setIcon(mIconView, task.icon);
                mDigitalWellBeingToast.initialize(mTask);
            });
        }
    } else {
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mSnapshotView.setThumbnail(null, null);
            // Reset the task thumbnail reference as well (it will be fetched from the cache or
            // reloaded next time we need it)
            mTask.thumbnail = null;
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            setIcon(mIconView, null);
        }
    }
}
Also used : Rect(android.graphics.Rect) Task(com.android.systemui.shared.recents.model.Task) Arrays(java.util.Arrays) Bundle(android.os.Bundle) Utilities.getDescendantCoordRelativeToAncestor(com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor) NonNull(androidx.annotation.NonNull) TestProtocol(com.android.launcher3.testing.TestProtocol) FrameLayout(android.widget.FrameLayout) Animator(android.animation.Animator) LauncherSettings(com.android.launcher3.LauncherSettings) SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) Drawable(android.graphics.drawable.Drawable) TouchDelegate(android.view.TouchDelegate) FloatProperty(android.util.FloatProperty) ActivityOptions(android.app.ActivityOptions) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) Interpolators(com.android.launcher3.anim.Interpolators) TaskViewUtils(com.android.quickstep.TaskViewUtils) STAGE_POSITION_BOTTOM_OR_RIGHT(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) MAIN_EXECUTOR(com.android.launcher3.util.Executors.MAIN_EXECUTOR) View(android.view.View) TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) Log(android.util.Log) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) Interpolator(android.view.animation.Interpolator) ObjectAnimator(android.animation.ObjectAnimator) LAUNCHER_TASK_LAUNCH_TAP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP) TaskUtils(com.android.quickstep.TaskUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) DeviceProfile(com.android.launcher3.DeviceProfile) Outline(android.graphics.Outline) List(java.util.List) Nullable(androidx.annotation.Nullable) Stream(java.util.stream.Stream) CancellableTask(com.android.quickstep.util.CancellableTask) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) IdRes(android.annotation.IdRes) RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) TYPE_TASK_MENU(com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU) ACCEL_DEACCEL(com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) SplitConfigurationOptions(com.android.launcher3.util.SplitConfigurationOptions) ViewOutlineProvider(android.view.ViewOutlineProvider) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) Intent(android.content.Intent) HashMap(java.util.HashMap) SystemUiProxy(com.android.quickstep.SystemUiProxy) IntDef(androidx.annotation.IntDef) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) Retention(java.lang.annotation.Retention) Utilities.comp(com.android.launcher3.Utilities.comp) TransformParams(com.android.quickstep.util.TransformParams) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) STAGE_POSITION_UNDEFINED(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED) Toast(android.widget.Toast) AnimatorSet(android.animation.AnimatorSet) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) SystemShortcut(com.android.launcher3.popup.SystemShortcut) TaskCornerRadius(com.android.quickstep.util.TaskCornerRadius) Reusable(com.android.launcher3.util.ViewPool.Reusable) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) TaskIconCache(com.android.quickstep.TaskIconCache) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) OVERVIEW_SPLIT_SELECT(com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT) PreviewPositionHelper(com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper) R(com.android.launcher3.R) TestLogging(com.android.launcher3.testing.TestLogging) RecentsModel(com.android.quickstep.RecentsModel) ComponentKey(com.android.launcher3.util.ComponentKey) SOURCE(java.lang.annotation.RetentionPolicy.SOURCE) LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RunnableList(com.android.launcher3.util.RunnableList) Collections(java.util.Collections) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Example 8 with RecentsModel

use of com.android.quickstep.RecentsModel in project android_packages_apps_404Launcher by P-404.

the class TaskView method onTaskListVisibilityChanged.

/**
 * See {@link TaskDataChanges}
 * @param visible If this task view will be visible to the user in overview or hidden
 */
public void onTaskListVisibilityChanged(boolean visible, @TaskDataChanges int changes) {
    if (mTask == null) {
        return;
    }
    cancelPendingLoadTasks();
    if (visible) {
        // These calls are no-ops if the data is already loaded, try and load the high
        // resolution thumbnail if the state permits
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mThumbnailLoadRequest = thumbnailCache.updateThumbnailInBackground(mTask, thumbnail -> {
                mSnapshotView.setThumbnail(mTask, thumbnail);
            });
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            mIconLoadRequest = iconCache.updateIconInBackground(mTask, (task) -> {
                setIcon(mIconView, task.icon);
                mDigitalWellBeingToast.initialize(mTask);
            });
        }
    } else {
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mSnapshotView.setThumbnail(null, null);
            // Reset the task thumbnail reference as well (it will be fetched from the cache or
            // reloaded next time we need it)
            mTask.thumbnail = null;
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            setIcon(mIconView, null);
        }
    }
}
Also used : Rect(android.graphics.Rect) Task(com.android.systemui.shared.recents.model.Task) Arrays(java.util.Arrays) Bundle(android.os.Bundle) Utilities.getDescendantCoordRelativeToAncestor(com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor) NonNull(androidx.annotation.NonNull) TestProtocol(com.android.launcher3.testing.TestProtocol) FrameLayout(android.widget.FrameLayout) Animator(android.animation.Animator) LauncherSettings(com.android.launcher3.LauncherSettings) SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) Drawable(android.graphics.drawable.Drawable) TouchDelegate(android.view.TouchDelegate) FloatProperty(android.util.FloatProperty) ActivityOptions(android.app.ActivityOptions) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) Interpolators(com.android.launcher3.anim.Interpolators) TaskViewUtils(com.android.quickstep.TaskViewUtils) STAGE_POSITION_BOTTOM_OR_RIGHT(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) MAIN_EXECUTOR(com.android.launcher3.util.Executors.MAIN_EXECUTOR) View(android.view.View) TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) Log(android.util.Log) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) Interpolator(android.view.animation.Interpolator) ObjectAnimator(android.animation.ObjectAnimator) LAUNCHER_TASK_LAUNCH_TAP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP) TaskUtils(com.android.quickstep.TaskUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) DeviceProfile(com.android.launcher3.DeviceProfile) Outline(android.graphics.Outline) List(java.util.List) Nullable(androidx.annotation.Nullable) Stream(java.util.stream.Stream) CancellableTask(com.android.quickstep.util.CancellableTask) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) IdRes(android.annotation.IdRes) RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) TYPE_TASK_MENU(com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU) ACCEL_DEACCEL(com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) SplitConfigurationOptions(com.android.launcher3.util.SplitConfigurationOptions) ViewOutlineProvider(android.view.ViewOutlineProvider) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) Intent(android.content.Intent) HashMap(java.util.HashMap) SystemUiProxy(com.android.quickstep.SystemUiProxy) IntDef(androidx.annotation.IntDef) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) Retention(java.lang.annotation.Retention) Utilities.comp(com.android.launcher3.Utilities.comp) TransformParams(com.android.quickstep.util.TransformParams) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) STAGE_POSITION_UNDEFINED(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED) Toast(android.widget.Toast) AnimatorSet(android.animation.AnimatorSet) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) SystemShortcut(com.android.launcher3.popup.SystemShortcut) TaskCornerRadius(com.android.quickstep.util.TaskCornerRadius) Reusable(com.android.launcher3.util.ViewPool.Reusable) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) TaskIconCache(com.android.quickstep.TaskIconCache) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) OVERVIEW_SPLIT_SELECT(com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT) PreviewPositionHelper(com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper) R(com.android.launcher3.R) TestLogging(com.android.launcher3.testing.TestLogging) RecentsModel(com.android.quickstep.RecentsModel) ComponentKey(com.android.launcher3.util.ComponentKey) SOURCE(java.lang.annotation.RetentionPolicy.SOURCE) LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RunnableList(com.android.launcher3.util.RunnableList) Collections(java.util.Collections) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Example 9 with RecentsModel

use of com.android.quickstep.RecentsModel in project android_packages_apps_404Launcher by P-404.

the class GroupedTaskView method onTaskListVisibilityChanged.

@Override
public void onTaskListVisibilityChanged(boolean visible, int changes) {
    super.onTaskListVisibilityChanged(visible, changes);
    if (visible) {
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mThumbnailLoadRequest2 = thumbnailCache.updateThumbnailInBackground(mSecondaryTask, thumbnailData -> mSnapshotView2.setThumbnail(mSecondaryTask, thumbnailData));
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            mIconLoadRequest2 = iconCache.updateIconInBackground(mSecondaryTask, (task) -> {
                setIcon(mIconView2, task.icon);
                mDigitalWellBeingToast2.initialize(mSecondaryTask);
                mDigitalWellBeingToast2.setSplitConfiguration(mSplitBoundsConfig);
                mDigitalWellBeingToast.setSplitConfiguration(mSplitBoundsConfig);
            });
        }
    } else {
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mSnapshotView2.setThumbnail(null, null);
            // Reset the task thumbnail reference as well (it will be fetched from the cache or
            // reloaded next time we need it)
            mSecondaryTask.thumbnail = null;
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            setIcon(mIconView2, null);
        }
    }
}
Also used : DEFAULT_SPLIT_RATIO(com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO) Context(android.content.Context) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) StagedSplitBounds(com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds) Task(com.android.systemui.shared.recents.model.Task) NonNull(androidx.annotation.NonNull) TaskIconCache(com.android.quickstep.TaskIconCache) HashMap(java.util.HashMap) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) STAGE_POSITION_TOP_OR_LEFT(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) DeviceProfile(com.android.launcher3.DeviceProfile) Consumer(java.util.function.Consumer) Nullable(androidx.annotation.Nullable) AttributeSet(android.util.AttributeSet) CancellableTask(com.android.quickstep.util.CancellableTask) R(com.android.launcher3.R) RecentsModel(com.android.quickstep.RecentsModel) MotionEvent(android.view.MotionEvent) STAGE_POSITION_BOTTOM_OR_RIGHT(com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) RunnableList(com.android.launcher3.util.RunnableList) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Example 10 with RecentsModel

use of com.android.quickstep.RecentsModel in project Neo-Launcher by NeoApplications.

the class TaskView method onTaskListVisibilityChanged.

public void onTaskListVisibilityChanged(boolean visible) {
    if (mTask == null) {
        return;
    }
    cancelPendingLoadTasks();
    if (visible) {
        // These calls are no-ops if the data is already loaded, try and load the high
        // resolution thumbnail if the state permits
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        mThumbnailLoadRequest = thumbnailCache.updateThumbnailInBackground(mTask, thumbnail -> mSnapshotView.setThumbnail(mTask, thumbnail));
        mIconLoadRequest = iconCache.updateIconInBackground(mTask, (task) -> {
            setIcon(task.icon);
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask()) {
                getRecentsView().updateLiveTileIcon(task.icon);
            }
            mDigitalWellBeingToast.initialize(mTask);
        });
    } else {
        mSnapshotView.setThumbnail(null, null);
        setIcon(null);
        // Reset the task thumbnail reference as well (it will be fetched from the cache or
        // reloaded next time we need it)
        mTask.thumbnail = null;
    }
}
Also used : Rect(android.graphics.Rect) Task(com.android.systemui.shared.recents.model.Task) Bundle(android.os.Bundle) FrameLayout(android.widget.FrameLayout) Animator(android.animation.Animator) Drawable(android.graphics.drawable.Drawable) FloatProperty(android.util.FloatProperty) ActivityOptions(android.app.ActivityOptions) AttributeSet(android.util.AttributeSet) TaskSystemShortcut(com.android.quickstep.TaskSystemShortcut) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) Interpolators(com.android.launcher3.anim.Interpolators) ScrollState(com.android.quickstep.views.RecentsView.ScrollState) Handler(android.os.Handler) View(android.view.View) PendingAnimation(com.android.launcher3.util.PendingAnimation) Log(android.util.Log) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) ObjectAnimator(android.animation.ObjectAnimator) TaskUtils(com.android.quickstep.TaskUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Outline(android.graphics.Outline) List(java.util.List) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) PageCallbacks(com.android.quickstep.views.RecentsView.PageCallbacks) TimeInterpolator(android.animation.TimeInterpolator) Touch(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch) ViewOutlineProvider(android.view.ViewOutlineProvider) UserEventDispatcher(com.android.launcher3.logging.UserEventDispatcher) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) Toast(android.widget.Toast) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) RECENTS_LAUNCH_DURATION(com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION) TaskCornerRadius(com.android.quickstep.util.TaskCornerRadius) Reusable(com.android.launcher3.util.ViewPool.Reusable) TaskIconCache(com.android.quickstep.TaskIconCache) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) Direction(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction) Consumer(java.util.function.Consumer) Gravity(android.view.Gravity) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) R(com.android.launcher3.R) RecentsModel(com.android.quickstep.RecentsModel) Collections(java.util.Collections) ValueAnimator(android.animation.ValueAnimator) Resources(android.content.res.Resources) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Aggregations

Context (android.content.Context)11 AttributeSet (android.util.AttributeSet)11 R (com.android.launcher3.R)11 RecentsModel (com.android.quickstep.RecentsModel)11 TaskIconCache (com.android.quickstep.TaskIconCache)11 TaskThumbnailCache (com.android.quickstep.TaskThumbnailCache)11 Task (com.android.systemui.shared.recents.model.Task)11 Consumer (java.util.function.Consumer)11 MotionEvent (android.view.MotionEvent)10 DeviceProfile (com.android.launcher3.DeviceProfile)10 TransformingTouchDelegate (com.android.launcher3.util.TransformingTouchDelegate)10 RecentsOrientedState (com.android.quickstep.util.RecentsOrientedState)10 NonNull (androidx.annotation.NonNull)9 RunnableList (com.android.launcher3.util.RunnableList)9 CancellableTask (com.android.quickstep.util.CancellableTask)9 Nullable (androidx.annotation.Nullable)8 Animator (android.animation.Animator)7 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)7 ObjectAnimator (android.animation.ObjectAnimator)7 ActivityOptions (android.app.ActivityOptions)7