<?xml version="1.0" encoding="utf-8"?><!--
   Copyright 2015 Synced Synapse. All rights reserved.

   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.
-->

<FrameLayout 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="match_parent">

    <com.google.android.material.imageview.ShapeableImageView
        android:id="@+id/media_art"
        android:layout_width="match_parent"
        android:layout_height="@dimen/info_art_height"
        android:layout_marginTop="@dimen/small_padding"
        android:layout_marginLeft="@dimen/info_panel_horiz_margin"
        android:layout_marginRight="@dimen/info_panel_horiz_margin"
        android:contentDescription="@string/thumbnail"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kore.Image.MediaArt"/>

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.core.widget.NestedScrollView
            android:id="@+id/media_panel"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipChildren="false"
                android:orientation="vertical"
                android:layout_marginTop="@dimen/small_padding"
                android:layout_marginBottom="@dimen/default_padding">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/media_panel_group"
                    style="@style/Widget.Kore.InfoPanel"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/info_panel_horiz_margin"
                    android:layout_marginTop="@dimen/info_title_margin_top"
                    android:layout_marginRight="@dimen/info_panel_horiz_margin">

                    <androidx.constraintlayout.widget.Guideline
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/poster_bottom_guideline"
                        android:orientation="horizontal"
                        app:layout_constraintGuide_begin="@dimen/info_poster_bottom_guideline"/>

                    <com.google.android.material.imageview.ShapeableImageView
                        android:id="@+id/poster"
                        android:layout_width="@dimen/info_poster_width_square"
                        android:layout_height="@dimen/info_poster_height_square"
                        android:layout_marginStart="@dimen/small_padding"
                        android:contentDescription="@string/poster"
                        android:scaleType="centerCrop"
                        app:layout_constraintBottom_toBottomOf="@id/poster_bottom_guideline"
                        app:layout_constraintStart_toStartOf="parent"
                        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kore.Image.Poster"
                        android:elevation="@dimen/kore_elevation_level2"/>

                    <TextView
                        android:id="@+id/media_title"
                        style="@style/Widget.Kore.TextView.MediaTitle"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/default_padding"
                        android:layout_marginEnd="@dimen/small_padding"
                        android:gravity="start"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toEndOf="@id/poster"
                        app:layout_constraintTop_toTopOf="parent"/>

                    <TextView
                        android:id="@+id/media_undertitle"
                        style="@style/Widget.Kore.TextView.MediaDetails"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:paddingTop="0dp"
                        android:gravity="start"
                        app:layout_constraintEnd_toEndOf="@id/media_title"
                        app:layout_constraintStart_toStartOf="@id/media_title"
                        app:layout_constraintTop_toBottomOf="@id/media_title" />

                    <TextView
                        android:id="@+id/rating"
                        style="@style/Widget.Kore.TextView.MediaRating"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/default_padding"
                        android:paddingTop="@dimen/default_padding"
                        android:paddingBottom="@dimen/default_padding"
                        app:layout_constraintTop_toBottomOf="@id/poster"
                        app:layout_constraintStart_toStartOf="parent"/>

                    <TextView
                        android:id="@+id/rating_votes"
                        style="@style/Widget.Kore.TextView.MediaSmallDetails"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/small_padding"
                        android:paddingTop="@dimen/default_padding"
                        app:layout_constraintStart_toEndOf="@id/rating"
                        app:layout_constraintBaseline_toBaselineOf="@id/rating"/>

                    <TextView
                        android:id="@+id/media_details_right"
                        style="@style/Widget.Kore.TextView.MediaSmallDetails"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="@dimen/default_padding"
                        android:paddingTop="@dimen/default_padding"
                        android:paddingBottom="@dimen/default_padding"
                        app:layout_constraintTop_toTopOf="@id/rating"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toEndOf="@id/rating_votes"
                        android:gravity="end"/>

                    <androidx.constraintlayout.widget.Barrier
                        android:id="@+id/barrier"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:barrierDirection="bottom"
                        app:constraint_referenced_ids="rating,media_details_right" />

                    <com.google.android.material.divider.MaterialDivider
                        android:id="@+id/divider_1"
                        style="@style/Widget.Kore.Divider.InfoSections"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/tiny_padding"
                        android:layout_marginBottom="@dimen/tiny_padding"
                        app:layout_constraintTop_toBottomOf="@id/barrier"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"/>

                    <!-- Media info actions buttons -->
                    <LinearLayout
                        android:id="@+id/info_actions_bar"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:visibility="gone"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/divider_1">

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_pin"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/pinned_status"
                            android:text="@string/pinned_status"
                            app:icon="@drawable/ic_round_bookmark_24"
                            android:visibility="gone" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_enable"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/enabled_status"
                            android:text="@string/enabled_status"
                            app:icon="@drawable/ic_round_check_box_24"
                            android:visibility="gone" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_watched"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/watched_status"
                            android:text="@string/watched_status"
                            app:icon="@drawable/ic_round_check_box_24"
                            android:visibility="gone" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_download"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/download_action"
                            android:text="@string/download_action"
                            app:icon="@drawable/ic_round_download_24"
                            android:visibility="gone" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_stream"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/stream_action"
                            android:text="@string/stream_action"
                            android:visibility="gone"
                            android:checkable="false"
                            app:icon="@drawable/ic_round_cast_connected_24" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/info_action_queue"
                            style="@style/Widget.Kore.Button.InfoAction"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="1"
                            android:contentDescription="@string/queue_action"
                            android:text="@string/queue_action"
                            android:visibility="gone"
                            app:icon="@drawable/ic_round_queue_24" />

                    </LinearLayout>

                    <com.google.android.material.divider.MaterialDivider
                        android:id="@+id/divider_2"
                        style="@style/Widget.Kore.Divider.InfoSections"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/tiny_padding"
                        android:layout_marginBottom="@dimen/tiny_padding"
                        app:layout_constraintTop_toBottomOf="@id/info_actions_bar"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintEnd_toEndOf="parent" />

                    <at.blogc.android.views.ExpandableTextView
                        android:id="@+id/media_description"
                        style="@style/Widget.Kore.TextView.MediaInfo"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/divider_2"
                        android:ellipsize="end"
                        android:maxLines="@integer/description_max_lines"
                        android:paddingLeft="@dimen/default_padding"
                        android:paddingRight="@dimen/default_padding"
                        android:paddingBottom="@dimen/default_padding"
                        app:animation_duration="@integer/expandable_textview_animation_duration" />

                    <ImageView
                        android:id="@+id/show_all"
                        style="@style/Widget.Kore.Button.Borderless"
                        android:layout_width="@dimen/small_icon_size"
                        android:layout_height="@dimen/small_icon_size"
                        android:layout_marginEnd="@dimen/small_padding"
                        android:layout_marginBottom="@dimen/small_padding"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintBottom_toBottomOf="parent"
                        android:contentDescription="@string/toggle_expand"
                        android:src="@drawable/ic_round_expand_more_24" />
                </androidx.constraintlayout.widget.ConstraintLayout>

                <androidx.fragment.app.FragmentContainerView
                    android:id="@+id/media_additional_info"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/info_panel_horiz_margin"
                    android:layout_marginTop="@dimen/default_padding"
                    android:layout_marginRight="@dimen/info_panel_horiz_margin"
                    android:transitionGroup="true"/>

            </LinearLayout>
        </androidx.core.widget.NestedScrollView>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    <!-- View that will be shown with the circularReveal when user presses the FAB -->
    <View
        android:id="@+id/exit_transition_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?attr/colorPrimaryContainer"
        android:visibility="invisible" />
</FrameLayout>