<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent">
    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/channel_coordinator"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:orientation="vertical"
        android:background="@color/black">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_width="match_parent"
            android:layout_height="170dp"
            android:background="@color/transparent"
            app:elevation="0dp">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:id="@+id/toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:contentScrim="@color/transparent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:toolbarId="@+id/toolbar">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginBottom="40dp">

                    <androidx.appcompat.widget.AppCompatImageView
                        android:id="@+id/image_channel_banner"
                        android:layout_width="match_parent"
                        android:layout_height="0dp"
                        android:fitsSystemWindows="true"
                        android:scaleType="centerCrop"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintRight_toRightOf="parent" />

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:id="@+id/channel_info"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingTop="8dp"
                        android:paddingBottom="8dp"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        android:background="@color/overlay">
                        <com.futo.platformplayer.views.others.CreatorThumbnail
                            android:id="@+id/creator_thumbnail"
                            android:background="@drawable/rounded_outline"
                            android:layout_width="35dp"
                            android:layout_height="35dp"
                            android:contentDescription="@string/cd_creator_thumbnail"
                            android:layout_marginStart="8dp"
                            android:scaleType="fitCenter"
                            app:layout_constraintLeft_toLeftOf="parent"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                        <TextView
                            android:id="@+id/text_channel_name"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:textSize="14dp"
                            android:textColor="@color/white"
                            android:fontFamily="@font/inter_regular"
                            android:layout_marginStart="8dp"
                            android:layout_marginEnd="8dp"
                            android:maxLines="1"
                            android:ellipsize="end"
                            tools:text="CHANNEL NAME"
                            app:layout_constraintLeft_toRightOf="@id/creator_thumbnail"
                            app:layout_constraintBottom_toTopOf="@id/text_metadata"
                            app:layout_constraintRight_toLeftOf="@id/button_sub_settings" />

                        <TextView
                            android:id="@+id/text_metadata"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:textSize="14dp"
                            android:textColor="@color/gray_ac"
                            android:fontFamily="@font/inter_light"
                            android:layout_marginStart="8dp"
                            android:layout_marginEnd="8dp"
                            android:maxLines="1"
                            android:ellipsize="end"
                            tools:text="17 videos"
                            app:layout_constraintLeft_toRightOf="@id/creator_thumbnail"
                            app:layout_constraintRight_toLeftOf="@id/button_sub_settings"
                            app:layout_constraintBottom_toBottomOf="parent" />
                        <ImageButton
                            android:id="@+id/button_sub_settings"
                            android:layout_width="30dp"
                            android:layout_height="30dp"
                            android:contentDescription="@string/cd_button_settings"
                            android:layout_marginTop="3dp"
                            android:layout_marginRight="10dp"
                            android:scaleType="fitCenter"
                            app:layout_constraintTop_toTopOf="@id/button_subscribe"
                            app:layout_constraintRight_toLeftOf="@id/button_subscribe"
                            android:src="@drawable/ic_settings" />

                        <com.futo.platformplayer.views.subscriptions.SubscribeButton
                            android:id="@+id/button_subscribe"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/cd_button_subscribe"
                            android:layout_marginEnd="4dp"
                            app:layout_constraintRight_toRightOf="parent"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                    </androidx.constraintlayout.widget.ConstraintLayout>
                </androidx.constraintlayout.widget.ConstraintLayout>

                <androidx.appcompat.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:minHeight="0dp"
                    app:contentInsetStart="0dp"
                    app:contentInsetEnd="0dp"
                    app:layout_collapseMode="pin"
                    android:layout_gravity="bottom">

                    <com.google.android.material.tabs.TabLayout
                        android:id="@+id/tabs"
                        app:tabMode="scrollable"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        app:tabSelectedTextColor="@color/white"
                        app:tabTextColor="@color/gray_8c"
                        android:background="@drawable/tab_border"
                        app:tabIndicatorColor="@color/white"
                        android:textSize="12dp"
                        android:textColor="@color/gray_8c"
                        android:fontFamily="@font/inter_medium"
                        app:tabTextAppearance="@style/Theme.FutoVideo.TextAppearance.TabLayout" />

                </androidx.appcompat.widget.Toolbar>
            </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <LinearLayout
        android:id="@+id/channel_loading_overlay"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:background="#77000000"
        android:gravity="center">
        <ImageView
            android:id="@+id/channel_loader_frag"
            android:layout_width="80dp"
            android:layout_height="80dp"
            app:srcCompat="@drawable/ic_loader_animated"
            android:layout_gravity="center"
            android:alpha="0.7"
            android:contentDescription="@string/loading" />
    </LinearLayout>

    <FrameLayout
        android:id="@+id/overlay_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
