fix item_media width
don't hardcode layout_width to 195dp, set layout_constraintWidth_max and image_poster layout_constraintWidth this fixes issues if the screen is not wide enough to show multiple item_media elements
This commit is contained in:
		@ -2,16 +2,16 @@
 | 
			
		||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
    android:layout_width="195dp"
 | 
			
		||||
    android:layout_width="wrap_content"
 | 
			
		||||
    android:layout_height="wrap_content"
 | 
			
		||||
    android:backgroundTint="?themeSecondary"
 | 
			
		||||
    android:visibility="visible"
 | 
			
		||||
    app:cardCornerRadius="7dp"
 | 
			
		||||
    app:cardElevation="4dp">
 | 
			
		||||
 | 
			
		||||
    <androidx.constraintlayout.widget.ConstraintLayout
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent">
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        app:layout_constraintWidth_max="195dp">
 | 
			
		||||
 | 
			
		||||
        <FrameLayout
 | 
			
		||||
            android:id="@+id/frame_image_progress"
 | 
			
		||||
@ -21,7 +21,8 @@
 | 
			
		||||
            app:layout_constraintDimensionRatio="H,16:9"
 | 
			
		||||
            app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
            app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
            app:layout_constraintTop_toTopOf="parent">
 | 
			
		||||
            app:layout_constraintTop_toTopOf="parent"
 | 
			
		||||
            app:layout_constraintWidth="195dp">
 | 
			
		||||
 | 
			
		||||
            <ImageView
 | 
			
		||||
                android:id="@+id/image_poster"
 | 
			
		||||
@ -53,7 +54,7 @@
 | 
			
		||||
 | 
			
		||||
        <TextView
 | 
			
		||||
            android:id="@+id/text_title"
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
            android:layout_width="0dp"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:gravity="center"
 | 
			
		||||
            android:lines="2"
 | 
			
		||||
@ -62,6 +63,8 @@
 | 
			
		||||
            android:text="@string/text_title_ex"
 | 
			
		||||
            android:textAlignment="center"
 | 
			
		||||
            android:textSize="15sp"
 | 
			
		||||
            app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
            app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/frame_image_progress" />
 | 
			
		||||
    </androidx.constraintlayout.widget.ConstraintLayout>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,18 +1,19 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
    android:layout_width="195dp"
 | 
			
		||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
    android:layout_width="wrap_content"
 | 
			
		||||
    android:layout_height="wrap_content"
 | 
			
		||||
    android:layout_marginStart="4dp"
 | 
			
		||||
    android:layout_marginEnd="3dp"
 | 
			
		||||
    android:backgroundTint="?themeSecondary"
 | 
			
		||||
    android:visibility="visible"
 | 
			
		||||
    app:cardCornerRadius="7dp"
 | 
			
		||||
    app:cardElevation="4dp">
 | 
			
		||||
 | 
			
		||||
    <androidx.constraintlayout.widget.ConstraintLayout
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent">
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        app:layout_constraintWidth_max="195dp">
 | 
			
		||||
 | 
			
		||||
        <FrameLayout
 | 
			
		||||
            android:id="@+id/frame_image_progress"
 | 
			
		||||
@ -22,14 +23,15 @@
 | 
			
		||||
            app:layout_constraintDimensionRatio="H,16:9"
 | 
			
		||||
            app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
            app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
            app:layout_constraintTop_toTopOf="parent">
 | 
			
		||||
            app:layout_constraintTop_toTopOf="parent"
 | 
			
		||||
            app:layout_constraintWidth="195dp">
 | 
			
		||||
 | 
			
		||||
            <ImageView
 | 
			
		||||
                android:id="@+id/image_poster"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="match_parent"
 | 
			
		||||
                android:background="?shapeTextBackground"
 | 
			
		||||
                android:contentDescription="@string/media_poster_desc" />
 | 
			
		||||
                tools:ignore="ContentDescription" />
 | 
			
		||||
 | 
			
		||||
        </FrameLayout>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user