Search in sources :

Example 41 with Callbacks

use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_404Launcher by P-404.

the class LauncherModelHelper method executeTaskForTest.

/**
 * Synchronously executes the task and returns all the UI callbacks posted.
 */
public List<Runnable> executeTaskForTest(ModelUpdateTask task) throws Exception {
    LauncherModel model = getModel();
    if (!model.isModelLoaded()) {
        ReflectionHelpers.setField(model, "mModelLoaded", true);
    }
    Executor mockExecutor = mock(Executor.class);
    model.enqueueModelUpdateTask(new ModelUpdateTask() {

        @Override
        public void init(LauncherAppState app, LauncherModel model, BgDataModel dataModel, AllAppsList allAppsList, Executor uiExecutor) {
            task.init(app, model, dataModel, allAppsList, mockExecutor);
        }

        @Override
        public void run() {
            task.run();
        }
    });
    MODEL_EXECUTOR.submit(() -> null).get();
    ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
    verify(mockExecutor, atLeast(0)).execute(captor.capture());
    return captor.getAllValues();
}
Also used : LauncherModel(com.android.launcher3.LauncherModel) ModelUpdateTask(com.android.launcher3.LauncherModel.ModelUpdateTask) Executor(java.util.concurrent.Executor) LauncherAppState(com.android.launcher3.LauncherAppState) BgDataModel(com.android.launcher3.model.BgDataModel) AllAppsList(com.android.launcher3.model.AllAppsList)

Example 42 with Callbacks

use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_404Launcher by P-404.

the class GroupedTaskView method launchTaskAnimated.

@Nullable
@Override
public RunnableList launchTaskAnimated() {
    if (mTask == null || mSecondaryTask == null) {
        return null;
    }
    RunnableList endCallback = new RunnableList();
    RecentsView recentsView = getRecentsView();
    // Callbacks run from remote animation when recents animation not currently running
    recentsView.getSplitPlaceholder().launchTasks(this, /*groupedTaskView*/
    success -> endCallback.executeAllAndDestroy(), false);
    // Callbacks get run from recentsView for case when recents animation already running
    recentsView.addSideTaskLaunchCallback(endCallback);
    return endCallback;
}
Also used : RunnableList(com.android.launcher3.util.RunnableList) Nullable(androidx.annotation.Nullable)

Example 43 with Callbacks

use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_404Launcher by P-404.

the class TouchInteractionService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // Initialize anything here that is needed in direct boot mode.
    // Everything else should be initialized in onUserUnlocked() below.
    mMainChoreographer = Choreographer.getInstance();
    mAM = ActivityManagerWrapper.getInstance();
    mDeviceState = new RecentsAnimationDeviceState(this, true);
    mDisplayManager = getSystemService(DisplayManager.class);
    mTaskbarManager = new TaskbarManager(this);
    mRotationTouchHelper = mDeviceState.getRotationTouchHelper();
    // Call runOnUserUnlocked() before any other callbacks to ensure everything is initialized.
    mDeviceState.runOnUserUnlocked(this::onUserUnlocked);
    mDeviceState.runOnUserUnlocked(mTaskbarManager::onUserUnlocked);
    mDeviceState.addNavigationModeChangedCallback(this::onNavigationModeChanged);
    mDeviceState.addOneHandedModeChangedCallback(this::onOneHandedModeOverlayChanged);
    ProtoTracer.INSTANCE.get(this).add(this);
    LauncherSplitScreenListener.INSTANCE.get(this).init();
    sConnected = true;
}
Also used : DisplayManager(android.hardware.display.DisplayManager) TaskbarManager(com.android.launcher3.taskbar.TaskbarManager)

Example 44 with Callbacks

use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_404Launcher by P-404.

the class BaseActivityInterface method getParallelAnimationToLauncher.

/**
 * Called when the gesture ends and the animation starts towards the given target. Used to add
 * an optional additional animation with the same duration.
 */
@Nullable
public Animator getParallelAnimationToLauncher(GestureState.GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) {
    if (endTarget == RECENTS) {
        ACTIVITY_TYPE activity = getCreatedActivity();
        if (activity == null) {
            return null;
        }
        STATE_TYPE state = stateFromGestureEndTarget(endTarget);
        ScrimView scrimView = activity.getScrimView();
        ObjectAnimator anim = ObjectAnimator.ofArgb(scrimView, VIEW_BACKGROUND_COLOR, getOverviewScrimColorForState(activity, state));
        anim.setDuration(duration);
        return anim;
    }
    return null;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ScrimView(com.android.launcher3.views.ScrimView) Nullable(androidx.annotation.Nullable)

Example 45 with Callbacks

use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_404Launcher by P-404.

the class FallbackActivityInterface method getParallelAnimationToLauncher.

@Override
@Nullable
public Animator getParallelAnimationToLauncher(GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) {
    FallbackTaskbarUIController uiController = getTaskbarController();
    Animator superAnimator = super.getParallelAnimationToLauncher(endTarget, duration, callbacks);
    if (uiController == null) {
        return superAnimator;
    }
    RecentsState toState = stateFromGestureEndTarget(endTarget);
    Animator taskbarAnimator = uiController.createAnimToRecentsState(toState, duration);
    if (taskbarAnimator == null) {
        return superAnimator;
    }
    if (superAnimator == null) {
        return taskbarAnimator;
    }
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(superAnimator, taskbarAnimator);
    return animatorSet;
}
Also used : Animator(android.animation.Animator) FallbackTaskbarUIController(com.android.launcher3.taskbar.FallbackTaskbarUIController) RecentsState(com.android.quickstep.fallback.RecentsState) AnimatorSet(android.animation.AnimatorSet) Nullable(androidx.annotation.Nullable)

Aggregations

Callbacks (com.android.launcher3.model.BgDataModel.Callbacks)39 ArrayList (java.util.ArrayList)22 IntArray (com.android.launcher3.util.IntArray)21 ItemInfo (com.android.launcher3.model.data.ItemInfo)18 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)18 Nullable (androidx.annotation.Nullable)16 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)13 AppInfo (com.android.launcher3.model.data.AppInfo)11 CallbackTask (com.android.launcher3.LauncherModel.CallbackTask)9 Animator (android.animation.Animator)8 AnimatorSet (android.animation.AnimatorSet)8 Intent (android.content.Intent)7 ApplicationInfo (android.content.pm.ApplicationInfo)7 LauncherActivityInfo (android.content.pm.LauncherActivityInfo)7 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)7 PackageManager (android.content.pm.PackageManager)7 Rect (android.graphics.Rect)7 LauncherAppState (com.android.launcher3.LauncherAppState)7 LauncherModel (com.android.launcher3.LauncherModel)7 LoaderResults (com.android.launcher3.model.LoaderResults)7