Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 544dff52 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Switch ScrimView to use view alpha" into udc-qpr-dev

parents 9c9764c2 99c4becf
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.launcher3.uioverrides.touchcontrollers;
package com.android.launcher3.uioverrides.touchcontrollers;


import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;


import static com.android.app.animation.Interpolators.ACCELERATE_0_75;
import static com.android.app.animation.Interpolators.ACCELERATE_0_75;
import static com.android.app.animation.Interpolators.DECELERATE_3;
import static com.android.app.animation.Interpolators.DECELERATE_3;
@@ -262,7 +261,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
        xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
        // Use QuickSwitchState instead of OverviewState to determine scrim color,
        // Use QuickSwitchState instead of OverviewState to determine scrim color,
        // since we need to take potential taskbar into account.
        // since we need to take potential taskbar into account.
        xAnim.setViewBackgroundColor(mLauncher.getScrimView(),
        xAnim.setScrimViewBackgroundColor(mLauncher.getScrimView(),
                QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher), LINEAR);
                QUICK_SWITCH_FROM_HOME.getWorkspaceScrimColor(mLauncher), LINEAR);
        if (mRecentsView.getTaskViewCount() == 0) {
        if (mRecentsView.getTaskViewCount() == 0) {
            xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR);
            xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR);
+1 −1
Original line number Original line Diff line number Diff line
@@ -114,7 +114,7 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
        setter.setFloat(mRecentsView, TASK_THUMBNAIL_SPLASH_ALPHA,
        setter.setFloat(mRecentsView, TASK_THUMBNAIL_SPLASH_ALPHA,
                state.showTaskThumbnailSplash() ? 1f : 0f, INSTANT);
                state.showTaskThumbnailSplash() ? 1f : 0f, INSTANT);


        setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
        setter.setScrimViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
                config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
                config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));


        RecentsState currentState = mActivity.getStateManager().getState();
        RecentsState currentState = mActivity.getStateManager().getState();
+5 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TextView;


import com.android.launcher3.util.MultiScalePropertyFactory;
import com.android.launcher3.util.MultiScalePropertyFactory;
import com.android.launcher3.views.ScrimView;


public class LauncherAnimUtils {
public class LauncherAnimUtils {
    /**
    /**
@@ -194,6 +195,10 @@ public class LauncherAnimUtils {


                @Override
                @Override
                public Integer get(View view) {
                public Integer get(View view) {
                    if (view instanceof ScrimView) {
                        return ((ScrimView) view).getBackgroundColor();
                    }

                    if (!(view.getBackground() instanceof ColorDrawable)) {
                    if (!(view.getBackground() instanceof ColorDrawable)) {
                        return Color.TRANSPARENT;
                        return Color.TRANSPARENT;
                    }
                    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -199,7 +199,7 @@ public class WorkspaceStateTransitionAnimation {
        propertySetter.setFloat(sysUiScrim.getSysUIProgress(), AnimatedFloat.VALUE,
        propertySetter.setFloat(sysUiScrim.getSysUIProgress(), AnimatedFloat.VALUE,
                state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
                state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);


        propertySetter.setViewBackgroundColor(mLauncher.getScrimView(),
        propertySetter.setScrimViewBackgroundColor(mLauncher.getScrimView(),
                state.getWorkspaceScrimColor(mLauncher),
                state.getWorkspaceScrimColor(mLauncher),
                config.getInterpolator(ANIM_SCRIM_FADE, ACCELERATE_2));
                config.getInterpolator(ANIM_SCRIM_FADE, ACCELERATE_2));
    }
    }
+5 −4
Original line number Original line Diff line number Diff line
@@ -24,13 +24,14 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.graphics.drawable.ColorDrawable;
import android.util.FloatProperty;
import android.util.FloatProperty;
import android.util.IntProperty;
import android.util.IntProperty;
import android.view.View;
import android.view.View;


import androidx.annotation.NonNull;
import androidx.annotation.NonNull;


import com.android.launcher3.views.ScrimView;

import java.util.function.Consumer;
import java.util.function.Consumer;


/**
/**
@@ -62,9 +63,9 @@ public class AnimatedPropertySetter extends PropertySetter {
    }
    }


    @Override
    @Override
    public Animator setViewBackgroundColor(View view, int color, TimeInterpolator interpolator) {
    public Animator setScrimViewBackgroundColor(ScrimView view, int color,
        if (view == null || (view.getBackground() instanceof ColorDrawable
            TimeInterpolator interpolator) {
                && ((ColorDrawable) view.getBackground()).getColor() == color)) {
        if (view == null || view.getBackgroundColor() == color) {
            return NO_OP;
            return NO_OP;
        }
        }
        ObjectAnimator anim = ObjectAnimator.ofArgb(view, VIEW_BACKGROUND_COLOR, color);
        ObjectAnimator anim = ObjectAnimator.ofArgb(view, VIEW_BACKGROUND_COLOR, color);
Loading