Search in sources :

Example 6 with ResourceProvider

use of com.android.systemui.plugins.ResourceProvider in project android_packages_apps_Launcher3 by crdroidandroid.

the class StaggeredWorkspaceAnim method addStaggeredAnimationForView.

/**
 * Adds an alpha/trans animator for {@param v}, with a start delay based on the view's row.
 *
 * @param v A view on the workspace.
 * @param row The bottom-most row that contains the view.
 * @param totalRows Total number of rows.
 */
private void addStaggeredAnimationForView(View v, int row, int totalRows) {
    if (mIgnoredView != null && mIgnoredView == v)
        return;
    // Invert the rows, because we stagger starting from the bottom of the screen.
    int invertedRow = totalRows - row;
    // Add 1 to the inverted row so that the bottom most row has a start delay.
    long startDelay = (long) ((invertedRow + 1) * APP_CLOSE_ROW_START_DELAY_MS);
    v.setTranslationY(mSpringTransY);
    ResourceProvider rp = DynamicResource.provider(v.getContext());
    float stiffness = rp.getFloat(R.dimen.staggered_stiffness);
    float damping = rp.getFloat(R.dimen.staggered_damping_ratio);
    float endTransY = 0;
    float springVelocity = Math.abs(mVelocity) * Math.signum(endTransY - mSpringTransY);
    ValueAnimator springTransY = new SpringAnimationBuilder(v.getContext()).setStiffness(stiffness).setDampingRatio(damping).setMinimumVisibleChange(1f).setStartValue(mSpringTransY).setEndValue(endTransY).setStartVelocity(springVelocity).build(v, VIEW_TRANSLATE_Y);
    springTransY.setStartDelay(startDelay);
    springTransY.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            v.setTranslationY(0f);
        }
    });
    mAnimators.play(springTransY);
    v.setAlpha(0);
    ObjectAnimator alpha = ObjectAnimator.ofFloat(v, View.ALPHA, 0f, 1f);
    alpha.setInterpolator(LINEAR);
    alpha.setDuration(ALPHA_DURATION_MS);
    alpha.setStartDelay(startDelay);
    alpha.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            v.setAlpha(1f);
        }
    });
    mAnimators.play(alpha);
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ObjectAnimator(android.animation.ObjectAnimator) ResourceProvider(com.android.systemui.plugins.ResourceProvider) SpringAnimationBuilder(com.android.launcher3.anim.SpringAnimationBuilder) ValueAnimator(android.animation.ValueAnimator)

Example 7 with ResourceProvider

use of com.android.systemui.plugins.ResourceProvider in project android_packages_apps_Launcher3 by crdroidandroid.

the class RectFSpringAnim2 method getAppCloseInterpolator.

private Interpolator getAppCloseInterpolator(Context context) {
    ResourceProvider rp = DynamicResource.provider(context);
    String path = String.format(Locale.ENGLISH, "M 0,0 C %f, %f, %f, %f, %f, %f C %f, %f, %f, %f, 1, 1", rp.getFloat(R.dimen.c1_a), rp.getFloat(R.dimen.c1_b), rp.getFloat(R.dimen.c1_c), rp.getFloat(R.dimen.c1_d), rp.getFloat(R.dimen.mp_x), rp.getFloat(R.dimen.mp_y), rp.getFloat(R.dimen.c2_a), rp.getFloat(R.dimen.c2_b), rp.getFloat(R.dimen.c2_c), rp.getFloat(R.dimen.c2_d));
    return PathInterpolatorCompat.create(PathParser.createPathFromPathData(path));
}
Also used : ResourceProvider(com.android.systemui.plugins.ResourceProvider)

Example 8 with ResourceProvider

use of com.android.systemui.plugins.ResourceProvider in project android_packages_apps_Launcher3 by crdroidandroid.

the class DynamicResource method provider.

/**
 * Returns the currently active or default provider
 */
public static ResourceProvider provider(Context context) {
    DynamicResource dr = DynamicResource.INSTANCE.get(context);
    ResourceProvider plugin = dr.mPlugin;
    return plugin == null ? dr : plugin;
}
Also used : ResourceProvider(com.android.systemui.plugins.ResourceProvider)

Aggregations

ResourceProvider (com.android.systemui.plugins.ResourceProvider)8 Animator (android.animation.Animator)3 ObjectAnimator (android.animation.ObjectAnimator)2 ValueAnimator (android.animation.ValueAnimator)2 Point (android.graphics.Point)2 RectF (android.graphics.RectF)2 TextPaint (android.text.TextPaint)2 Nullable (androidx.annotation.Nullable)2 SpringAnimationBuilder (com.android.launcher3.anim.SpringAnimationBuilder)2 SpringProperty (com.android.launcher3.anim.SpringProperty)2 SplitSelectStateController (com.android.quickstep.util.SplitSelectStateController)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 Context (android.content.Context)1 PointF (android.graphics.PointF)1 Rect (android.graphics.Rect)1 FloatProperty (android.util.FloatProperty)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 OnAnimationEndListener (androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener)1