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