[fenix] For https://github.com/mozilla-mobile/fenix/issues/24252 - Rename primaryText...
[gecko.git] / mobile / android / fenix / app / src / main / res / layout / fragment_home.xml
blob709a16bc24302b7f43c73374def2cce395c75694
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3    - License, v. 2.0. If a copy of the MPL was not distributed with this
4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
6 <!-- using an AppBarLayout to replace MotionLayout was done in order to improve Fenix
7      start up performance. The use of a MotionLayout was worsening our layout measures, especially
8       with the recycler view -->
9 <androidx.coordinatorlayout.widget.CoordinatorLayout
10     xmlns:android="http://schemas.android.com/apk/res/android"
11     xmlns:app="http://schemas.android.com/apk/res-auto"
12     xmlns:tools="http://schemas.android.com/tools"
13     android:id="@+id/homeLayout"
14     android:layout_width="match_parent"
15     android:layout_height="match_parent"
16     android:background="?homeBackground">
18     <androidx.appcompat.widget.AppCompatImageView
19         android:id="@+id/wallpaperImageView"
20         android:layout_width="match_parent"
21         android:layout_height="match_parent"
22         android:visibility="gone"/>
24     <com.google.android.material.appbar.AppBarLayout
25         android:id="@+id/homeAppBar"
26         android:layout_width="match_parent"
27         android:layout_height="wrap_content"
28         android:background="@null"
29         app:elevation="0dp"
30         android:fitsSystemWindows="false">
32         <com.google.android.material.appbar.CollapsingToolbarLayout
33             android:layout_width="match_parent"
34             android:layout_height="match_parent"
35             app:layout_scrollFlags="scroll">
37             <ImageButton
38                 android:id="@+id/privateBrowsingButton"
39                 android:layout_width="@dimen/glyph_button_height"
40                 android:layout_height="@dimen/glyph_button_height"
41                 android:layout_marginTop="14dp"
42                 android:layout_marginEnd="12dp"
43                 android:layout_gravity="end"
44                 android:background="?android:attr/selectableItemBackgroundBorderless"
45                 android:contentDescription="@string/content_description_private_browsing_button"
46                 app:srcCompat="@drawable/private_browsing_button"
47                 app:layout_collapseMode="parallax"
48                 app:layout_collapseParallaxMultiplier=".167"/>
49             <!-- This value needs to be 1.67 * the wordmark parallax value as its 24dp vs 40 -->
51             <ImageView
52                 android:id="@+id/wordmark"
53                 android:layout_width="wrap_content"
54                 android:layout_height="40dp"
55                 android:layout_marginStart="16dp"
56                 android:layout_marginTop="18dp"
57                 android:layout_marginBottom="32dp"
58                 android:adjustViewBounds="true"
59                 android:clickable="false"
60                 android:contentDescription="@string/app_name"
61                 android:focusable="false"
62                 android:importantForAccessibility="no"
63                 app:srcCompat="?fenixLogo"
64                 app:layout_collapseMode="parallax"
65                 app:layout_collapseParallaxMultiplier=".1"/>
67         </com.google.android.material.appbar.CollapsingToolbarLayout>
69     </com.google.android.material.appbar.AppBarLayout>
71     <androidx.recyclerview.widget.RecyclerView
72         android:id="@+id/sessionControlRecyclerView"
73         android:layout_width="match_parent"
74         android:layout_height="match_parent"
75         android:clipChildren="false"
76         android:clipToPadding="false"
77         android:paddingVertical="16dp"
78         android:scrollbars="none"
79         android:transitionGroup="false"
80         android:importantForAccessibility="yes"
81         android:overScrollMode="never"
82         tools:listheader="@layout/collection_header"
83         tools:listitem="@layout/collection_home_list_row"
84         tools:itemCount="3"
85         app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
87     <androidx.constraintlayout.widget.ConstraintLayout
88         android:id="@+id/toolbarLayout"
89         android:elevation="5dp"
90         android:layout_width="match_parent"
91         android:layout_height="wrap_content"
92         android:layout_gravity="bottom"
93         tools:context=".home.HomeFragment">
95         <View
96             android:id="@+id/bottom_bar"
97             android:layout_width="0dp"
98             android:layout_height="56dp"
99             android:background="?bottomBarBackground"
100             android:foregroundGravity="bottom"
101             app:layout_constraintBottom_toBottomOf="parent"
102             app:layout_constraintEnd_toEndOf="parent"
103             app:layout_constraintStart_toStartOf="parent" />
105         <FrameLayout
106             android:id="@+id/toolbar_wrapper"
107             android:layout_width="0dp"
108             android:layout_height="40dp"
109             android:layout_marginStart="8dp"
110             android:layout_marginEnd="0dp"
111             android:background="@drawable/home_search_background"
112             android:clickable="true"
113             android:contentDescription="@string/search_hint"
114             android:focusable="true"
115             app:layout_constraintBottom_toBottomOf="@id/bottom_bar"
116             app:layout_constraintEnd_toStartOf="@+id/accessory_button_barrier"
117             app:layout_constraintStart_toStartOf="parent"
118             app:layout_constraintTop_toTopOf="@id/bottom_bar">
120             <ImageView
121                 android:id="@+id/search_engine_icon"
122                 android:layout_width="24dp"
123                 android:layout_height="24dp"
124                 android:layout_gravity="start|center_vertical"
125                 android:layout_marginStart="8dp"
126                 android:clickable="false"
127                 android:focusable="false"
128                 android:importantForAccessibility="no" />
130             <TextView
131                 android:id="@+id/toolbar"
132                 android:layout_width="wrap_content"
133                 android:layout_height="wrap_content"
134                 android:layout_gravity="start|center_vertical"
135                 android:layout_marginStart="44dp"
136                 android:clickable="false"
137                 android:ellipsize="end"
138                 android:focusable="false"
139                 android:importantForAccessibility="no"
140                 android:lines="1"
141                 android:text="@string/search_hint"
142                 android:textColor="?attr/textPrimary"
143                 android:textSize="15sp" />
144         </FrameLayout>
146         <androidx.constraintlayout.widget.Barrier
147             android:id="@+id/accessory_button_barrier"
148             android:layout_width="wrap_content"
149             android:layout_height="wrap_content"
150             app:barrierDirection="start"
151             app:constraint_referenced_ids="tab_button" />
153         <mozilla.components.ui.tabcounter.TabCounter
154             android:id="@+id/tab_button"
155             android:layout_width="48dp"
156             android:layout_height="48dp"
157             app:layout_constraintTop_toTopOf="@id/bottom_bar"
158             app:layout_constraintBottom_toBottomOf="@id/bottom_bar"
159             app:layout_constraintEnd_toStartOf="@+id/menuButton"
160             app:layout_constraintStart_toEndOf="@id/toolbar_wrapper"/>
162         <mozilla.components.browser.menu.view.MenuButton
163             android:id="@+id/menuButton"
164             android:layout_width="36dp"
165             android:layout_height="48dp"
166             app:layout_constraintEnd_toEndOf="parent"
167             app:layout_constraintTop_toTopOf="@id/bottom_bar"
168             app:layout_constraintBottom_toBottomOf="@id/bottom_bar"/>
170         <View
171             android:id="@+id/bottomBarShadow"
172             android:layout_width="0dp"
173             android:layout_height="1dp"
174             android:background="@color/bottom_bar_shadow"
175             app:layout_constraintEnd_toEndOf="parent"
176             app:layout_constraintStart_toStartOf="parent"
177             app:layout_constraintBottom_toTopOf="@id/bottom_bar" />
179     </androidx.constraintlayout.widget.ConstraintLayout>
181 </androidx.coordinatorlayout.widget.CoordinatorLayout>