use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_Launcher3 by ArrowOS.
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;
}
use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_Launcher3 by ArrowOS.
the class LauncherModelHelper method loadModelSync.
/**
* Loads the model in memory synchronously
*/
public void loadModelSync() throws ExecutionException, InterruptedException {
Callbacks mockCb = new Callbacks() {
};
Executors.MAIN_EXECUTOR.submit(() -> getModel().addCallbacksAndLoad(mockCb)).get();
Executors.MODEL_EXECUTOR.submit(() -> {
}).get();
Executors.MAIN_EXECUTOR.submit(() -> {
}).get();
Executors.MAIN_EXECUTOR.submit(() -> getModel().removeCallbacks(mockCb)).get();
}
use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_Launcher3 by ArrowOS.
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();
}
use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_Launcher3 by ProtonAOSP.
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;
}
use of com.android.launcher3.model.BgDataModel.Callbacks in project android_packages_apps_Launcher3 by ProtonAOSP.
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;
}
Aggregations