<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <import type="android.view.View" alias="V" />
        <import type="org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry" />

        <variable name="entry" type="ImportKeysListEntry" />
    </data>

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:paddingBottom="16dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_toLeftOf="@+id/status"
                    android:orientation="vertical">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_key_id_colon"
                            android:textAppearance="?android:attr/textAppearanceSmall"
                            android:textColor="?attr/colorText" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="8dp"
                            android:textAppearance="?android:attr/textAppearanceSmall"
                            android:textColor="?attr/colorText"
                            app:keyId="@{entry.keyIdHex}" />

                    </LinearLayout>

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_algorithm_colon"
                            android:textAppearance="?android:attr/textAppearanceSmall"
                            android:textColor="?attr/colorText" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="8dp"
                            android:text="@{entry.algorithm ?? @string/unknown}"
                            android:textAppearance="?android:attr/textAppearanceSmall"
                            android:textColor="?attr/colorText" />

                    </LinearLayout>

                </LinearLayout>

                <ImageView
                    android:id="@+id/status"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:visibility="@{entry.revokedOrExpiredOrInsecure ? V.VISIBLE : V.GONE}"
                    app:keyExpired="@{entry.expired}"
                    app:keyRevoked="@{entry.revoked}"
                    app:keySecure="@{entry.secure}"/>

            </RelativeLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:orientation="vertical"
                app:keyUserIds="@{entry.sortedUserIds}"
                app:query="@{entry.query}" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="8dp">

            <Button
                android:id="@+id/import_key"
                style="@style/CardViewActionButton"
                android:text="@{entry.updated ? @string/btn_refresh : @string/btn_import}" />

            <Button
                android:id="@+id/show_key"
                style="@style/CardViewActionButton"
                android:text="@string/btn_go_to_key"
                android:visibility="@{entry.updated ? V.VISIBLE : V.GONE}" />

        </LinearLayout>

    </LinearLayout>

</layout>