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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:gecko="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/root_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ViewStub android:id="@+id/tabs_panel"
              android:layout="@layout/tabs_panel_view"
              android:layout_width="match_parent"
              android:layout_height="match_parent"/>

   <view class="org.mozilla.gecko.GeckoApp$MainLayout"
         android:id="@+id/main_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@android:color/transparent">

        <RelativeLayout android:id="@+id/gecko_layout"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_below="@+id/tablet_tab_strip"
                        android:layout_above="@+id/find_in_page">

            <org.mozilla.gecko.GeckoView android:id="@+id/layer_view"
                                         android:layout_width="match_parent"
                                         android:layout_height="match_parent"
                                         android:scrollbars="none"/>

            <org.mozilla.gecko.FormAssistPopup android:id="@+id/form_assist_popup"
                                               android:layout_width="match_parent"
                                               android:layout_height="match_parent"
                                               android:visibility="gone"/>

            <view class="org.mozilla.gecko.media.VideoPlayer" android:id="@+id/video_player"
                         android:layout_height="match_parent"
                         android:layout_width="match_parent">
            </view>

            <FrameLayout android:id="@+id/home_screen_container"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:visibility="gone">

                <ViewStub android:id="@+id/home_pager_stub"
                          android:layout="@layout/home_pager"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"/>

                <ViewStub android:id="@+id/activity_stream_stub"
                          android:layout="@layout/activity_stream"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"/>

                <ViewStub android:id="@+id/home_banner_stub"
                          android:layout="@layout/home_banner"
                          android:layout_width="match_parent"
                          android:layout_height="@dimen/home_banner_height"
                          android:layout_gravity="bottom"/>

                <ViewStub android:id="@+id/firstrun_pager_stub"
                          android:layout="@layout/firstrun_animation_container"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"/>

            </FrameLayout>

            <View android:id="@+id/doorhanger_overlay"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@color/dark_transparent_overlay"
                  android:alpha="0"
                  android:layerType="hardware"/>

        </RelativeLayout>

        <org.mozilla.gecko.FindInPageBar android:id="@+id/find_in_page"
                                         android:layout_width="match_parent"
                                         android:layout_height="wrap_content"
                                         android:layout_alignParentBottom="true"
                                         style="@style/FindBar"
                                         android:visibility="gone"/>

        <org.mozilla.gecko.MediaCastingBar android:id="@+id/media_casting"
                                           android:layout_width="match_parent"
                                           android:layout_height="wrap_content"
                                           android:layout_alignParentBottom="true"
                                           style="@style/FindBar"
                                           android:visibility="gone"/>

        <FrameLayout android:id="@+id/search_container"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_below="@+id/browser_chrome"
                     android:visibility="invisible"/>

        <!-- When focus is cleared from from BrowserToolbar's EditText to
             lower the virtual keyboard, focus will be returned to the root
             view. To make sure the EditText is not the first focusable view in
             the root view, BrowserToolbar should be specified as low in the
             view hierarchy as possible. -->

        <LinearLayout android:id="@id/browser_chrome"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical">

            <ViewStub android:id="@+id/tablet_tab_strip"
                      android:inflatedId="@id/tablet_tab_strip"
                      android:layout="@layout/tab_strip"
                      android:layout_width="match_parent"
                      android:layout_height="@dimen/tablet_tab_strip_height"
                      android:visibility="gone"/>

            <ViewFlipper
                android:id="@+id/browser_actionbar"
                android:layout_width="match_parent"
                android:layout_height="@dimen/browser_toolbar_height_flipper"
                android:clickable="true"
                android:focusable="true">

                <org.mozilla.gecko.toolbar.BrowserToolbar
                    android:id="@+id/browser_toolbar"
                    style="@style/BrowserToolbar"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="@drawable/url_bar_bg"/>

                <org.mozilla.gecko.ActionModeCompatView android:id="@id/actionbar"
                                                        android:layout_height="match_parent"
                                                        android:layout_width="match_parent"
                                                        style="@style/GeckoActionBar.ActionMode"/>

            </ViewFlipper>

        </LinearLayout>

        <org.mozilla.gecko.widget.AnimatedProgressBar
            android:id="@id/page_progress"
            style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:layout_below="@id/browser_chrome"
            android:layout_marginTop="-2dp"
            android:background="@null"
            android:progressDrawable="@drawable/progressbar"
            android:visibility="gone"
            app:shiftDuration="@integer/shift_duration_suggestion"
            app:wrapShiftDrawable="true" />

    </view>

    <FrameLayout android:id="@+id/tab_history_panel"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_alignParentBottom="true"
                 android:visibility="gone" />

    <ViewStub android:id="@+id/toast_stub"
              android:layout="@layout/button_toast"
              style="@style/Toast"/>

</RelativeLayout>
