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

Commit 29b8dcf8 authored by Jamie Garside's avatar Jamie Garside Committed by Automerger Merge Worker
Browse files

Merge "Slide in volume rocker in natural rotation only." into sc-v2-dev am: 44dc1633

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

Change-Id: I6f72b7e0d6e4f816506542e932e315fd840a6804
parents 79acc216 44dc1633
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ import android.widget.Toast;
import androidx.annotation.Nullable;

import com.android.internal.graphics.drawable.BackgroundBlurDrawable;
import com.android.internal.view.RotationPolicy;
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.Prefs;
@@ -400,7 +401,9 @@ public class VolumeDialogImpl implements VolumeDialog,
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setOnShowListener(dialog -> {
            mDialogView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
            if (!isLandscape()) mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
            if (!shouldSlideInVolumeTray()) {
                mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
            }
            mDialogView.setAlpha(0);
            mDialogView.animate()
                    .alpha(1)
@@ -587,6 +590,10 @@ public class VolumeDialogImpl implements VolumeDialog,
        return (int) (alpha * 255);
    }

    private boolean shouldSlideInVolumeTray() {
        return mContext.getDisplay().getRotation() != RotationPolicy.NATURAL_ROTATION;
    }

    private boolean isLandscape() {
        return mContext.getResources().getConfiguration().orientation ==
                Configuration.ORIENTATION_LANDSCAPE;
@@ -1315,7 +1322,7 @@ public class VolumeDialogImpl implements VolumeDialog,

                    hideRingerDrawer();
                }, 50));
        if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2.0f);
        if (!shouldSlideInVolumeTray()) animator.translationX(mDialogView.getWidth() / 2.0f);
        animator.start();
        checkODICaptionsTooltip(true);
        mController.notifyVisible(false);