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

Commit fd58eabd authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Update layout for displays with small height." into main

parents 834d336d 5b103bac
Loading
Loading
Loading
Loading
+42 −21
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
                android:layout_height="20dp"
                android:layout_marginBottom="7dp"
                android:gravity="center_vertical"
                android:visibility="gone"
                android:importantForAccessibility="no"/>
            <TextView
                android:id="@+id/header_title"
@@ -74,10 +75,28 @@
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/app_source_icon_small_screen_height"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:visibility="gone"
            android:layout_marginHorizontal="@dimen/media_output_dialog_margin_horizontal"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="16dp"
            android:importantForAccessibility="no"/>

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/quick_access_shelf"
                android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal"
        android:layout_width="match_parent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone">

@@ -101,6 +120,8 @@
                    android:text="@string/media_output_dialog_button_connect_device"
                    android:layout_marginBottom="8dp"/>
            </LinearLayout>
        </HorizontalScrollView>
    </LinearLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/device_list"
+23 −12
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog
        implements MediaSwitchingController.Callback, Window.Callback {

    private static final String TAG = "MediaOutputDialog";
    public static final int SMALL_SCREEN_HEIGHT_DP = 400;

    protected final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());
    private final LinearLayoutManager mLayoutManager;
@@ -168,7 +169,14 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog
        mDeviceListLayout = mDialogView.requireViewById(R.id.device_list);
        mDoneButton = mDialogView.requireViewById(R.id.done);
        mStopButton = mDialogView.requireViewById(R.id.stop);
        mAppResourceIcon = mDialogView.requireViewById(R.id.app_source_icon);

        boolean isSmallScreenHeight =
                mContext.getResources().getConfiguration().screenHeightDp <= SMALL_SCREEN_HEIGHT_DP;
        mAppResourceIcon = mDialogView.requireViewById(
                isSmallScreenHeight ? R.id.app_source_icon_small_screen_height
                        : R.id.app_source_icon);
        mAppResourceIcon.setVisibility(View.VISIBLE);
        mMediaMetadataSectionLayout.setVisibility(isSmallScreenHeight ? View.GONE : View.VISIBLE);

        // Init device list
        mLayoutManager.setAutoMeasureEnabled(true);
@@ -187,6 +195,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog
        mDismissing = false;

        if (enableOutputSwitcherRedesign()) {
            // TODO(b/444172986): set these properties in the layout file.
            // Reduce radius of dialog background.
            mDialogView.setBackground(AppCompatResources.getDrawable(mContext,
                    R.drawable.media_output_dialog_background_reduced_radius));
@@ -202,6 +211,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog
                    .setTypeface(Typeface.create(GSF_TITLE_MEDIUM_EMPHASIZED, Typeface.NORMAL));
            mHeaderSubtitle
                    .setTypeface(Typeface.create(GSF_TITLE_SMALL, Typeface.NORMAL));
            if (!isSmallScreenHeight) {
                // Reduce the size of the app icon.
                float appIconSize = mContext.getResources().getDimension(
                        R.dimen.media_output_dialog_app_icon_size);
@@ -213,6 +223,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog
                params.width = (int) appIconSize;
                params.height = (int) appIconSize;
                mAppResourceIcon.setLayoutParams(params);
            }
            // Change footer background color on scroll.
            mDevicesRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                @Override