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

Commit 25ff1cd4 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Volume layout updates

- Add shadow
- make the sliders to LTR  in landscape
- make all sliders horizontal in landscape
- stack volume rows in landscape

Test: manual
Bug: 63096355
Change-Id: I5452aa3b962727982d5fc103313518e9cbf2750e
Fixes: 72303358
Fixes: 72260231
Fixes: 72260096
parent c8d6489c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
            android:paddingTop="12dp"
            android:paddingBottom="12dp"
            android:background="@drawable/rounded_bg_full"
            android:translationZ="8dp"
            android:orientation="horizontal" >
                <!-- volume rows added and removed here! :-) -->
        </LinearLayout>
@@ -57,6 +58,7 @@
            android:background="@drawable/rounded_bg_full"
            android:gravity="center"
            android:layout_gravity="end"
            android:translationZ="8dp"
            android:orientation="vertical" >

            <TextView
+18 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -127,17 +128,26 @@ public class VolumeUiLayout extends FrameLayout {
        rotate(mChild, from, to, true);
        ViewGroup rows = mChild.findViewById(R.id.volume_dialog_rows);
        rotate(rows, from, to, true);
        swapOrientation((LinearLayout) rows);
        int rowCount = rows.getChildCount();
        for (int i = 0; i < rowCount; i++) {
            View child = rows.getChildAt(i);
            View row = rows.getChildAt(i);
            if (to == ROTATION_SEASCAPE) {
                rotateSeekBars(to, 0);
                rotateSeekBars(row, to, 180);
            } else if (to == ROTATION_LANDSCAPE) {
                rotateSeekBars(to, 180);
                rotateSeekBars(row, to, 0);
            } else {
                rotateSeekBars(to, 270);
                rotateSeekBars(row, to, 270);
            }
            rotate(child, from, to, true);
            rotate(row, from, to, true);
        }
    }

    private void swapOrientation(LinearLayout layout) {
        if(layout.getOrientation() == LinearLayout.HORIZONTAL) {
            layout.setOrientation(LinearLayout.VERTICAL);
        } else {
            layout.setOrientation(LinearLayout.HORIZONTAL);
        }
    }

@@ -152,13 +162,13 @@ public class VolumeUiLayout extends FrameLayout {
        v.setLayoutParams(params);
    }

    private void rotateSeekBars(int to, int rotation) {
        SeekBar seekbar = mChild.findViewById(R.id.volume_row_slider);
    private void rotateSeekBars(View row, int to, int rotation) {
        SeekBar seekbar = row.findViewById(R.id.volume_row_slider);
        if (seekbar != null) {
            seekbar.setRotation((float) rotation);
        }

        View parent = mChild.findViewById(R.id.volume_row_slider_frame);
        View parent = row.findViewById(R.id.volume_row_slider_frame);
        swapDimens(parent);
        ViewGroup.LayoutParams params = seekbar.getLayoutParams();
        ViewGroup.LayoutParams parentParams = parent.getLayoutParams();