1<?xml version="1.0" encoding="utf-8"?> 2<!-- Copyright (C) 2013 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15--> 16 17<!-- FYI: This layout has an extra top level container view that was previously used 18 to allow for the insertion of debug info. The debug info is now gone, but the 19 container remains because there is a high likelihood of UI regression relating 20 to focus and selection states, some of which are specific to keyboard 21 when touch mode is not enable. So, if you, heroic engineer of the future, 22 decide to rip these out, please be sure to check out focus and keyboards. --> 23<com.google.android.material.card.MaterialCardView 24 xmlns:android="http://schemas.android.com/apk/res/android" 25 xmlns:app="http://schemas.android.com/apk/res-auto" 26 android:id="@+id/item_root" 27 android:layout_width="match_parent" 28 android:layout_height="wrap_content" 29 android:layout_margin="4dp" 30 android:foreground="?android:attr/selectableItemBackground" 31 android:clickable="true" 32 android:focusable="true" 33 app:cardElevation="0dp"> 34 35 <com.google.android.material.card.MaterialCardView 36 android:layout_width="match_parent" 37 android:layout_height="wrap_content" 38 android:elevation="0dp" 39 android:duplicateParentState="true" 40 app:cardElevation="0dp" 41 app:strokeWidth="1dp" 42 app:strokeColor="?android:strokeColor"> 43 44 <RelativeLayout 45 android:layout_width="match_parent" 46 android:layout_height="wrap_content" 47 android:duplicateParentState="true"> 48 49 <!-- Main item thumbnail. Comprised of two overlapping images, the 50 visibility of which is controlled by code in 51 DirectoryFragment.java. --> 52 53 <FrameLayout 54 android:id="@+id/thumbnail" 55 android:background="?attr/gridItemTint" 56 android:layout_width="match_parent" 57 android:layout_height="wrap_content"> 58 59 <com.android.documentsui.GridItemThumbnail 60 android:id="@+id/icon_thumb" 61 android:layout_width="match_parent" 62 android:layout_height="wrap_content" 63 android:scaleType="centerCrop" 64 android:contentDescription="@null" 65 android:tint="?attr/gridItemTint" 66 android:tintMode="src_over"/> 67 68 <com.android.documentsui.GridItemThumbnail 69 android:id="@+id/icon_mime_lg" 70 android:layout_width="@dimen/icon_size" 71 android:layout_height="@dimen/icon_size" 72 android:layout_gravity="center" 73 android:scaleType="fitCenter" 74 android:contentDescription="@null"/> 75 76 </FrameLayout> 77 78 <FrameLayout 79 android:id="@+id/preview_icon" 80 android:layout_width="@dimen/button_touch_size" 81 android:layout_height="@dimen/button_touch_size" 82 android:layout_alignParentTop="true" 83 android:layout_alignParentEnd="true" 84 android:pointerIcon="hand" 85 android:focusable="true" 86 android:clickable="true"> 87 88 <ImageView 89 android:layout_width="@dimen/zoom_icon_size" 90 android:layout_height="@dimen/zoom_icon_size" 91 android:padding="2dp" 92 android:layout_gravity="center" 93 android:background="@drawable/circle_button_background" 94 android:scaleType="fitCenter" 95 android:src="@drawable/ic_zoom_out"/> 96 97 </FrameLayout> 98 99 <!-- Item nameplate. Has a mime-type icon and some text fields (title, 100 size, mod-time, etc). --> 101 102 <LinearLayout 103 android:id="@+id/nameplate" 104 android:background="?android:attr/colorBackground" 105 android:orientation="horizontal" 106 android:layout_width="match_parent" 107 android:layout_height="wrap_content" 108 android:layout_below="@id/thumbnail"> 109 110 <FrameLayout 111 android:id="@+id/icon" 112 android:layout_width="wrap_content" 113 android:layout_height="match_parent" 114 android:layout_centerVertical="true" 115 android:pointerIcon="hand" 116 android:paddingTop="8dp" 117 android:paddingBottom="8dp" 118 android:paddingStart="12dp" 119 android:paddingEnd="8dp"> 120 121 <ImageView 122 android:id="@+id/icon_mime_sm" 123 android:layout_width="@dimen/grid_item_icon_size" 124 android:layout_height="@dimen/grid_item_icon_size" 125 android:layout_gravity="center" 126 android:scaleType="center" 127 android:contentDescription="@null"/> 128 129 <ImageView 130 android:id="@+id/icon_check" 131 android:src="@drawable/ic_check_circle" 132 android:alpha="0" 133 android:layout_width="@dimen/check_icon_size" 134 android:layout_height="@dimen/check_icon_size" 135 android:layout_gravity="center" 136 android:scaleType="fitCenter" 137 android:contentDescription="@null"/> 138 139 </FrameLayout> 140 141 <RelativeLayout 142 android:layout_width="match_parent" 143 android:layout_height="wrap_content" 144 android:paddingBottom="8dp" 145 android:paddingTop="8dp" 146 android:paddingEnd="12dp"> 147 148 <ImageView 149 android:id="@+id/icon_profile_badge" 150 android:layout_height="@dimen/briefcase_icon_size" 151 android:layout_width="@dimen/briefcase_icon_size" 152 android:layout_marginEnd="@dimen/briefcase_icon_margin" 153 android:layout_alignTop="@android:id/title" 154 android:layout_alignBottom="@android:id/title" 155 android:gravity="center_vertical" 156 android:src="@drawable/ic_briefcase" 157 android:tint="?android:attr/colorAccent" 158 android:contentDescription="@string/a11y_work"/> 159 160 <TextView 161 android:id="@android:id/title" 162 android:layout_width="wrap_content" 163 android:layout_height="wrap_content" 164 android:layout_alignParentTop="true" 165 android:layout_toEndOf="@+id/icon_profile_badge" 166 android:singleLine="true" 167 android:ellipsize="end" 168 android:textAlignment="viewStart" 169 android:textAppearance="@style/CardPrimaryText"/> 170 171 <TextView 172 android:id="@+id/details" 173 android:layout_width="wrap_content" 174 android:layout_height="wrap_content" 175 android:layout_below="@android:id/title" 176 android:layout_marginEnd="4dp" 177 android:singleLine="true" 178 android:ellipsize="end" 179 android:textAlignment="viewStart" 180 android:textAppearance="@style/ItemCaptionText" /> 181 182 <TextView 183 android:id="@+id/date" 184 android:layout_width="wrap_content" 185 android:layout_height="wrap_content" 186 android:layout_below="@android:id/title" 187 android:layout_toEndOf="@id/details" 188 android:singleLine="true" 189 android:ellipsize="end" 190 android:textAlignment="viewStart" 191 android:textAppearance="@style/ItemCaptionText" /> 192 193 </RelativeLayout> 194 195 </LinearLayout> 196 197 </RelativeLayout> 198 199 </com.google.android.material.card.MaterialCardView> 200 201 <!-- An overlay that draws the item border when it is focused. --> 202 <View 203 android:layout_width="match_parent" 204 android:layout_height="match_parent" 205 android:background="@drawable/item_doc_grid_border_rounded" 206 android:contentDescription="@null" 207 android:duplicateParentState="true"/> 208 209</com.google.android.material.card.MaterialCardView> 210