use of com.android.quickstep.util.AppCloseConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherSwipeHandlerV2 method createIconHomeAnimationFactory.
private HomeAnimationFactory createIconHomeAnimationFactory(View workspaceView) {
final ResourceProvider rp = DynamicResource.provider(mActivity);
final float transY = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp));
RectF iconLocation = new RectF();
FloatingIconView floatingIconView = getFloatingIconView(mActivity, workspaceView, true, /* hideOriginal */
iconLocation, false);
// We want the window alpha to be 0 once this threshold is met, so that the
// FolderIconView can be seen morphing into the icon shape.
float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
return new FloatingViewHomeAnimationFactory(floatingIconView) {
// There is a delay in loading the icon, so we need to keep the window
// opaque until it is ready.
private boolean mIsFloatingIconReady = false;
@Override
public RectF getWindowTargetRect() {
super.getWindowTargetRect();
return iconLocation;
}
@Override
public void setAnimation(RectFSpringAnim anim) {
super.setAnimation(anim);
anim.addAnimatorListener(floatingIconView);
floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged);
floatingIconView.setFastFinishRunnable(anim::end);
}
@Override
public boolean keepWindowOpaque() {
if (mIsFloatingIconReady || floatingIconView.isVisibleToUser()) {
mIsFloatingIconReady = true;
return false;
}
return true;
}
@Override
public void update(@Nullable AppCloseConfig config, RectF currentRect, float progress, float radius) {
super.update(config, currentRect, progress, radius);
int fgAlpha = 255;
if (config != null && PROTOTYPE_APP_CLOSE.get()) {
progress = config.getInterpolatedProgress();
fgAlpha = config.getFgAlpha();
}
floatingIconView.update(1f, fgAlpha, currentRect, progress, windowAlphaThreshold, radius, false);
}
};
}
use of com.android.quickstep.util.AppCloseConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherSwipeHandlerV2 method createWidgetHomeAnimationFactory.
private HomeAnimationFactory createWidgetHomeAnimationFactory(LauncherAppWidgetHostView hostView, boolean isTargetTranslucent, RemoteAnimationTargetCompat runningTaskTarget) {
final float floatingWidgetAlpha = isTargetTranslucent ? 0 : 1;
RectF backgroundLocation = new RectF();
Rect crop = new Rect();
mTaskViewSimulator.getCurrentCropRect().roundOut(crop);
Size windowSize = new Size(crop.width(), crop.height());
int fallbackBackgroundColor = FloatingWidgetView.getDefaultBackgroundColor(mContext, runningTaskTarget);
FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, hostView, backgroundLocation, windowSize, mTaskViewSimulator.getCurrentCornerRadius(), isTargetTranslucent, fallbackBackgroundColor);
return new FloatingViewHomeAnimationFactory(floatingWidgetView) {
@Override
@Nullable
protected View getViewIgnoredInWorkspaceRevealAnimation() {
return hostView;
}
@Override
public RectF getWindowTargetRect() {
super.getWindowTargetRect();
return backgroundLocation;
}
@Override
public float getEndRadius(RectF cropRectF) {
return floatingWidgetView.getInitialCornerRadius();
}
@Override
public void setAnimation(RectFSpringAnim anim) {
super.setAnimation(anim);
anim.addAnimatorListener(floatingWidgetView);
floatingWidgetView.setOnTargetChangeListener(anim::onTargetPositionChanged);
floatingWidgetView.setFastFinishRunnable(anim::end);
}
@Override
public boolean keepWindowOpaque() {
return false;
}
@Override
public void update(@Nullable AppCloseConfig config, RectF currentRect, float progress, float radius) {
super.update(config, currentRect, progress, radius);
final float fallbackBackgroundAlpha = 1 - mapBoundToRange(progress, 0.8f, 1, 0, 1, EXAGGERATED_EASE);
final float foregroundAlpha = mapBoundToRange(progress, 0.5f, 1, 0, 1, EXAGGERATED_EASE);
floatingWidgetView.update(currentRect, floatingWidgetAlpha, foregroundAlpha, fallbackBackgroundAlpha, 1 - progress);
}
@Override
protected float getWindowAlpha(float progress) {
return 1 - mapBoundToRange(progress, 0, 0.5f, 0, 1, LINEAR);
}
};
}
Aggregations