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

Commit ded54efd authored by Jacqueline Bronger's avatar Jacqueline Bronger Committed by Android (Google) Code Review
Browse files

Merge "Position TV volume UI based on layout orientation."

parents 80cb333f 3e7fa49c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -18,8 +18,9 @@
    <!-- The position of the volume dialog on the screen.
         See com.android.systemui.volume.VolumeDialogImpl.
         Value 81 corresponds to BOTTOM|CENTER_HORIZONTAL.
         Value 21 corresponds to RIGHT|CENTER_VERTICAL. -->
    <integer name="volume_dialog_gravity">21</integer>
         Value 21 corresponds to RIGHT|CENTER_VERTICAL.
         Value 8388629 corresponds to END|CENTER_VERTICAL -->
    <integer name="volume_dialog_gravity">8388629</integer>

    <integer name="privacy_chip_animation_millis">300</integer>
</resources>
+18 −3
Original line number Diff line number Diff line
@@ -288,6 +288,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,

    private boolean mSeparateNotification;

    private int mWindowGravity;

    @VisibleForTesting
    int mVolumeRingerIconDrawableId;
    @VisibleForTesting
@@ -514,7 +516,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        lp.format = PixelFormat.TRANSLUCENT;
        lp.setTitle(VolumeDialogImpl.class.getSimpleName());
        lp.windowAnimations = -1;
        lp.gravity = mContext.getResources().getInteger(R.integer.volume_dialog_gravity);

        mWindowGravity = Gravity.getAbsoluteGravity(
                mContext.getResources().getInteger(R.integer.volume_dialog_gravity),
                mContext.getResources().getConfiguration().getLayoutDirection());
        lp.gravity = mWindowGravity;

        mWindow.setAttributes(lp);
        mWindow.setLayout(WRAP_CONTENT, WRAP_CONTENT);

@@ -525,7 +532,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        mDialog.setOnShowListener(dialog -> {
            mDialogView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
            if (!shouldSlideInVolumeTray()) {
                mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
                mDialogView.setTranslationX(
                        (isWindowGravityLeft() ? -1 : 1) * mDialogView.getWidth() / 2.0f);
            }
            mDialogView.setAlpha(0);
            mDialogView.animate()
@@ -696,6 +704,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        initODICaptionsH();
    }

    private boolean isWindowGravityLeft() {
        return (mWindowGravity & Gravity.LEFT) == Gravity.LEFT;
    }

    private void initDimens() {
        mDialogWidth = mContext.getResources().getDimensionPixelSize(
                R.dimen.volume_dialog_panel_width);
@@ -1495,7 +1507,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,

                    hideRingerDrawer();
                }, 50));
        if (!shouldSlideInVolumeTray()) animator.translationX(mDialogView.getWidth() / 2.0f);
        if (!shouldSlideInVolumeTray()) {
            animator.translationX(
                    (isWindowGravityLeft() ? -1 : 1) * mDialogView.getWidth() / 2.0f);
        }
        animator.setListener(getJankListener(getDialogView(), TYPE_DISMISS,
                mDialogHideAnimationDurationMs)).start();
        checkODICaptionsTooltip(true);