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

Commit c2e36510 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add fade through threshould to the transition" into sc-dev am: 2e26a6da

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14292686

Change-Id: If315806b6c0d017ddc0b34e6044c7420f716be45
parents 02287177 2e26a6da
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.animation.Interpolator;

import androidx.core.os.BuildCompat;

import com.google.android.material.transition.platform.FadeThroughProvider;
import com.google.android.material.transition.platform.MaterialSharedAxis;
import com.google.android.material.transition.platform.SlideDistanceProvider;

@@ -35,6 +36,7 @@ public class SettingsTransitionHelper {

    private static final String TAG = "SettingsTransitionHelper";
    private static final long DURATION = 450L;
    private static final float FADE_THROUGH_THRESHOLD = 0.22F;

    private static MaterialSharedAxis createSettingsSharedAxis(Context context, boolean forward) {
        final MaterialSharedAxis transition = new MaterialSharedAxis(MaterialSharedAxis.X, forward);
@@ -48,12 +50,14 @@ public class SettingsTransitionHelper {
        forwardDistanceProvider.setSlideDistance(distance);
        transition.setDuration(DURATION);

        final FadeThroughProvider fadeThroughProvider =
                (FadeThroughProvider) transition.getSecondaryAnimatorProvider();
        fadeThroughProvider.setProgressThreshold(FADE_THROUGH_THRESHOLD);

        final Interpolator interpolator =
                AnimationUtils.loadInterpolator(context, R.interpolator.fast_out_extra_slow_in);
        transition.setInterpolator(interpolator);

        // TODO(b/177480673): Update fade through threshold once (cl/362065364) is released

        return transition;
    }