use of com.android.systemui.shared.system.TransactionCompat in project Neo-Launcher by NeoApplications.
the class AppToOverviewAnimationProvider method createWindowAnimation.
/**
* Create remote window animation from the currently running app to the overview panel.
*
* @param targetCompats the target apps
* @return animation from app to overview
*/
@Override
public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targetCompats) {
if (mRecentsView != null) {
mRecentsView.setRunningTaskIconScaledDown(true);
}
AnimatorSet anim = new AnimatorSet();
anim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mHelper.onSwipeUpToRecentsComplete(mActivity);
if (mRecentsView != null) {
mRecentsView.animateUpRunningTaskIconScale();
}
}
});
if (mActivity == null) {
Log.e(TAG, "Animation created, before activity");
anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
return anim;
}
RemoteAnimationTargetSet targetSet = new RemoteAnimationTargetSet(targetCompats, MODE_CLOSING);
// Use the top closing app to determine the insets for the animation
RemoteAnimationTargetCompat runningTaskTarget = targetSet.findTask(mTargetTaskId);
if (runningTaskTarget == null) {
Log.e(TAG, "No closing app");
anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
return anim;
}
final ClipAnimationHelper clipHelper = new ClipAnimationHelper(mActivity);
// At this point, the activity is already started and laid-out. Get the home-bounds
// relative to the screen using the rootView of the activity.
int[] loc = new int[2];
View rootView = mActivity.getRootView();
rootView.getLocationOnScreen(loc);
Rect homeBounds = new Rect(loc[0], loc[1], loc[0] + rootView.getWidth(), loc[1] + rootView.getHeight());
clipHelper.updateSource(homeBounds, runningTaskTarget);
Rect targetRect = new Rect();
mHelper.getSwipeUpDestinationAndLength(mActivity.getDeviceProfile(), mActivity, targetRect);
clipHelper.updateTargetRect(targetRect);
clipHelper.prepareAnimation(mActivity.getDeviceProfile(), false);
ClipAnimationHelper.TransformParams params = new ClipAnimationHelper.TransformParams().setSyncTransactionApplier(new SyncRtSurfaceTransactionApplierCompat(rootView));
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
valueAnimator.setDuration(RECENTS_LAUNCH_DURATION);
valueAnimator.setInterpolator(TOUCH_RESPONSE_INTERPOLATOR);
valueAnimator.addUpdateListener((v) -> {
params.setProgress((float) v.getAnimatedValue());
clipHelper.applyTransform(targetSet, params);
});
if (targetSet.isAnimatingHome()) {
// If we are animating home, fade in the opening targets
RemoteAnimationTargetSet openingSet = new RemoteAnimationTargetSet(targetCompats, MODE_OPENING);
TransactionCompat transaction = new TransactionCompat();
valueAnimator.addUpdateListener((v) -> {
for (RemoteAnimationTargetCompat app : openingSet.apps) {
transaction.setAlpha(app.leash, (float) v.getAnimatedValue());
}
transaction.apply();
});
}
anim.play(valueAnimator);
return anim;
}
use of com.android.systemui.shared.system.TransactionCompat in project Neo-Launcher by NeoApplications.
the class ClipAnimationHelper method applySurfaceParams.
private void applySurfaceParams(@Nullable SyncRtSurfaceTransactionApplierCompat syncTransactionApplier, SurfaceParams[] params) {
if (syncTransactionApplier != null) {
syncTransactionApplier.scheduleApply(params);
} else {
TransactionCompat t = new TransactionCompat();
for (SurfaceParams param : params) {
SyncRtSurfaceTransactionApplierCompat.applyParams(t, param);
}
t.setEarlyWakeup();
t.apply();
}
}
use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Trebuchet by LineageOS.
the class DepthController method setDepth.
private void setDepth(float depth) {
depth = Utilities.boundToRange(depth, 0, 1);
// Round out the depth to dedupe frequent, non-perceptable updates
int depthI = (int) (depth * 256);
float depthF = depthI / 256f;
if (Float.compare(mDepth, depthF) == 0) {
return;
}
boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
return;
}
mDepth = depthF;
ensureDependencies();
IBinder windowToken = mLauncher.getRootView().getWindowToken();
if (windowToken != null) {
mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
}
if (supportsBlur) {
final int blur;
if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
// All apps has a solid background. We don't need to draw blurs after it's fully
// visible. This will take us out of GPU composition, saving battery and increasing
// performance.
blur = 0;
} else {
blur = (int) (mDepth * mMaxBlurRadius);
}
new TransactionCompat().setBackgroundBlurRadius(mSurface, blur).apply();
}
}
use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Trebuchet by LineageOS.
the class RemoteFadeOutAnimationListener method onAnimationUpdate.
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
TransactionCompat t = new TransactionCompat();
if (mFirstFrame) {
for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
t.show(target.leash);
}
mFirstFrame = false;
}
float alpha = 1 - valueAnimator.getAnimatedFraction();
for (RemoteAnimationTargetCompat app : mTarget.apps) {
t.setAlpha(app.leash, alpha);
}
t.apply();
}
use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Launcher3 by ArrowOS.
the class RemoteFadeOutAnimationListener method onAnimationUpdate.
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
TransactionCompat t = new TransactionCompat();
if (mFirstFrame) {
for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
t.show(target.leash);
}
mFirstFrame = false;
}
float alpha = 1 - valueAnimator.getAnimatedFraction();
for (RemoteAnimationTargetCompat app : mTarget.apps) {
t.setAlpha(app.leash, alpha);
}
t.apply();
}
Aggregations