<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/item_tab"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="12dp"
    android:clickable="true"
    android:clipToPadding="false"
    android:focusable="true"
    android:foreground="?android:attr/selectableItemBackground"
    android:transitionGroup="true"
    app:cardBackgroundColor="?above"
    app:cardCornerRadius="@dimen/tab_corner_radius"
    app:cardElevation="5dp">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/inner_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/favicon_image"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_margin="8dp"
            android:adjustViewBounds="true"
            android:importantForAccessibility="no"
            android:scaleType="fitCenter"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageButton
            android:id="@+id/play_pause_button"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:contentDescription="@string/mozac_feature_media_notification_action_pause"
            android:elevation="10dp"
            android:visibility="gone"
            app:layout_constraintCircle="@id/favicon_image"
            app:layout_constraintCircleAngle="45"
            app:layout_constraintCircleRadius="28dp"
            app:layout_constraintEnd_toEndOf="@id/favicon_image"
            app:layout_constraintTop_toTopOf="@id/favicon_image"
            app:srcCompat="@drawable/media_state_pause" />

        <TextView
            android:id="@+id/hostname"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:ellipsize="none"
            android:singleLine="true"
            android:textAppearance="@style/Header12TextStyle"
            app:layout_constraintEnd_toStartOf="@id/close_tab_button"
            app:layout_constraintStart_toEndOf="@id/favicon_image"
            app:layout_constraintTop_toTopOf="@id/favicon_image" />

        <TextView
            android:id="@+id/tab_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginBottom="8dp"
            android:ellipsize="end"
            android:maxLines="2"
            android:minLines="2"
            android:textColor="?primaryText"
            android:textSize="14sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="@id/hostname"
            app:layout_constraintStart_toEndOf="@id/favicon_image"
            app:layout_constraintTop_toBottomOf="@id/hostname" />

        <ImageButton
            android:id="@+id/close_tab_button"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:alpha="0.8"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:contentDescription="@string/close_tab"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_close" />

        <View
            android:id="@+id/selected_border"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/session_border"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.0" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
