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     <LinearLayout
     32         android:layout_width="match_parent"
     33         android:layout_height="wrap_content"
     34         android:layout_marginLeft="16dp"
     35         android:layout_marginRight="16dp"
     36         android:orientation="horizontal">
     37 
     38         <View
     39             android:id="@+id/contact_image"
     40             android:layout_width="48dp"
     41             android:layout_height="48dp"
     42             android:layout_marginRight="12dp"
     43             android:layout_marginTop="12dp"
     44             android:layout_marginBottom="12dp" />
     45 
     46         <LinearLayout
     47             android:layout_width="0dp"
     48             android:layout_height="wrap_content"
     49             android:layout_weight="1"
     50             android:orientation="vertical">
     51 
     52             <RelativeLayout
     53                 android:layout_width="match_parent"
     54                 android:layout_height="wrap_content">
     55 
     56                 <!-- these views overlap horizontally, that's okay. -->
     57                 <!-- we are only interested in the left edge of senders and the right edge -->
     58                 <!-- of the date. -->
     59                 <!-- sendersWidth, clipX, and dateX are dynamically determined later. -->
     60 
     61                 <FrameLayout
     62                     android:id="@+id/senders_decoration"
     63                     android:layout_width="wrap_content"
     64                     android:layout_height="wrap_content">
     65 
     66                     <!-- for Email -->
     67                     <!-- top margin should be 12dp, but the asset has 2dp built-in padding -->
     68                     <ImageView
     69                         android:id="@+id/reply_state"
     70                         android:layout_width="wrap_content"
     71                         android:layout_height="wrap_content"
     72                         android:layout_marginTop="10dp"
     73                         android:layout_marginRight="8dp"
     74                         android:src="@drawable/ic_badge_reply_holo_light" />
     75 
     76                     <!-- for Gmail -->
     77                     <ImageView
     78                         android:id="@+id/personal_indicator"
     79                         android:layout_width="wrap_content"
     80                         android:layout_height="wrap_content"
     81                         android:layout_marginTop="11dp"
     82                         android:layout_marginLeft="-2dp"
     83                         android:layout_marginRight="2dp"
     84                         android:src="@drawable/ic_email_caret_single" />
     85 
     86                 </FrameLayout>
     87 
     88                 <TextView
     89                     android:id="@+id/senders"
     90                     android:layout_width="match_parent"
     91                     android:layout_height="wrap_content"
     92                     android:layout_toRightOf="@id/senders_decoration"
     93                     android:layout_marginTop="12dp"
     94                     android:textSize="18sp"
     95                     android:lines="1"
     96                     android:includeFontPadding="false"
     97                     android:text="@string/long_string" />
     98 
     99                 <ImageView
    100                     android:id="@+id/info_icon"
    101                     android:layout_width="14dp"
    102                     android:layout_height="14dp"
    103                     android:layout_alignParentRight="true"
    104                     android:layout_marginTop="10dp"
    105                     android:layout_marginLeft="4dp" />
    106 
    107                 <TextView
    108                     android:id="@+id/date"
    109                     android:layout_width="wrap_content"
    110                     android:layout_height="wrap_content"
    111                     android:layout_toLeftOf="@id/info_icon"
    112                     android:layout_marginTop="12dp"
    113                     android:paddingLeft="8dp"
    114                     android:textSize="12sp"
    115                     android:lines="1"
    116                     android:includeFontPadding="false"
    117                     android:text="@string/long_string" />
    118 
    119                 <!-- top margin should be 12dp, but the asset has 8dp built-in padding -->
    120                 <!-- left padding should be 8dp, but the asset has 2dp built-in padding -->
    121                 <ImageView
    122                     android:id="@+id/paperclip"
    123                     android:layout_width="wrap_content"
    124                     android:layout_height="wrap_content"
    125                     android:layout_toLeftOf="@id/date"
    126                     android:layout_marginTop="4dp"
    127                     android:paddingLeft="6dp"
    128                     android:src="@drawable/ic_attachment_holo_light" />
    129 
    130                 <!-- for Email -->
    131                 <View android:id="@+id/color_block"
    132                     android:layout_width="@dimen/color_block_width"
    133                     android:layout_height="@dimen/color_block_height"
    134                     android:layout_alignParentRight="true" />
    135 
    136             </RelativeLayout>
    137 
    138             <RelativeLayout
    139                 android:layout_width="match_parent"
    140                 android:layout_height="wrap_content"
    141                 android:layout_marginBottom="12dp">
    142 
    143                 <ImageView
    144                     android:id="@+id/star"
    145                     android:layout_width="wrap_content"
    146                     android:layout_height="wrap_content"
    147                     android:layout_alignBottom="@+id/subject"
    148                     android:layout_alignParentRight="true"
    149                     android:layout_marginTop="-1dp"
    150                     android:layout_marginRight="-9dp"
    151                     android:src="@drawable/ic_btn_star_off" />
    152 
    153                 <TextView
    154                     android:id="@id/subject"
    155                     android:layout_width="match_parent"
    156                     android:layout_height="wrap_content"
    157                     android:layout_toLeftOf="@id/star"
    158                     android:lines="2"
    159                     android:textSize="13sp"
    160                     android:includeFontPadding="false"
    161                     android:text="@string/long_string" />
    162 
    163             </RelativeLayout>
    164 
    165         </LinearLayout>
    166 
    167     </LinearLayout>
    168     <!-- There are 12dp bottom margins here for when there are no folders -->
    169 
    170     <include
    171         layout="@layout/conversation_attachment_previews"/>
    172 
    173     <!-- Margin between attachment previews and folders. 12dp bottom margins match above -->
    174     <View
    175         android:id="@+id/attachment_previews_bottom_margin"
    176         android:layout_width="0dp"
    177         android:layout_height="@dimen/attachment_preview_margin_bottom"
    178         android:layout_marginBottom="12dp"
    179         android:visibility="gone" />
    180 
    181     <!-- Folders should be ~5dp below the subject *baseline*, so we cancel out part of the 12dp bottom margin above -->
    182     <TextView
    183         android:id="@+id/folders"
    184         android:layout_width="match_parent"
    185         android:layout_height="wrap_content"
    186         android:layout_marginTop="-10dp"
    187         android:fontFamily="sans-serif-light"
    188         android:includeFontPadding="false"
    189         android:text="@string/long_string"
    190         android:textSize="11sp"
    191         android:lines="1"
    192         android:minHeight="16dp" />
    193 
    194 </LinearLayout>
    195