1<?xml version="1.0" encoding="utf-8"?> 2<!-- 3 ~ Copyright (C) 2020 The Android Open Source Project 4 ~ 5 ~ Licensed under the Apache License, Version 2.0 (the "License"); 6 ~ you may not use this file except in compliance with the License. 7 ~ You may obtain a copy of the License at 8 ~ 9 ~ http://www.apache.org/licenses/LICENSE-2.0 10 ~ 11 ~ Unless required by applicable law or agreed to in writing, software 12 ~ distributed under the License is distributed on an "AS IS" BASIS, 13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ~ See the License for the specific language governing permissions and 15 ~ limitations under the License. 16 --> 17 18<!-- CoordinatorLayout is necessary for various components (e.g. Snackbars, and 19 BottomSheet) to operate correctly. --> 20<androidx.coordinatorlayout.widget.CoordinatorLayout 21 xmlns:android="http://schemas.android.com/apk/res/android" 22 xmlns:app="http://schemas.android.com/apk/res-auto" 23 xmlns:tools="http://schemas.android.com/tools" 24 android:id="@+id/photo_picker_base" 25 android:orientation="vertical" 26 android:layout_width="match_parent" 27 android:layout_height="match_parent" 28 tools:context=".MainActivity"> 29 30 <LinearLayout 31 android:layout_width="match_parent" 32 android:layout_height="match_parent" 33 android:id="@+id/bottom_sheet" 34 android:background="@color/picker_background_color" 35 android:clipToOutline="true" 36 android:orientation="vertical" 37 app:behavior_hideable="true" 38 app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> 39 40 <ImageView 41 android:id="@+id/drag_bar" 42 android:layout_width="wrap_content" 43 android:layout_height="wrap_content" 44 android:layout_gravity="center_horizontal" 45 android:layout_marginBottom="@dimen/picker_drag_margin_bottom" 46 android:layout_marginTop="@dimen/picker_drag_margin_top" 47 android:scaleType="fitCenter" 48 android:src="@drawable/ic_drag" 49 android:contentDescription="@null"/> 50 51 <com.android.providers.media.photopicker.ui.SafetyProtectionSectionView 52 android:layout_width="wrap_content" 53 android:layout_height="wrap_content" 54 android:layout_marginBottom="5dp" 55 android:layout_gravity="center" /> 56 57 <TextView 58 android:id="@+id/privacy_text" 59 android:layout_width="wrap_content" 60 android:layout_height="wrap_content" 61 android:layout_gravity="center_horizontal" 62 android:layout_marginHorizontal="@dimen/picker_privacy_text_horizontal_gap" 63 android:layout_marginBottom="@dimen/picker_privacy_text_margin_bottom" 64 android:layout_marginTop="@dimen/picker_privacy_text_margin_top" 65 android:gravity="center_horizontal" 66 android:text="@string/picker_privacy_message" 67 android:textColor="?android:attr/textColorPrimary" 68 android:textSize="@dimen/picker_privacy_text_size" 69 style="?android:attr/textAppearanceListItem"/> 70 71 <FrameLayout 72 android:layout_width="match_parent" 73 android:layout_height="match_parent"> 74 75 <androidx.fragment.app.FragmentContainerView 76 android:id="@+id/fragment_container" 77 android:layout_width="match_parent" 78 android:layout_height="match_parent" 79 android:importantForAccessibility="yes"/> 80 81 <com.google.android.material.appbar.AppBarLayout 82 android:layout_width="match_parent" 83 android:layout_height="wrap_content" 84 android:layout_gravity="top" 85 android:background="@android:color/transparent" 86 app:liftOnScroll="true"> 87 88 <androidx.appcompat.widget.Toolbar 89 android:id="@+id/toolbar" 90 android:layout_width="match_parent" 91 android:layout_height="?attr/actionBarSize" 92 android:background="@color/picker_background_color" 93 android:importantForAccessibility="yes" 94 android:accessibilityTraversalAfter="@+id/privacy_text" 95 android:accessibilityTraversalBefore="@+id/fragment_container" 96 app:titleTextColor="?attr/pickerTextColor" 97 app:titleTextAppearance="@style/PickerToolbarTitleTextAppearance"> 98 99 <com.google.android.material.tabs.TabLayout 100 android:id="@+id/tab_layout" 101 android:layout_width="wrap_content" 102 android:layout_height="wrap_content" 103 android:background="@color/picker_background_color" 104 android:layout_gravity="center" 105 app:tabBackground="@drawable/picker_tab_background" 106 app:tabIndicatorAnimationMode="linear" 107 app:tabIndicatorColor="?attr/pickerSelectedTabBackgroundColor" 108 app:tabIndicatorGravity="center" 109 app:tabMinWidth="@dimen/picker_tab_min_width" 110 app:tabPaddingStart="@dimen/picker_tab_horizontal_gap" 111 app:tabPaddingEnd="@dimen/picker_tab_horizontal_gap" 112 app:tabRippleColor="@null" 113 app:tabSelectedTextColor="?attr/pickerSelectedTabTextColor" 114 app:tabTextAppearance="@style/PickerTabTextAppearance" 115 app:tabTextColor="?android:attr/textColorSecondary" /> 116 117 </androidx.appcompat.widget.Toolbar> 118 119 </com.google.android.material.appbar.AppBarLayout> 120 121 <LinearLayout 122 android:id="@+id/picker_bottom_bar" 123 android:layout_width="match_parent" 124 android:layout_height="@dimen/picker_bottom_bar_size" 125 android:layout_gravity="bottom" 126 android:background="@color/picker_background_color" 127 android:elevation="@dimen/picker_bottom_bar_elevation" 128 android:visibility="gone" 129 android:orientation="horizontal"> 130 131 <com.google.android.material.button.MaterialButton 132 android:id="@+id/button_view_selected" 133 android:layout_width="0dp" 134 android:layout_height="wrap_content" 135 android:layout_weight="2" 136 android:layout_marginHorizontal="@dimen/picker_bottom_bar_horizontal_gap" 137 android:gravity="start|center_vertical" 138 android:paddingVertical="@dimen/picker_bottom_bar_buttons_vertical_gap" 139 android:text="@string/picker_view_selected" 140 android:textAllCaps="false" 141 android:textColor="?attr/pickerSelectedColor" 142 android:maxLines="1" 143 android:ellipsize="end" 144 app:icon="@drawable/ic_collections" 145 app:iconPadding="@dimen/picker_viewselected_icon_padding" 146 app:iconSize="@dimen/picker_viewselected_icon_size" 147 app:iconTint="?attr/pickerSelectedColor" 148 app:iconGravity="textStart" 149 style="@style/MaterialBorderlessButtonStyle"/> 150 151 <Button 152 android:id="@+id/button_add" 153 android:layout_width="0dp" 154 android:layout_height="wrap_content" 155 android:layout_weight="1" 156 android:layout_marginHorizontal="@dimen/picker_bottom_bar_horizontal_gap" 157 android:gravity="center|center_vertical" 158 android:paddingVertical="@dimen/picker_bottom_bar_buttons_vertical_gap" 159 android:text="@string/add" 160 android:textAllCaps="false" 161 android:textColor="?attr/pickerHighlightTextColor" 162 android:maxLines="1" 163 android:ellipsize="middle" 164 android:backgroundTint="?attr/pickerHighlightColor" 165 style="@style/MaterialButtonStyle"/> 166 167 </LinearLayout> 168 169 </FrameLayout> 170 171 </LinearLayout> 172 173 <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton 174 android:id="@+id/profile_button" 175 android:layout_width="wrap_content" 176 android:layout_height="wrap_content" 177 android:layout_marginBottom="@dimen/picker_profile_button_margin_bottom" 178 android:layout_gravity="bottom|center" 179 android:textAppearance="@style/PickerButtonTextAppearance" 180 android:textColor="?attr/pickerProfileButtonTextColor" 181 android:text="@string/picker_work_profile" 182 android:visibility="gone" 183 android:accessibilityTraversalAfter="@+id/toolbar" 184 android:accessibilityTraversalBefore="@+id/fragment_container" 185 app:backgroundTint="?attr/pickerProfileButtonColor" 186 app:borderWidth="0dp" 187 app:elevation="3dp" 188 app:icon="@drawable/ic_work_outline"/> 189 190 <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton 191 android:id="@+id/profile_menu_button" 192 android:layout_width="wrap_content" 193 android:layout_height="wrap_content" 194 android:layout_marginBottom="@dimen/picker_profile_button_margin_bottom" 195 android:layout_gravity="bottom|center" 196 android:textAppearance="@style/PickerButtonTextAppearance" 197 android:textColor="?attr/pickerProfileButtonTextColor" 198 android:visibility="gone" 199 android:accessibilityTraversalAfter="@+id/toolbar" 200 android:accessibilityTraversalBefore="@+id/fragment_container" 201 app:backgroundTint="?attr/pickerProfileButtonColor" 202 app:borderWidth="0dp" 203 app:elevation="3dp"/> 204 205</androidx.coordinatorlayout.widget.CoordinatorLayout> 206