<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<!-- A toolbar layout designed for bottom-sheet based components -->
<LinearLayout
    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/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <View
        android:layout_width="match_parent"
        android:layout_height="4dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="62dp"
        android:paddingStart="16dp"
        android:paddingEnd="16dp">

        <ImageView
            android:id="@+id/favicon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_centerVertical="true"
            android:layout_marginEnd="16dp"
            android:layout_marginBottom="14dp"
            android:scaleType="fitCenter"
            android:importantForAccessibility="no" />

        <ImageView
            android:id="@+id/drag_handlebar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top"
            android:layout_marginTop="4dp"
            android:layout_centerHorizontal="true"
            android:focusable="true"
            android:clickable="true"
            android:contentDescription="@string/accessibility_custom_tab_drag_handle"
            android:src="@drawable/drag_handlebar" />

        <ImageView
            android:id="@+id/close"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:paddingTop="12dp"
            android:paddingBottom="12dp"
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_marginBottom="2dp"
            android:src="@drawable/btn_close"
            android:contentDescription="@string/close"
            app:tint="@macro/default_icon_color" />

        <ImageView
            android:id="@+id/open_in_new_tab"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:paddingTop="12dp"
            android:paddingBottom="12dp"
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:layout_toStartOf="@+id/close"
            android:layout_centerVertical="true"
            android:layout_marginBottom="2dp"
            android:src="@drawable/open_in_new_tab"
            android:contentDescription="@string/contextmenu_open_in_new_tab"
            android:visibility="gone"
            app:tint="@macro/default_icon_color" />

        <RelativeLayout
            android:id="@+id/page_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toStartOf="@id/open_in_new_tab"
            android:layout_toEndOf="@id/favicon"
            android:layout_centerVertical="true">

            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="16dp"
                android:textAlignment="viewStart"
                android:ellipsize="end"
                android:singleLine="true"
                android:textAppearance="@style/TextAppearance.TextMedium.Primary" />

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignStart="@id/title"
                android:layout_below="@id/title">
                <ImageView
                    android:id="@+id/security_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center_vertical"
                    android:minHeight="16dp"
                    android:layout_marginTop="2dp"
                    android:layout_marginBottom="2dp"
                    android:importantForAccessibility="no"
                    app:tint="@macro/default_icon_color" />
                <TextView
                    android:id="@+id/origin"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="4dp"
                    android:textAlignment="viewStart"
                    android:ellipsize="start"
                    android:singleLine="true"
                    android:textAppearance="@style/TextAppearance.TextMedium.Secondary" />
            </LinearLayout>
        </RelativeLayout>
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp" />

    <ProgressBar
        android:id="@+id/progress_bar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:max="100" />

    <org.chromium.components.browser_ui.widget.FadingShadowView
        android:id="@+id/shadow"
        android:layout_width="match_parent"
        android:layout_height="@dimen/action_bar_shadow_height"/>
</LinearLayout>
