Merge "Fragmentize MessageView."

This commit is contained in:
Makoto Onuki 2010-07-21 14:21:06 -07:00 committed by Android (Google) Code Review
commit bab0d45904
7 changed files with 1663 additions and 1410 deletions

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<ScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:fadingEdge="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<!-- put invisible views for prev/next in order to not special-case the lanscape in code -->
<FrameLayout
android:visibility="gone"
android:layout_width="0dip"
android:layout_height="0dip">
<View
android:id="@+id/moveToNewer"
android:layout_width="0dip"
android:layout_height="0dip" />
<View android:id="@+id/moveToOlder"
android:layout_width="0dip"
android:layout_height="0dip" />
</FrameLayout>
<include layout="@layout/message_view_header" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:paddingBottom="1dip"
android:background="@android:drawable/bottom_bar">
<Button
android:id="@+id/reply"
android:text="@string/reply_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/reply_all"
android:text="@string/reply_all_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/delete"
android:text="@string/delete_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>

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.
@ -20,58 +20,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<ScrollView
android:id="@+id/scrollview"
<fragment
android:id="@+id/message_view_fragment"
android:name="com.android.email.activity.MessageViewFragment"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:scrollbarStyle="outsideOverlay"
android:fadingEdge="none"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Note, height is 2+35+0. There is a 4pixel fade on top of header image -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="37dip"
android:paddingTop="2dip"
android:background="#101010">
<ImageButton
android:id="@+id/moveToNewer"
android:layout_height="35dip"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/btn_arrow_left"
android:scaleType="fitStart"
android:paddingLeft="6dip"
android:background="@drawable/btn_arrow_background"
android:paddingTop="0dip"
android:paddingBottom="0dip"
/>
<ImageButton
android:id="@+id/moveToOlder"
android:layout_height="35dip"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/btn_arrow_right"
android:scaleType="fitEnd"
android:paddingRight="9dip"
android:background="@drawable/btn_arrow_background"
android:paddingTop="0dip"
android:paddingBottom="0dip"
/>
</LinearLayout>
<include layout="@layout/message_view_header" />
</LinearLayout>
</ScrollView>
/>
<!-- Bottom buttons -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
@ -79,7 +35,7 @@
android:paddingTop="5dip"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:paddingBottom="1dip"
android:paddingBottom="1dip"
android:background="@android:drawable/bottom_bar">
<Button
android:id="@+id/reply"
@ -99,5 +55,17 @@
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/moveToNewer"
android:text="@string/message_view_move_to_newer"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/moveToOlder"
android:text="@string/message_view_move_to_older"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>

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.
@ -14,171 +14,191 @@
limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- header area -->
<!--
TODO Rename to message_view_fragment.xml
Can't do it now because git wouldn't detect renaming.
-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="0dip"
android:scrollbarStyle="outsideOverlay"
android:fadingEdge="none"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/header_card"
android:paddingTop="3dip"
android:paddingBottom="3dip"
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" >
<ImageView
android:id="@+id/presence"
android:src="@drawable/presence_inactive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_gravity="center_vertical"
android:background="@drawable/quickcontact_presence_bg" />
<TextView
android:id="@+id/from"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:singleLine="true"
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" />
<TextView
android:id="@+id/date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/to_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_to_label" />
<TextView
android:id="@+id/to"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="false"
android:ellipsize="none" />
<TextView
android:id="@+id/time"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/cc_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_cc_label" />
<TextView
android:id="@+id/cc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="false"
android:ellipsize="none" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/subject"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:singleLine="false"
android:ellipsize="none" />
<!-- TODO: Move this to wherever it really belongs -->
<ImageView
android:id="@+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/btn_star_big_buttonless_off" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/show_pictures_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffefefef"
android:layout_marginTop="6dip"
android:paddingLeft="6dip"
android:paddingRight="3dip"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:baselineAligned="false"
android:visibility="gone">
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:text="@string/message_view_show_pictures_instructions"
android:layout_gravity="center"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/show_pictures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_show_pictures_action" />
</LinearLayout>
<!-- content area -->
<include layout="@layout/message_view_invitation" />
<WebView
android:id="@+id/message_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="#ffffff" />
<!-- attachments area -->
<LinearLayout
android:id="@+id/attachments"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:background="#ffffff">
android:layout_height="match_parent"
>
<!-- header area -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/header_card"
android:paddingTop="3dip"
android:paddingBottom="3dip"
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" >
<ImageView
android:id="@+id/presence"
android:src="@drawable/presence_inactive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_gravity="center_vertical"
android:background="@drawable/quickcontact_presence_bg" />
<TextView
android:id="@+id/from"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:singleLine="true"
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" />
<TextView
android:id="@+id/date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/to_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_to_label" />
<TextView
android:id="@+id/to"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="false"
android:ellipsize="none" />
<TextView
android:id="@+id/time"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/cc_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_cc_label" />
<TextView
android:id="@+id/cc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:singleLine="false"
android:ellipsize="none" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/subject"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:textStyle="bold"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:singleLine="false"
android:ellipsize="none" />
<!-- TODO: Move this to wherever it really belongs -->
<ImageView
android:id="@+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/btn_star_big_buttonless_off" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/show_pictures_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffefefef"
android:layout_marginTop="6dip"
android:paddingLeft="6dip"
android:paddingRight="3dip"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:baselineAligned="false"
android:visibility="gone">
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondaryInverse"
android:text="@string/message_view_show_pictures_instructions"
android:layout_gravity="center"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/show_pictures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_show_pictures_action" />
</LinearLayout>
<!-- content area -->
<include layout="@layout/message_view_invitation" />
<WebView
android:id="@+id/message_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="#ffffff" />
<!-- attachments area -->
<LinearLayout
android:id="@+id/attachments"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:background="#ffffff">
</LinearLayout>
</LinearLayout>
</merge>
</ScrollView>

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.
@ -23,7 +23,7 @@
<!-- Do Not Translate. Unused string. -->
<string name="account_setup_failed_security_policies_required"></string>
<!-- Do Not Translate. Unused string. -->
<string name="account_folder_list_summary_unread"></string>
<string name="account_folder_list_summary_unread"></string>
<!-- Do Not Translate. Unused string. -->
<string name="account_settings_add_account_label"></string>
<!-- Do Not Translate. Unused string. -->
@ -69,11 +69,11 @@
<!-- Actions will be used as buttons and in menu items -->
<skip />
<!-- Used as part of a multi-step process -->
<string name="next_action">Next</string>
<string name="next_action">Next</string>
<!-- Button name used to confirm acceptance of dialog boxes, warnings, errors, etc. -->
<string name="okay_action">OK</string>
<string name="okay_action">OK</string>
<!-- Button name used to cancel out of dialog boxes -->
<string name="cancel_action">Cancel</string>
<!-- Menu item/button name -->
@ -87,7 +87,7 @@
<!-- Menu item/button name -->
<string name="forward_action">Forward</string>
<!-- Button name used to complete a multi-step process -->
<string name="done_action">Done</string>
<string name="done_action">Done</string>
<!-- Menu item/button name -->
<string name="discard_action">Discard</string>
<!-- Menu item/button name -->
@ -153,10 +153,10 @@
one or more new messages; e.g, "279 unread (someone@google.com)". -->
<plurals name="notification_new_one_account_fmt">
<!-- Case of one new message. -->
<item quantity="one"><xliff:g id="unread_message_count" example="1">%1$d</xliff:g> unread (<xliff:g id="account">%2$s</xliff:g>)</item>
<item quantity="one"><xliff:g id="unread_message_count" example="1">%1$d</xliff:g> unread (<xliff:g id="account">%2$s</xliff:g>)</item>
<!-- Case of "few" (small number of) new messages. -->
<item quantity="few"><xliff:g id="unread_message_count" example="2">%1$d</xliff:g> unread (<xliff:g id="account">%2$s</xliff:g>)</item>
<item quantity="few"><xliff:g id="unread_message_count" example="2">%1$d</xliff:g> unread (<xliff:g id="account">%2$s</xliff:g>)</item>
<!-- Case of a plural number of new messages. -->
<item quantity="other"><xliff:g id="unread_message_count" example="279">%1$d</xliff:g> unread (<xliff:g id="account">%2$s</xliff:g>)</item>
@ -240,7 +240,7 @@
<!-- Hint text in Subject field -->
<string name="message_compose_subject_hint">Subject</string>
<!-- Hint text in Message composer body field -->
<string name="message_compose_body_hint">Compose Mail</string>
<string name="message_compose_body_hint">Compose Mail</string>
<!-- Header for forwarded original messages -->
<string name="message_compose_fwd_header_fmt">\n\n-------- Original Message --------\nSubject: <xliff:g id="subject">%1$s</xliff:g>\nFrom: <xliff:g id="sender">%2$s</xliff:g>\nTo: <xliff:g id="to">%3$s</xliff:g>\nCC: <xliff:g id="cc">%4$s</xliff:g>\n\n</string>
<!-- Header for replied-to messages -->
@ -332,6 +332,11 @@
<item quantity="other"><xliff:g id="size_in_gigabytes" example="279">%d</xliff:g>GB</item>
</plurals>
<!-- Do Not Translate. The label of the next button on the message view screen. -->
<string name="message_view_move_to_newer">&lt;</string>
<!-- Do Not Translate. The label of the previous button on the message view screen. -->
<string name="message_view_move_to_older">&gt;</string>
<!-- Title of screen when setting up new email account -->
<string name="account_setup_basics_title">Set up email</string>
<!-- Title of the screen when adding exchange account -->
@ -437,7 +442,7 @@
<string name="account_setup_incoming_delete_policy_never_label">Never</string>
<!-- "Incoming server settings" screen, options in pop-up menu for Delete email from server: -->
<string name="account_setup_incoming_delete_policy_delete_label">When I delete from Inbox</string>
<!-- "Incoming server settings" screen, label for setting IMAP path prefix: -->
<string name="account_setup_incoming_imap_path_prefix_label">IMAP path prefix</string>
<!-- "Incoming server settings" screen, hint for setting IMAP path prefix: -->
@ -456,7 +461,7 @@
<string name="account_setup_outgoing_username_label">Username</string>
<!-- On "Outgoing server settings" screen, label for text field -->
<string name="account_setup_outgoing_password_label">Password</string>
<!-- Title of "Exchange server settings" screen -->
<string name="account_setup_exchange_title">Server settings</string>
<!-- On "Exchange" setup screen, the name of the server -->
@ -515,19 +520,19 @@
<string name="account_setup_options_mail_window_1month">One month</string>
<!-- "Setup could not finish" dialog text; e.g., Username or password incorrect -->
<string name="account_setup_failed_dlg_auth_message">Username or password incorrect.</string>
<string name="account_setup_failed_dlg_auth_message">Username or password incorrect.</string>
<!-- "Setup could not finish" dialog text; e.g., Username or password incorrect\n(ERR01 Account does not exist) -->
<string name="account_setup_failed_dlg_auth_message_fmt">Username or password incorrect.\n(<xliff:g id="error">%s</xliff:g>)</string>
<string name="account_setup_failed_dlg_auth_message_fmt">Username or password incorrect.\n(<xliff:g id="error">%s</xliff:g>)</string>
<!-- "Setup could not finish" dialog text; e.g., Cannot safely connect to server -->
<string name="account_setup_failed_dlg_certificate_message">Cannot safely connect to server.</string>
<string name="account_setup_failed_dlg_certificate_message">Cannot safely connect to server.</string>
<!-- "Setup could not finish" dialog text; e.g., Cannot safely connect to server\n(TLS Not Supported) -->
<string name="account_setup_failed_dlg_certificate_message_fmt">Cannot safely connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string>
<string name="account_setup_failed_dlg_certificate_message_fmt">Cannot safely connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string>
<!-- "Setup could not finish" dialog text; e.g., Cannot connect to server -->
<string name="account_setup_failed_dlg_server_message">Cannot connect to server.</string>
<string name="account_setup_failed_dlg_server_message">Cannot connect to server.</string>
<!-- "Setup could not finish" dialog text; e.g., Cannot connect to server\n(Connection timed out) -->
<string name="account_setup_failed_dlg_server_message_fmt">Cannot connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string>
<string name="account_setup_failed_dlg_server_message_fmt">Cannot connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string>
<!-- Additional diagnostic text when TLS was required but the server doesn't support it -->
<string name="account_setup_failed_tls_required">TLS required but not supported by server.</string>

View File

@ -0,0 +1,86 @@
/*
* 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.
*/
package com.android.email.activity;
import com.android.email.R;
import com.android.email.Utility;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.net.Uri;
import java.io.File;
/**
* Call to pass a media file to the media scanner service and open it when scanned.
*
* TODO We maight want to set FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET when starting intent, as its
* javadoc suggest. (But seems like Gmail doesn't do that either.)
*/
public class MediaOpener {
private final Activity mActivity;
private final MediaScannerConnection mConnection;
private final File mFile;
private MediaOpener(Activity activity, File file) {
mActivity = activity;
mFile = file;
mConnection = new MediaScannerConnection(mActivity.getApplicationContext(),
new MediaScannerConnectionClient() {
@Override
public void onMediaScannerConnected() {
mConnection.scanFile(mFile.getAbsolutePath(), null);
}
@Override
public void onScanCompleted(String path, Uri uri) {
MediaOpener.this.onScanCompleted(path, uri);
}
});
}
private void start() {
mConnection.connect();
}
private void onScanCompleted(String path, Uri uri) {
try {
if (uri != null) {
mActivity.startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
} catch (ActivityNotFoundException e) {
Utility.showToast(mActivity, R.string.message_view_display_attachment_toast);
// TODO: Add a proper warning message (and lots of upstream cleanup to prevent
// it from happening)
} finally {
mConnection.disconnect();
}
}
/**
* Start scanning a file and opening it when scanned.
*
* @param activity activity used as a parent when starting an intent.
* @param file file to open.
*/
public static void scanAndOpen(Activity activity, File file) {
new MediaOpener(activity, file).start();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff