<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2015 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<com.android.messaging.ui.conversationlist.ConversationListItemView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <!-- The background displayed when the conversation is swiped sideways -->
    <LinearLayout
        android:id="@+id/crossSwipeBackground"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical|start"
        android:baselineAligned="false"
        android:background="@drawable/swipe_shadow"
        android:visibility="gone"
        android:padding="@dimen/conversation_list_item_view_padding">
        <ImageView
            android:id="@+id/crossSwipeArchiveIconLeft"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical|left"
            android:visibility="gone"
            android:src="@drawable/ic_archive_small_dark"
            android:importantForAccessibility="no"
            android:contentDescription="@null"/>
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1" />
        <ImageView
            android:id="@+id/crossSwipeArchiveIconRight"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:visibility="gone"
            android:src="@drawable/ic_archive_small_dark"
            android:importantForAccessibility="no"
            android:contentDescription="@null"/>
    </LinearLayout>

    <FrameLayout
        android:id="@+id/swipeableContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:importantForAccessibility="no" >
        <LinearLayout
            android:id="@+id/swipeableContent"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:clipToPadding="false"
            android:duplicateParentState="true"
            android:padding="@dimen/conversation_list_item_view_padding">

            <!-- Contact avatar on the left side of the view -->
            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent">
                <com.android.messaging.ui.ContactIconView
                    android:id="@+id/conversation_icon"
                    android:layout_width="@dimen/conversation_list_contact_icon_size"
                    android:layout_height="@dimen/conversation_list_contact_icon_size"
                    android:importantForAccessibility="no"
                    android:contentDescription="@null"
                    app:iconSize="large"
                    android:clickable="true"
                    android:background="@android:color/transparent" />
                <ImageView
                    android:id="@+id/conversation_checkmark"
                    android:layout_width="@dimen/conversation_list_contact_icon_size"
                    android:layout_height="@dimen/conversation_list_contact_icon_size"
                    android:src="@drawable/ic_checkmark_circle_blue"
                    android:visibility="gone"
                    android:importantForAccessibility="no"
                    android:background="@android:color/transparent" />
                <ImageView
                    android:id="@+id/conversation_failed_status_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|end"
                    android:src="@drawable/ic_failed_status_red"
                    android:visibility="gone"
                    android:importantForAccessibility="no"
                    android:contentDescription="@null"
                    android:background="@android:color/transparent" />
            </FrameLayout>

            <!-- The conversation name, message preview, etc -->
            <LinearLayout
                style="@style/ConversationListItemViewPaddingStyle"
                android:orientation="vertical"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_gravity="top"
                android:background="@android:color/transparent">
                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent">
                    <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:background="@android:color/transparent">
                        <ImageView
                            android:id="@+id/conversation_notification_bell"
                            style="@style/ConversationListNotificationBellPaddingStyle"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/ic_notifications_off_small_light"
                            android:visibility="gone"
                            android:importantForAccessibility="no"
                            android:contentDescription="@null"
                            android:layout_gravity="center_vertical"
                            android:background="@android:color/transparent" />
                        <TextView
                            android:id="@+id/conversation_name"
                            style="@style/ConversationListItemViewConversationNameStyle"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:singleLine="true"
                            android:layout_gravity="center_vertical"
                            android:paddingBottom="2dp" />
                    </LinearLayout>
                    <ImageView
                            android:id="@+id/work_profile_icon"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="right"
                            android:background="@android:color/transparent"
                            android:scaleType="center"
                            android:src="@drawable/ic_work_profile"
                            android:visibility="gone"/>
                </LinearLayout>
                <TextView
                    android:id="@+id/conversation_subject"
                    style="@style/ConversationListItemViewTextStyle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:paddingBottom="3dp"
                    android:ellipsize="end"
                    android:visibility="gone" />
                <TextView
                    android:id="@+id/conversation_snippet"
                    style="@style/ConversationListItemViewTextStyle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingBottom="3dp"
                    android:ellipsize="end" />
                <TextView
                    android:id="@+id/conversation_timestamp"
                    style="@style/ConversationListItemViewTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <!-- The attachment preview on the right side of the view -->
            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="top|end"
                android:background="@android:color/transparent">
                <com.android.messaging.ui.AsyncImageView
                    android:id="@+id/conversation_image_preview"
                    style="@style/ConversationListItemViewPaddingStyle"
                    app:cornerRadius="@dimen/conversation_list_image_preview_corner_radius"
                    android:layout_width="@dimen/conversation_list_image_preview_size"
                    android:layout_height="@dimen/conversation_list_image_preview_size"
                    android:visibility="gone"
                    android:scaleType="centerCrop"
                    android:contentDescription="@string/message_image_content_description"
                    android:background="@android:color/transparent" />
                <com.android.messaging.ui.AudioAttachmentView
                    android:id="@+id/audio_attachment_view"
                    android:layout_width="@dimen/conversation_list_image_preview_size"
                    android:layout_height="@dimen/conversation_list_image_preview_size"
                    app:layoutMode="subcompact"
                    android:visibility="gone"
                    android:background="@android:color/transparent" />
            </FrameLayout>
        </LinearLayout>
    </FrameLayout>
</com.android.messaging.ui.conversationlist.ConversationListItemView>
