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<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
18    android:layout_width="match_parent"
19    android:layout_height="wrap_content"
20    android:layout_margin="@dimen/grid_item_margin"
21    android:background="@color/item_doc_background"
22    android:elevation="@dimen/grid_item_elevation"
23    android:focusable="true">
24
25    <!-- Main item thumbnail.  Comprised of two overlapping images, the
26         visibility of which is controlled by code in
27         DirectoryFragment.java. -->
28
29    <FrameLayout
30        android:id="@+id/thumbnail"
31        android:layout_width="match_parent"
32        android:layout_height="wrap_content">
33
34        <com.android.documentsui.GridItemThumbnail
35            android:id="@+id/icon_thumb"
36            android:layout_width="match_parent"
37            android:layout_height="wrap_content"
38            android:scaleType="centerCrop"
39            android:contentDescription="@null" />
40
41        <com.android.documentsui.GridItemThumbnail
42            android:id="@+id/icon_mime_lg"
43            android:layout_width="@dimen/icon_size"
44            android:layout_height="@dimen/icon_size"
45            android:layout_gravity="center"
46            android:scaleType="fitCenter"
47            android:contentDescription="@null" />
48
49    </FrameLayout>
50
51    <!-- Item nameplate.  Has a mime-type icon and some text fields (title,
52         size, mod-time, etc). -->
53
54    <RelativeLayout
55        android:id="@+id/nameplate"
56        android:layout_width="match_parent"
57        android:layout_height="wrap_content"
58        android:layout_below="@id/thumbnail"
59        android:paddingTop="8dp"
60        android:paddingBottom="8dp"
61        android:paddingLeft="12dp"
62        android:paddingRight="12dp">
63
64        <ImageView
65            android:id="@+id/icon_mime_sm"
66            android:layout_width="@dimen/grid_item_icon_size"
67            android:layout_height="@dimen/grid_item_icon_size"
68            android:layout_marginEnd="8dp"
69            android:layout_alignParentStart="true"
70            android:layout_centerVertical="true"
71            android:scaleType="center"
72            android:contentDescription="@null"/>
73
74        <ImageView
75            android:id="@+id/icon_check"
76            android:src="@drawable/ic_check_circle"
77            android:alpha="0"
78            android:layout_width="@dimen/check_icon_size"
79            android:layout_height="@dimen/check_icon_size"
80            android:layout_marginEnd="8dp"
81            android:layout_alignParentStart="true"
82            android:layout_centerVertical="true"
83            android:scaleType="fitCenter"
84            android:contentDescription="@null"/>
85
86        <TextView
87            android:id="@android:id/title"
88            android:layout_width="wrap_content"
89            android:layout_height="wrap_content"
90            android:layout_alignParentTop="true"
91            android:layout_toEndOf="@id/icon_mime_sm"
92            android:singleLine="true"
93            android:ellipsize="end"
94            android:textAlignment="viewStart"
95            android:textAppearance="@android:style/TextAppearance.Material.Subhead"
96            android:textColor="@color/item_title" />
97
98        <TextView
99            android:id="@+id/size"
100            android:layout_width="wrap_content"
101            android:layout_height="wrap_content"
102            android:layout_toEndOf="@id/icon_mime_sm"
103            android:layout_below="@android:id/title"
104            android:layout_marginEnd="4dp"
105            android:singleLine="true"
106            android:ellipsize="end"
107            android:textAlignment="viewStart"
108            android:textAppearance="@android:style/TextAppearance.Material.Caption"
109            android:textColor="@color/item_details" />
110
111        <TextView
112            android:id="@+id/date"
113            android:layout_width="wrap_content"
114            android:layout_height="wrap_content"
115            android:layout_below="@android:id/title"
116            android:layout_toEndOf="@id/size"
117            android:singleLine="true"
118            android:ellipsize="end"
119            android:textAlignment="viewStart"
120            android:textAppearance="@android:style/TextAppearance.Material.Caption"
121            android:textColor="@color/item_details" />
122
123    </RelativeLayout>
124
125    <!-- An overlay that draws the item border when it is focused. -->
126    <View
127        android:layout_width="wrap_content"
128        android:layout_height="wrap_content"
129        android:layout_alignBottom="@id/nameplate"
130        android:layout_alignTop="@id/thumbnail"
131        android:layout_alignLeft="@id/thumbnail"
132        android:layout_alignRight="@id/thumbnail"
133        android:contentDescription="@null"
134        android:background="@drawable/item_doc_grid_border"
135        android:duplicateParentState="true" />
136
137</RelativeLayout>
138