<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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"
    android:background="?appDetailsCardBackground">

    <!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
         when it will inevitably read out the name of the app straight after. -->
    <ImageView
        android:id="@+id/icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:scaleType="fitCenter"
        tools:src="@drawable/ic_launcher"
        tools:ignore="ContentDescription"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/text_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintStart_toEndOf="@+id/icon"
        app:layout_constraintEnd_toStartOf="@+id/action_button"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent">

        <TextView
            android:id="@+id/app_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:text="F-Droid Application manager with a long name that will wrap and then ellipsize"
            android:textSize="16sp"
            android:textColor="?attr/installedApps"
            android:maxLines="2"
            android:ellipsize="end"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:text="@string/app_list_download_ready"
            style="@style/AppListItemStatusText"
            android:visibility="gone"
            tools:visibility="visible"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/app_name" />

        <ProgressBar
            android:id="@+id/progress_bar"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:visibility="gone"
            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/cancel_button"
            app:layout_constraintTop_toBottomOf="@id/status"
            tools:visibility="visible" />

        <ImageButton
            android:id="@+id/cancel_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="8dp"
            android:paddingRight="8dp"
            android:paddingStart="8dp"
            android:paddingEnd="8dp"
            app:srcCompat="@drawable/ic_cancel"
            android:contentDescription="@string/cancel"
            android:background="@android:color/transparent"
            android:visibility="gone"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@+id/progress_bar"
            app:layout_constraintBottom_toBottomOf="@+id/progress_bar"
            tools:visibility="visible" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <Button
        android:id="@+id/action_button"
        style="@style/DetailsPrimaryButtonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:text="Update" />

</androidx.constraintlayout.widget.ConstraintLayout>