<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Twidere - Twitter client for Android
  ~
  ~  Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
  ~
  ~  This program is free software: you can redistribute it and/or modify
  ~  it under the terms of the GNU General Public License as published by
  ~  the Free Software Foundation, either version 3 of the License, or
  ~  (at your option) any later version.
  ~
  ~  This program is distributed in the hope that it will be useful,
  ~  but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~  GNU General Public License for more details.
  ~
  ~  You should have received a copy of the GNU General Public License
  ~  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<RelativeLayout
    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:id="@+id/cardContent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:focusable="true"
    android:orientation="vertical"
    android:splitMotionEvents="false"
    tools:background="?cardItemBackgroundColor"
    tools:ignore="Overdraw">

    <org.mariotaku.twidere.view.FixedTextView
        android:id="@+id/retweetedBy"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?selectableItemBackground"
        android:drawableLeft="@drawable/ic_indicator_retweet"
        android:drawablePadding="4dp"
        android:drawableStart="@drawable/ic_indicator_retweet"
        android:gravity="center_vertical"
        android:maxLines="1"
        android:minHeight="@dimen/element_size_small"
        android:padding="@dimen/element_spacing_normal"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:textColorSecondary"
        tools:text="Retweeted by Mariotaku"/>

    <org.mariotaku.twidere.view.ColorLabelRelativeLayout
        android:id="@+id/profileContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/retweetedBy"
        android:background="?selectableItemBackground"
        android:padding="@dimen/element_spacing_small"
        app:ignorePadding="true">

        <org.mariotaku.twidere.view.ProfileImageView
            android:id="@+id/profileImage"
            style="?profileImageStyle"
            android:layout_width="@dimen/icon_size_card_details"
            android:layout_height="@dimen/icon_size_card_details"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_centerVertical="true"
            android:layout_margin="@dimen/padding_profile_image_detail_page"
            android:contentDescription="@string/profile_image"
            android:scaleType="centerCrop"
            app:sivBorder="true"
            app:sivBorderWidth="1dp"
            tools:src="@drawable/ic_profile_image_twidere"/>

        <ImageView
            android:id="@+id/profileType"
            android:layout_width="@dimen/icon_size_profile_type_detail"
            android:layout_height="@dimen/icon_size_profile_type_detail"
            android:layout_alignBottom="@+id/profileImage"
            android:layout_alignEnd="@+id/profileImage"
            android:layout_alignRight="@+id/profileImage"
            android:layout_marginBottom="@dimen/element_spacing_minus_small"
            android:layout_marginEnd="@dimen/element_spacing_minus_small"
            android:layout_marginRight="@dimen/element_spacing_minus_small"
            android:scaleType="fitCenter"
            tools:ignore="ContentDescription"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/profileImage"
            android:layout_alignTop="@+id/profileImage"
            android:layout_centerVertical="true"
            android:layout_toEndOf="@+id/profileImage"
            android:layout_toLeftOf="@+id/followIndicator"
            android:layout_toRightOf="@+id/profileImage"
            android:layout_toStartOf="@+id/followIndicator"
            android:gravity="center_vertical"
            android:orientation="vertical"
            android:paddingEnd="4dp"
            android:paddingLeft="8dp"
            android:paddingRight="4dp"
            android:paddingStart="8dp">

            <org.mariotaku.twidere.view.NameView
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:nv_primaryTextColor="?android:textColorPrimary"
                app:nv_secondaryTextColor="?android:textColorSecondary"
                app:nv_twoLine="false"/>

            <org.mariotaku.twidere.view.TimelineContentTextView
                android:id="@+id/timeSource"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/element_spacing_small"
                android:gravity="center_vertical"
                android:textAppearance="?android:attr/textAppearanceSmall"
                tools:text="Jan 1 2015 0:00 · Twidere"/>

        </LinearLayout>

        <FrameLayout
            android:id="@+id/followIndicator"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:visibility="gone">

            <Button
                android:id="@+id/follow"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/action_follow"/>

            <ProgressBar
                android:id="@+id/followInfoProgress"
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"/>
        </FrameLayout>
    </org.mariotaku.twidere.view.ColorLabelRelativeLayout>


    <org.mariotaku.twidere.view.TimelineContentTextView
        android:id="@+id/summary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/profileContainer"
        android:layout_alignStart="@+id/profileContainer"
        android:layout_below="@+id/profileContainer"
        android:layout_marginBottom="@dimen/element_spacing_small"
        android:layout_marginTop="@dimen/element_spacing_small"
        android:paddingLeft="@dimen/element_spacing_normal"
        android:paddingRight="@dimen/element_spacing_normal"
        android:textAppearance="?android:textAppearanceMedium"
        android:textColor="?android:textColorPrimary"
        android:visibility="visible"
        tools:text="@string/sample_summary_text"
        tools:visibility="visible"/>

    <org.mariotaku.twidere.view.TimelineContentTextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/profileContainer"
        android:layout_alignStart="@+id/profileContainer"
        android:layout_below="@+id/summary"
        android:layout_marginBottom="@dimen/element_spacing_small"
        android:layout_marginTop="@dimen/element_spacing_small"
        android:paddingLeft="@dimen/element_spacing_normal"
        android:paddingRight="@dimen/element_spacing_normal"
        android:textAppearance="?android:textAppearanceMedium"
        android:textColor="?android:textColorPrimary"
        android:visibility="visible"
        tools:text="@string/sample_status_text"
        tools:visibility="visible"/>

    <RelativeLayout
        android:id="@+id/translateContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/text"
        android:orientation="vertical"
        android:visibility="gone"
        tools:visibility="visible">

        <org.mariotaku.twidere.view.ActionIconThemedTextView
            android:id="@+id/translateLabel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_toLeftOf="@+id/translateChangeLanguage"
            android:layout_toStartOf="@+id/translateChangeLanguage"
            android:background="?selectableItemBackground"
            android:drawableLeft="@drawable/ic_indicator_web"
            android:drawablePadding="4dp"
            android:drawableStart="@drawable/ic_indicator_web"
            android:gravity="center_vertical"
            android:maxLines="1"
            android:padding="@dimen/element_spacing_normal"
            android:text="@string/unknown_language"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:textColorSecondary"/>

        <org.mariotaku.twidere.view.FixedTextView
            android:id="@+id/translateResult"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/translateLabel"
            android:padding="@dimen/element_spacing_normal"
            android:textColor="?android:textColorPrimary"
            android:visibility="gone"
            tools:text="@string/sample_status_text"/>

        <org.mariotaku.twidere.view.FixedTextView
            android:id="@+id/translateChangeLanguage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_gravity="end"
            android:background="?selectableItemBackground"
            android:gravity="center_vertical"
            android:maxLines="1"
            android:paddingBottom="@dimen/element_spacing_normal"
            android:paddingEnd="@dimen/element_spacing_large"
            android:paddingLeft="@dimen/element_spacing_normal"
            android:paddingRight="@dimen/element_spacing_large"
            android:paddingStart="@dimen/element_spacing_normal"
            android:paddingTop="@dimen/element_spacing_normal"
            android:text="@string/action_change_language"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:textColorSecondary"
            android:visibility="gone"/>
    </RelativeLayout>

    <FrameLayout
        android:id="@+id/mediaPreviewContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/translateContainer"
        tools:visibility="visible">

        <org.mariotaku.twidere.view.CardMediaContainer
            android:id="@+id/mediaPreview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:horizontalSpacing="@dimen/element_spacing_xsmall"
            android:verticalSpacing="@dimen/element_spacing_xsmall"
            android:visibility="gone">

            <include
                layout="@layout/layout_card_media_preview"
                tools:ignore="DuplicateIncludedIds"/>

        </org.mariotaku.twidere.view.CardMediaContainer>

        <LinearLayout
            android:id="@+id/mediaPreviewLoad"
            android:layout_width="match_parent"
            android:layout_height="@dimen/action_button_size"
            android:layout_gravity="center"
            android:background="?selectableItemBackground"
            android:gravity="center"
            android:orientation="horizontal"
            android:visibility="gone"
            tools:visibility="visible">

            <org.mariotaku.twidere.view.ActionIconThemedTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:drawableLeft="@drawable/ic_action_gallery"
                android:drawableStart="@drawable/ic_action_gallery"
                android:gravity="center_vertical"
                android:text="@string/load_media"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textStyle="bold"/>
        </LinearLayout>

    </FrameLayout>

    <org.mariotaku.twidere.view.LinkPreviewView
        android:id="@+id/linkPreview"
        android:layout_margin="@dimen/element_spacing_normal"
        android:layout_below="@+id/mediaPreviewContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <org.mariotaku.twidere.view.TwitterCardContainer
        android:id="@+id/twitterCard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linkPreview"
        android:visibility="gone"/>

    <org.mariotaku.twidere.view.ColorLabelLinearLayout
        android:id="@+id/quotedView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/twitterCard"
        android:background="?selectableItemBackground"
        android:orientation="vertical"
        android:padding="@dimen/element_spacing_normal"
        app:ignorePadding="false">

        <org.mariotaku.twidere.view.NameView
            android:id="@+id/quotedName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="@dimen/element_spacing_normal"
            android:paddingRight="@dimen/element_spacing_normal"
            android:visibility="gone"
            app:nv_primaryTextColor="?android:textColorPrimary"
            app:nv_secondaryTextColor="?android:textColorSecondary"
            app:nv_twoLine="false"
            tools:visibility="visible"/>

        <org.mariotaku.twidere.view.TimelineContentTextView
            android:id="@+id/quotedText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/element_spacing_normal"
            android:textAppearance="?android:textAppearanceMedium"
            android:textColor="?android:textColorPrimary"
            android:visibility="gone"
            tools:text="@string/sample_status_text"
            tools:visibility="visible"/>

        <LinearLayout
            android:id="@+id/quotedMediaLabel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/quotedText"
            android:layout_marginTop="@dimen/element_spacing_xsmall"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            tools:visibility="gone">

            <org.mariotaku.twidere.view.IconActionView
                android:layout_width="@dimen/element_size_small"
                android:layout_height="@dimen/element_size_small"
                android:layout_weight="0"
                android:color="?android:textColorSecondary"
                android:scaleType="centerInside"
                android:src="@drawable/ic_action_gallery"
                tools:tint="?android:textColorSecondary"/>

            <org.mariotaku.twidere.view.FixedTextView
                android:id="@+id/quotedMediaLabelText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/media"
                android:textAppearance="?android:textAppearanceSmall"
                android:textStyle="bold"/>

        </LinearLayout>

        <org.mariotaku.twidere.view.CardMediaContainer
            android:id="@+id/quotedMediaPreview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/quotedMediaLabel"
            android:horizontalSpacing="@dimen/element_spacing_xsmall"
            android:verticalSpacing="@dimen/element_spacing_xsmall"
            tools:visibility="visible">

            <!-- Child views will be inflated if media preview enabled in ViewHolder -->
            <include layout="@layout/layout_card_media_preview"/>

        </org.mariotaku.twidere.view.CardMediaContainer>

    </org.mariotaku.twidere.view.ColorLabelLinearLayout>

    <org.mariotaku.twidere.view.ActionIconThemedTextView
        android:id="@+id/locationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/quotedView"
        android:background="?selectableItemBackground"
        android:drawableLeft="@drawable/ic_indicator_location"
        android:drawablePadding="4dp"
        android:drawableStart="@drawable/ic_indicator_location"
        android:gravity="center_vertical"
        android:maxLines="1"
        android:padding="@dimen/element_spacing_normal"
        android:text="@string/action_view_map"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:textColorSecondary"/>

    <LinearLayout
        android:id="@+id/countsUsersHeightHolder"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/locationView"
        android:orientation="horizontal"
        android:visibility="invisible"
        tools:visibility="visible">

        <include layout="@layout/adapter_item_status_count_label"/>

        <include layout="@layout/adapter_item_status_interact_user"/>
    </LinearLayout>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/countsUsers"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/countsUsersHeightHolder"
        android:layout_alignTop="@+id/countsUsersHeightHolder"
        android:layout_marginLeft="@dimen/element_spacing_small"
        android:layout_marginRight="@dimen/element_spacing_small"
        android:overScrollMode="never"
        android:splitMotionEvents="false"
        tools:visibility="invisible"/>

    <androidx.appcompat.widget.TwidereActionMenuView
        android:id="@+id/menuBar"
        android:layout_width="match_parent"
        android:layout_height="?android:actionBarSize"
        android:layout_below="@+id/countsUsersHeightHolder"
        android:clipChildren="false"
        android:tag="ate_ignore"/>

</RelativeLayout>
