<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:paddingLeft="10dp"
    android:paddingRight="4dp"
    android:paddingStart="10dp"
    android:paddingEnd="4dp"
    android:background="?attr/selectableItemBackground">

    <LinearLayout android:id="@+id/basic_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content">

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

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

                <TextView android:id="@+id/version"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:textStyle="bold"
                    android:textSize="18sp"
                    tools:text="1.2.3"/>

                    <TextView android:id="@+id/versionCode"
                              android:layout_height="wrap_content"
                              android:layout_width="wrap_content"
                              android:layout_gravity="center"
                              android:singleLine="true"
                              android:textSize="14sp"
                              android:visibility="gone" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:paddingTop="3dp">

                    <TextView android:id="@+id/status_installed"
                        style="@style/AppVersionStatus"
                        android:background="@drawable/app_version_item_status_installed"
                        android:textColor="#19c878"
                        android:textStyle="bold"
                        android:text="@string/app_installed" />

                    <include layout="@layout/app_status_suggested"
                        android:id="@+id/status_suggested" />

                    <TextView android:id="@+id/status_incompatible"
                        style="@style/AppVersionStatus"
                        android:background="@drawable/app_version_item_status_incompatible"
                        android:textColor="#d86758"
                        android:text="@string/app_incompatible" />
                </LinearLayout>
            </LinearLayout>
            <TextView android:id="@+id/added"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:singleLine="true"
                android:ellipsize="end"
                android:textSize="13sp"
                tools:text="Added on 31/12/2050" />
        </LinearLayout>

        <ImageView android:id="@+id/expand_arrow"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            app:srcCompat="@drawable/ic_expand_more" />
    </LinearLayout>

    <LinearLayout android:id="@+id/expanded_layout"
        android:orientation="vertical"
        android:layout_below="@id/basic_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:visibility="gone"
        tools:visibility="visible">

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

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:layout_marginEnd="8dp">

                <TextView android:id="@+id/repository"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:textColor="?attr/lightGrayTextColor"
                    android:textSize="12sp"
                    tools:text="F-Droid" />

                <TextView android:id="@+id/size"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:textColor="?attr/lightGrayTextColor"
                    android:textSize="12sp"
                    tools:text="Size: 4.8 MiB" />

                <TextView android:id="@+id/api"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:textColor="?attr/lightGrayTextColor"
                    android:textSize="12sp"
                    tools:text="Android 4.1 or later" />
            </LinearLayout>

            <Button
                android:id="@+id/button_install_upgrade"
                style="@style/DetailsSecondaryButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:layout_marginRight="4dp"
                android:layout_marginEnd="4dp"
                android:maxEms="10"
                android:ellipsize="end"
                android:singleLine="true"
                tools:text="@string/menu_install"/>

            <Button
                android:id="@+id/button_downgrade"
                style="@style/DetailsButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:layout_marginRight="4dp"
                android:layout_marginEnd="4dp"
                android:text="@string/menu_downgrade"
                android:textColor="#b87032"
                android:background="@drawable/app_version_button_bg_selector_downgrade" />

            <ProgressBar android:id="@+id/busy_indicator"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:indeterminate="true"
                android:visibility="gone"
                tools:visibility="gone" />
        </LinearLayout>

        <TextView android:id="@+id/incompatible_reasons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#d86758"
            android:textSize="12sp"
            android:visibility="gone"
            tools:visibility="visible"
            tools:text="Requires: armeabi-v7a" />

        <TextView android:id="@+id/target_arch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="?attr/lightGrayTextColor"
            android:textSize="12sp"
            android:visibility="gone" />
    </LinearLayout>
</RelativeLayout>
