Home | History | Annotate | Download | only in layout
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!--
      3      Copyright (C) 2013 Google Inc.
      4      Licensed to The Android Open Source Project.
      5 
      6      Licensed under the Apache License, Version 2.0 (the "License");
      7      you may not use this file except in compliance with the License.
      8      You may obtain a copy of the License at
      9 
     10           http://www.apache.org/licenses/LICENSE-2.0
     11 
     12      Unless required by applicable law or agreed to in writing, software
     13      distributed under the License is distributed on an "AS IS" BASIS,
     14      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15      See the License for the specific language governing permissions and
     16      limitations under the License.
     17 -->
     18 
     19 <!-- This layout is used as a template to create custom view CanvasConversationHeaderView
     20     in normal mode. To be able to get the correct measurements, every source field should
     21     be populated with data here. E.g:
     22     - Text View should set text to a random long string (android:text="@string/long_string")
     23     - Image View should set source to a specific asset -->
     24 <LinearLayout
     25     xmlns:android="http://schemas.android.com/apk/res/android"
     26     android:layout_width="match_parent"
     27     android:layout_height="wrap_content"
     28     android:paddingBottom="1dp"
     29     android:orientation="vertical">
     30 
     31     <FrameLayout
     32         android:layout_width="match_parent"
     33         android:layout_height="wrap_content"
     34         android:layout_marginLeft="20dp"
     35         android:layout_marginRight="32dp">
     36 
     37         <!-- minHeight here is to ensure more consistent item heights across gadget choices -->
     38         <!-- and between 'normal' vs. 'wide' layouts (which is important during 2-pane -->
     39         <!-- transitions)  -->
     40         <LinearLayout
     41             android:layout_width="match_parent"
     42             android:layout_height="wrap_content"
     43             android:orientation="horizontal"
     44             android:minHeight="66dp"
     45             android:gravity="center_vertical">
     46 
     47             <View
     48                 android:id="@+id/contact_image"
     49                 android:layout_width="46dp"
     50                 android:layout_height="46dp"
     51                 android:layout_marginRight="20dp"
     52                 android:layout_marginTop="10dp"
     53                 android:layout_marginBottom="10dp" />
     54 
     55             <LinearLayout
     56                 android:layout_width="match_parent"
     57                 android:layout_height="wrap_content"
     58                 android:layout_marginTop="10dp"
     59                 android:layout_marginBottom="10dp"
     60                 android:baselineAligned="false"
     61                 android:gravity="top"
     62                 android:orientation="horizontal">
     63 
     64                 <!-- for Email -->
     65                 <!-- cancel out the asset's 2dp built-in padding -->
     66                 <ImageView
     67                     android:id="@+id/reply_state"
     68                     android:layout_width="wrap_content"
     69                     android:layout_height="wrap_content"
     70                     android:layout_marginTop="-2dp"
     71                     android:layout_marginRight="8dp"
     72                     android:src="@drawable/ic_badge_reply_holo_light" />
     73 
     74                 <TextView
     75                     android:id="@+id/senders"
     76                     android:layout_width="0dp"
     77                     android:layout_height="wrap_content"
     78                     android:layout_weight="1"
     79                     android:textSize="18sp"
     80                     android:lines="1"
     81                     android:includeFontPadding="false"
     82                     android:text="@string/long_string" />
     83 
     84                 <FrameLayout
     85                     android:layout_width="54dp"
     86                     android:layout_height="wrap_content"
     87                     android:layout_gravity="center_vertical">
     88 
     89                     <!-- for Gmail -->
     90                     <ImageView
     91                         android:id="@+id/personal_indicator"
     92                         android:layout_width="wrap_content"
     93                         android:layout_height="wrap_content"
     94                         android:layout_marginRight="8dp"
     95                         android:layout_gravity="right"
     96                         android:src="@drawable/ic_email_caret_single" />
     97 
     98                 </FrameLayout>
     99 
    100                 <TextView
    101                     android:id="@+id/subject"
    102                     android:layout_width="0dp"
    103                     android:layout_height="wrap_content"
    104                     android:layout_weight="2"
    105                     android:lines="2"
    106                     android:textSize="14sp"
    107                     android:includeFontPadding="false"
    108                     android:text="@string/long_string" />
    109 
    110                 <!-- cancel out the asset's 8dp built-in top padding -->
    111                 <!-- left padding should be 8dp, but the asset has 2dp built-in padding -->
    112                 <ImageView
    113                     android:id="@+id/paperclip"
    114                     android:layout_width="wrap_content"
    115                     android:layout_height="wrap_content"
    116                     android:layout_marginTop="-8dp"
    117                     android:paddingLeft="6dp"
    118                     android:src="@drawable/ic_attachment_holo_light" />
    119 
    120                 <!-- The date should never appear truncated. -->
    121                 <TextView
    122                     android:id="@+id/date"
    123                     android:layout_width="wrap_content"
    124                     android:layout_height="wrap_content"
    125                     android:paddingLeft="8dp"
    126                     android:textSize="12sp"
    127                     android:lines="1"
    128                     android:includeFontPadding="false"
    129                     android:text="@string/date" />
    130 
    131                 <ImageView
    132                     android:id="@+id/info_icon"
    133                     android:layout_width="14dp"
    134                     android:layout_height="14dp"
    135                     android:layout_marginTop="-3dp"
    136                     android:layout_marginLeft="4dp" />
    137 
    138                 <!-- align to bottom of subject text -->
    139                 <ImageView
    140                     android:id="@+id/star"
    141                     android:layout_width="wrap_content"
    142                     android:layout_height="wrap_content"
    143                     android:layout_marginTop="2dp"
    144                     android:layout_marginLeft="32dp"
    145                     android:src="@drawable/ic_btn_star_off" />
    146 
    147             </LinearLayout>
    148 
    149         </LinearLayout>
    150 
    151         <!-- for Email -->
    152         <!-- aligned to be above the date (32dp(star asset) + 32dp(star left margin) = 64dp) -->
    153         <View android:id="@+id/color_block"
    154             android:layout_width="@dimen/color_block_width"
    155             android:layout_height="@dimen/color_block_height"
    156             android:layout_marginRight="64dp"
    157             android:layout_gravity="top|right" />
    158 
    159     </FrameLayout>
    160     <!-- There are 10dp bottom margins here for when there are no folders -->
    161 
    162     <include
    163             layout="@layout/conversation_attachment_previews"
    164             android:layout_width="match_parent"
    165             android:layout_height="wrap_content"
    166             android:layout_marginTop="@dimen/attachment_preview_margin_top_wide"/>
    167 
    168     <!-- Margin between attachment previews and folders. 10dp bottom margins match above -->
    169     <View
    170         android:id="@+id/attachment_previews_bottom_margin"
    171         android:layout_width="0dp"
    172         android:layout_height="@dimen/attachment_preview_margin_bottom_wide"
    173         android:layout_marginBottom="10dp"
    174         android:visibility="gone" />
    175 
    176     <!-- Folders should be 0dp below the subject, so we cancel out the 10dp bottom margin above -->
    177     <TextView
    178         android:id="@+id/folders"
    179         android:layout_width="match_parent"
    180         android:layout_height="wrap_content"
    181         android:layout_marginTop="-10dp"
    182         android:fontFamily="sans-serif-light"
    183         android:includeFontPadding="false"
    184         android:text="@string/long_string"
    185         android:textSize="12sp"
    186         android:lines="1"
    187         android:minHeight="16dp" />
    188 
    189 </LinearLayout>
    190