<?xml version="1.0" encoding="utf-8"?>
<merge 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="match_parent"
    android:layout_height="wrap_content"
    tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">

    <androidx.cardview.widget.CardView
        android:id="@+id/link_preview_card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="16dp"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="24dp"
        app:cardBackgroundColor="@color/transparent_black_40"
        app:cardCornerRadius="12dp"
        app:cardElevation="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingHorizontal="16dp"
            android:paddingTop="12dp"
            android:paddingBottom="12dp">

            <com.google.android.material.imageview.ShapeableImageView
                android:id="@+id/link_preview_fallback_icon"
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:background="@color/core_grey_02"
                android:importantForAccessibility="no"
                android:scaleType="centerInside"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:shapeAppearance="@style/ShapeAppearanceOverlay.Signal.Story.LinkPreview.Icon"
                app:srcCompat="@drawable/ic_link_24"
                app:tint="@color/core_grey_75" />

            <org.thoughtcrime.securesms.components.OutlinedThumbnailView
                android:id="@+id/link_preview_image"
                android:layout_width="76dp"
                android:layout_height="76dp"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:src="@drawable/test_gradient" />

            <androidx.constraintlayout.widget.Barrier
                android:id="@+id/image_barrier"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:barrierDirection="end"
                app:barrierMargin="12dp"
                app:constraint_referenced_ids="link_preview_fallback_icon,link_preview_image" />

            <org.thoughtcrime.securesms.components.emoji.EmojiTextView
                android:id="@+id/link_preview_title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="3"
                android:textAppearance="@style/TextAppearance.Signal.Body1.Bold"
                android:textColor="@color/core_white"
                android:textStyle="bold"
                app:layout_constraintBottom_toTopOf="@id/link_preview_description"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/image_barrier"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_goneMarginStart="0dp"
                tools:text="ASDF dot com, the resource of your asdf dreams and whatnot. This needs to be 3 lines for testing." />

            <org.thoughtcrime.securesms.components.emoji.EmojiTextView
                android:id="@+id/link_preview_description"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:textAppearance="@style/TextAppearance.Signal.Body2"
                android:textColor="@color/core_white"
                app:layout_constraintBottom_toTopOf="@id/link_preview_url"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="@id/link_preview_title"
                app:layout_constraintTop_toBottomOf="@id/link_preview_title"
                tools:text="Blah blah blah" />

            <org.thoughtcrime.securesms.components.emoji.EmojiTextView
                android:id="@+id/link_preview_url"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:textAppearance="@style/TextAppearance.Signal.Body2"
                android:textColor="@color/transparent_white_60"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="@id/link_preview_title"
                app:layout_constraintTop_toBottomOf="@id/link_preview_description"
                tools:text="www.asdf.com" />

            <ViewStub
                android:id="@+id/loading_spinner"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inflatedId="@id/loading_spinner"
                android:layout="@layout/stories_text_post_link_preview_spinner"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>

    <com.google.android.material.imageview.ShapeableImageView
        android:id="@+id/link_preview_close"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:background="@color/transparent_black_80"
        android:padding="6dp"
        android:scaleType="centerInside"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
        app:srcCompat="@drawable/ic_x_24"
        app:tint="@color/core_white"
        tools:visibility="visible" />
</merge>