Merge "Add XL layout for message view"

This commit is contained in:
Makoto Onuki 2010-11-17 15:21:06 -08:00 committed by Android (Google) Code Review
commit 6ffdecfbbb
6 changed files with 387 additions and 35 deletions

View File

@ -0,0 +1,369 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- xlarge -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff"
>
<!-- Subject -->
<TextView
android:id="@+id/subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="30dip"
android:layout_marginLeft="30dip"
android:layout_marginRight="30dip"
android:singleLine="false"
android:ellipsize="none"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorPrimary"
/>
<!-- Horizontal line below subject -->
<View
android:id="@+id/top_divider"
android:layout_width="0dip"
android:layout_below="@id/subject"
android:layout_alignLeft="@id/subject"
android:layout_alignRight="@id/subject"
android:layout_marginTop="8dip"
android:layout_marginBottom="16dip"
style="@style/horizontalDivider"
/>
<!-- Badge -->
<ImageView
android:id="@+id/badge"
android:layout_width="60dip"
android:layout_height="60dip"
android:layout_gravity="center_vertical"
android:layout_alignTop="@id/top_divider"
android:layout_alignLeft="@id/subject"
/>
<!-- Presence icon -->
<ImageView
android:id="@+id/presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/top_divider"
android:layout_toRightOf="@id/badge"
android:layout_marginLeft="16dip"
android:layout_marginRight="12dip"
android:src="@drawable/presence_inactive"
android:background="@drawable/quickcontact_presence_bg"
/>
<!-- reply, reply-all, forward, Star -->
<ImageView
android:id="@+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/top_divider"
android:layout_alignRight="@id/subject"
android:layout_marginRight="16dip"
android:layout_marginLeft="16dip"
android:src="@drawable/btn_star_big_buttonless_off"
/>
<ImageView
android:id="@+id/forward"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_below="@id/top_divider"
android:layout_toLeftOf="@id/favorite"
android:layout_marginRight="16dip"
android:layout_marginLeft="16dip"
android:src="@drawable/forward"
android:visibility="gone"
/>
<ImageView
android:id="@+id/reply_all"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_below="@id/top_divider"
android:layout_toLeftOf="@id/forward"
android:layout_marginRight="16dip"
android:layout_marginLeft="16dip"
android:src="@drawable/reply_all"
android:visibility="gone"
/>
<ImageView
android:id="@+id/reply"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_below="@id/top_divider"
android:layout_toLeftOf="@id/reply_all"
android:layout_marginRight="16dip"
android:layout_marginLeft="16dip"
android:src="@drawable/reply"
android:visibility="gone"
/>
<!-- Sender display name -->
<TextView
android:id="@+id/from_name"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_below="@id/top_divider"
android:layout_toRightOf="@id/presence"
android:layout_toLeftOf="@id/reply"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:singleLine="true"
android:ellipsize="end"
/>
<!-- From address -->
<TextView
android:id="@+id/from_address"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/presence"
android:layout_below="@id/from_name"
android:layout_toLeftOf="@id/reply"
android:layout_marginTop="2dip"
android:layout_marginBottom="8dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:ellipsize="end"
android:paddingRight="6dip"
/>
<!-- To: and timestamp -->
<TextView
android:id="@+id/datetime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/from_address"
android:layout_alignRight="@id/subject"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
/>
<TextView
android:id="@+id/to_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/datetime"
android:layout_alignLeft="@id/from_address"
android:layout_marginRight="4dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:text="@string/message_compose_to_label"
/>
<TextView
android:id="@+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/datetime"
android:layout_toRightOf="@id/to_label"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
/>
<!-- Cc -->
<LinearLayout
android:id="@+id/cc_container"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_below="@id/to_label"
android:layout_alignLeft="@id/to_label"
android:layout_alignRight="@id/subject"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:text="@string/message_compose_cc_label"
/>
<TextView
android:id="@+id/cc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:ellipsize="end"
/>
</LinearLayout>
<!-- Bcc -->
<LinearLayout
android:id="@+id/bcc_container"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_below="@id/cc_container"
android:layout_alignLeft="@id/to_label"
android:layout_alignRight="@id/subject"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:text="@string/message_compose_bcc_label"
/>
<TextView
android:id="@+id/bcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:singleLine="true"
android:ellipsize="end"
/>
</LinearLayout>
<View
android:id="@+id/below_header_divider"
android:layout_width="0dip"
android:layout_below="@id/bcc_container"
android:layout_alignLeft="@id/bcc_container"
android:layout_alignRight="@id/subject"
android:layout_marginTop="8dip"
android:layout_marginBottom="2dip"
style="@style/horizontalDivider"
/>
<!-- Tabs -->
<LinearLayout
android:id="@+id/message_tabs_section"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_below="@id/below_header_divider"
android:layout_alignLeft="@id/below_header_divider"
android:layout_alignRight="@id/below_header_divider"
android:orientation="horizontal"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:paddingTop="6dip"
android:paddingBottom="6dip"
>
<Button
android:id="@+id/show_message"
android:text="@string/message_view_show_message_action"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<!--
Even though the "invite" section is only for MessageViewFragment, it's managed
by MessageViewFragmentBase for simplicity.
-->
<Button
android:id="@+id/show_invite"
android:text="@string/message_view_show_invite_action"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/show_attachments"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<View
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_weight="1"
/>
<Button
android:id="@+id/show_pictures"
android:text="@string/message_view_show_pictures_action"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<!-- Buttons at the bottom.
Only MessageViewFragment uses these. MessageFileViewFragment doesn't. -->
<include
layout="@layout/message_command_button_view"
android:id="@+id/message_command_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:visibility="gone"
/>
<!-- content area - only one of them is visible at a time -->
<!-- Message body -->
<WebView
android:id="@+id/message_content"
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_below="@id/message_tabs_section"
android:layout_alignLeft="@id/message_tabs_section"
android:layout_alignRight="@id/message_tabs_section"
android:layout_above="@id/message_command_buttons"
android:background="#ffffffff"
android:visibility="gone"
/>
<!-- Invite: Even though this section is only for MessageViewFragment,
Its visibility is controlled by MessageViewFragmentBase for simplicity.
MessageFileViewFragment shouldn't touch this. -->
<ScrollView
android:id="@+id/invite_scroll"
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_below="@id/message_tabs_section"
android:layout_alignLeft="@id/message_tabs_section"
android:layout_alignRight="@id/message_tabs_section"
android:layout_above="@id/message_command_buttons"
android:visibility="gone"
>
<include layout="@layout/message_view_invitation" />
</ScrollView>
<!-- Attachments -->
<ScrollView
android:id="@+id/attachments_scroll"
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_below="@id/message_tabs_section"
android:layout_alignLeft="@id/message_tabs_section"
android:layout_alignRight="@id/message_tabs_section"
android:layout_above="@id/message_command_buttons"
android:visibility="gone"
>
<LinearLayout
android:id="@+id/attachments"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:background="#ffffff"
/>
</ScrollView>
</RelativeLayout>

View File

@ -14,6 +14,7 @@
limitations under the License.
-->
<!-- small -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
@ -31,7 +32,6 @@
android:paddingLeft="3dip"
android:paddingRight="6dip">
<LinearLayout
android:id="@+id/from_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="true" >
@ -78,13 +78,6 @@
android:ellipsize="end"
android:paddingRight="6dip"
/>
<ImageView
android:id="@+id/attachment"
android:src="@drawable/ic_email_attachment_small"
android:layout_width="22dip"
android:layout_height="22dip"
android:baselineAlignBottom="true" />
<!-- Reply/Forward buttons are default gone for MessageFileView -->
<ImageView
android:id="@+id/reply"
@ -115,7 +108,7 @@
/>
<TextView
android:id="@+id/date"
android:id="@+id/datetime"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
@ -124,7 +117,6 @@
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/to_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
@ -144,14 +136,6 @@
android:layout_marginLeft="4dip"
android:singleLine="false"
android:ellipsize="none" />
<TextView
android:id="@+id/time"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/cc_container"

View File

@ -78,10 +78,8 @@
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="message_compose_divider">
<style name="message_compose_divider" parent="horizontalDivider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dip</item>
<!-- STOPSHIP Use same color as EditText tray? -->
<item name="android:background">#ff808080</item>
</style>
</resources>

View File

@ -4,9 +4,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,4 +26,7 @@
<color name="message_list_item_background_read">#000000</color>
<color name="account_folder_list_item_separator">#303030</color>
<color name="connection_error_banner">#fffff1a8</color>
<!-- STOPSHIP Use same color as EditText tray? -->
<color name="divider_color">#ff808080</color>
</resources>

View File

@ -53,4 +53,9 @@
<style name="PlainEditText" parent="android:Widget.EditText">
<item name="android:background">#ffffff</item>
</style>
<style name="horizontalDivider">
<item name="android:layout_height">1dip</item>
<item name="android:background">@color/divider_color</item>
</style>
</resources>

View File

@ -69,7 +69,6 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import java.io.File;
@ -105,8 +104,7 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
private TextView mSubjectView;
private TextView mFromNameView;
private TextView mFromAddressView;
private TextView mDateView;
private TextView mTimeView;
private TextView mDateTimeView;
private TextView mToView;
private TextView mCcView;
private View mCcContainerView;
@ -114,7 +112,6 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
private View mBccContainerView;
private WebView mMessageContentView;
private LinearLayout mAttachments;
private ImageView mAttachmentIcon;
private View mTabSection;
private ImageView mFromBadge;
private ImageView mSenderPresenceView;
@ -300,11 +297,9 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
mCcContainerView = view.findViewById(R.id.cc_container);
mBccView = (TextView) view.findViewById(R.id.bcc);
mBccContainerView = view.findViewById(R.id.bcc_container);
mDateView = (TextView) view.findViewById(R.id.date);
mTimeView = (TextView) view.findViewById(R.id.time);
mDateTimeView = (TextView) view.findViewById(R.id.datetime);
mMessageContentView = (WebView) view.findViewById(R.id.message_content);
mAttachments = (LinearLayout) view.findViewById(R.id.attachments);
mAttachmentIcon = (ImageView) view.findViewById(R.id.attachment);
mTabSection = view.findViewById(R.id.message_tabs_section);
mFromBadge = (ImageView) view.findViewById(R.id.badge);
mSenderPresenceView = (ImageView) view.findViewById(R.id.presence);
@ -491,7 +486,6 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
mInviteScroll.scrollTo(0, 0);
mAttachments.removeAllViews();
mAttachments.setVisibility(View.GONE);
mAttachmentIcon.setVisibility(View.GONE);
initContactStatusViews();
}
@ -1182,8 +1176,8 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
mFromAddressView.setText("");
}
Date date = new Date(message.mTimeStamp);
mTimeView.setText(mTimeFormat.format(date));
mDateView.setText(Utility.isDateToday(date) ? null : mDateFormat.format(date));
// STOPSHIP Use the same format as MessageListItem uses
mDateTimeView.setText(mTimeFormat.format(date));
mToView.setText(Address.toFriendly(Address.unpack(message.mTo)));
String friendlyCc = Address.toFriendly(Address.unpack(message.mCc));
mCcView.setText(friendlyCc);
@ -1191,7 +1185,6 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
String friendlyBcc = Address.toFriendly(Address.unpack(message.mBcc));
mBccView.setText(friendlyBcc);
mBccContainerView.setVisibility((friendlyBcc != null) ? View.VISIBLE : View.GONE);
mAttachmentIcon.setVisibility(message.mAttachments != null ? View.VISIBLE : View.GONE);
}
/**