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

Commit a8e47322 authored by Anton Potapov's avatar Anton Potapov
Browse files

Make Volume Dialog slide espite current screen orientation

This CL also fixes positions for the floating sliders in RTL layout.
We always want the dialog to be on the right side of the screen next to
the volume buttons despite the layout direction.

Flag: com.android.systemui.volume_redesign
Fixes: 267682354
Test: manual on foldable
Change-Id: I58eceac32c020fbe64409786eb77780d4b27c136
parent 78aa5160
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
    android:id="@+id/volume_dialog"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="end"
    android:layout_gravity="right"
    android:alpha="0"
    android:clipChildren="false"
    android:minWidth="@dimen/volume_dialog_window_width">
@@ -60,7 +60,7 @@
        android:layout_marginEnd="@dimen/volume_dialog_window_margin"
        android:layout_marginBottom="@dimen/volume_dialog_slider_vertical_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintHeight_max="@dimen/volume_dialog_slider_height"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.5" />
@@ -96,7 +96,7 @@
        android:orientation="horizontal"
        android:showDividers="middle|beginning|end"
        app:layout_constraintBottom_toBottomOf="@id/volume_dialog_main_slider_container"
        app:layout_constraintEnd_toStartOf="@id/volume_dialog_background"
        app:layout_constraintRight_toLeftOf="@id/volume_dialog_background"
        app:layout_constraintTop_toTopOf="@id/volume_dialog_main_slider_container" />

</androidx.constraintlayout.widget.ConstraintLayout>
+1 −11
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import androidx.dynamicanimation.animation.SpringAnimation
import androidx.dynamicanimation.animation.SpringForce
import com.android.app.tracing.coroutines.launchInTraced
import com.android.app.tracing.coroutines.launchTraced
import com.android.internal.view.RotationPolicy
import com.android.systemui.common.ui.view.onApplyWindowInsets
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.res.R
@@ -189,16 +188,7 @@ constructor(
     */
    private fun View.applyAnimationProgress(fraction: Float) {
        alpha = ceil(fraction)
        if (display.rotation == RotationPolicy.NATURAL_ROTATION) {
                if (isLayoutRtl) {
                    -1
                } else {
                    1
                } * width / 2f
            } else {
                null
            }
            ?.let { maxTranslationX -> translationX = lerp(maxTranslationX, 0f, fraction) }
        translationX = lerp(width, 0, fraction).toFloat()
    }

    private suspend fun ViewTreeObserver.listenToComputeInternalInsets() =