diff options
21 files changed, 25 insertions, 360 deletions
diff --git a/assets/script.js b/assets/script.js index d56a1f374..c792b0222 100644 --- a/assets/script.js +++ b/assets/script.js @@ -675,11 +675,6 @@ function setMessageHeaderSpacerHeight(messageDomId, spacerHeight) { setSpacerHeight(spacer, spacerHeight); } -function setMessageFooterSpacerHeight(messageDomId, spacerHeight) { - var spacer = document.querySelector("#" + messageDomId + " > .mail-message-footer"); - setSpacerHeight(spacer, spacerHeight); -} - function setSpacerHeight(spacer, spacerHeight) { if (!spacer) { console.log("can't set spacer for message with id: " + messageDomId); diff --git a/res/layout/above_attachment_bar_list_layout.xml b/res/layout/above_attachment_bar_list_layout.xml deleted file mode 100644 index a0bd285b2..000000000 --- a/res/layout/above_attachment_bar_list_layout.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 Google Inc. - Licensed to 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. ---> -<merge />
\ No newline at end of file diff --git a/res/layout/conversation_message_attachment_bar.xml b/res/layout/conversation_message_attachment_bar.xml index 2e7da428d..4fe12c0bd 100644 --- a/res/layout/conversation_message_attachment_bar.xml +++ b/res/layout/conversation_message_attachment_bar.xml @@ -18,7 +18,7 @@ <com.android.mail.browse.MessageAttachmentBar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="8dip" + android:layout_marginBottom="12dp" android:background="@drawable/attachment_bg_holo" android:minHeight="48dip" > diff --git a/res/layout/conversation_message_footer.xml b/res/layout/conversation_message_footer.xml index c2575902f..1e0c6d1c4 100644 --- a/res/layout/conversation_message_footer.xml +++ b/res/layout/conversation_message_footer.xml @@ -37,26 +37,14 @@ android:textSize="14sp" android:visibility="gone" /> - <TextView - android:id="@+id/attachments_header_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:text="@string/attachments_header" - android:visibility="gone" - style="@style/MessageAttachmentsHeaderStyle" /> - <com.android.mail.ui.AttachmentTileGrid android:id="@+id/attachment_tile_grid" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="12dp" android:visibility="gone" style="@style/AttachmentMarginStyle" /> - <include - layout="@layout/above_attachment_bar_list_layout" - android:id="@+id/above_attachment_bar_list_layout"/> - <LinearLayout android:id="@+id/attachment_bar_list" android:layout_width="match_parent" diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml index a611ca654..6b23a069b 100644 --- a/res/values-ldrtl/styles-ldrtl.xml +++ b/res/values-ldrtl/styles-ldrtl.xml @@ -27,10 +27,6 @@ <item name="android:paddingEnd">@dimen/message_details_header_padding_end</item> </style> - <style name="MessageAttachmentsHeaderStyle" parent="AbstractMessageAttachmentsHeaderStyle"> - <item name="android:paddingStart">@dimen/message_details_header_padding_start</item> - </style> - <style name="MessageHeaderShowPicsStyle" parent="AbstractMessageHeaderShowPicsStyle"> <item name="android:paddingStart">@dimen/message_details_header_padding_start_expanded</item> <item name="android:paddingEnd">@dimen/message_show_pics_header_padding_end</item> @@ -58,11 +54,6 @@ <item name="android:paddingEnd">@dimen/undo_text_padding</item> </style> - <style name="ConversationViewPaddingStyle"> - <item name="android:paddingStart">@dimen/conversation_view_margin_side</item> - <item name="android:paddingEnd">@dimen/conversation_view_margin_side</item> - </style> - <style name="MessageHeaderIconStyle"> <item name="android:layout_marginStart">@dimen/message_header_icon_additional_margin_start</item> </style> @@ -104,7 +95,6 @@ <style name="AttachmentMarginStyle"> <item name="android:layout_marginStart">@dimen/attachment_margin_side</item> - <item name="android:layout_marginEnd">@dimen/attachment_margin_side</item> </style> <style name="AttachmentIconStyle"> diff --git a/res/values-sw600dp/constants.xml b/res/values-sw600dp/constants.xml index 228dcd685..fc2939962 100644 --- a/res/values-sw600dp/constants.xml +++ b/res/values-sw600dp/constants.xml @@ -19,7 +19,6 @@ <!-- Boolean value indicating whether the table UI should be used. --> <bool name="use_tablet_ui">true</bool> <integer name="conversation_header_mode">1</integer> - <integer name="conversation_desired_font_size_px">16</integer> <!-- Whether to show single or 2 pane search results --> <bool name="show_two_pane_search_results">false</bool> diff --git a/res/values-sw600dp/dimen.xml b/res/values-sw600dp/dimen.xml index 3934ca91d..5d0fb6b13 100644 --- a/res/values-sw600dp/dimen.xml +++ b/res/values-sw600dp/dimen.xml @@ -36,6 +36,7 @@ Chose to make it larger by 20dp, half of the message_header_icon size. --> <dimen name="super_collapsed_stroke_margin_start">52dp</dimen> + <dimen name="attachment_margin_side">8dp</dimen> <dimen name="attachment_tile_min_size">180dp</dimen> <dimen name="attachment_tile_max_size">254dp</dimen> <dimen name="wait_padding">32dp</dimen> diff --git a/res/values/dimen.xml b/res/values/dimen.xml index 71fca72d7..4a1a34ae3 100644 --- a/res/values/dimen.xml +++ b/res/values/dimen.xml @@ -29,6 +29,7 @@ <dimen name="folders_text_bottom_padding">4dip</dimen> <dimen name="attachment_tile_min_size">120dp</dimen> <dimen name="attachment_tile_max_size">164dp</dimen> + <dimen name="attachment_tile_padding">12dp</dimen> <dimen name="compose_scrollview_max_width">768dp</dimen> <dimen name="color_block_width">32dip</dimen> <dimen name="color_block_height">6dip</dimen> @@ -51,7 +52,6 @@ <dimen name="conversation_folder_padding_after">8dp</dimen> <dimen name="folder_rounded_corner_radius">1dp</dimen> <dimen name="conversation_folder_margin_top">6dp</dimen> - <dimen name="message_details_header_padding_start">16dip</dimen> <dimen name="message_details_header_padding_start_expanded">72dip</dimen> <dimen name="message_details_header_padding_end">16dp</dimen> <dimen name="message_details_header_vertical_padding">7dp</dimen> @@ -122,7 +122,7 @@ <dimen name="undo_text_padding">16dip</dimen> <dimen name="dismiss_separator_padding">16dip</dimen> <dimen name="teaser_text_padding">16dip</dimen> - <dimen name="attachment_margin_side">16dip</dimen> + <dimen name="attachment_margin_side">0dp</dimen> <dimen name="attachment_icon_padding">5dip</dimen> <dimen name="recipient_summary_margin">16dip</dimen> diff --git a/res/values/strings.xml b/res/values/strings.xml index 01b762913..94071d86b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -244,9 +244,6 @@ <string name="saved">Saved, <xliff:g id="size">%s</xliff:g></string> <!-- Displayed in the conversation view. Status of a failed attachment. [CHAR LIMIT=50]--> <string name="download_failed">Couldn\'t download. Touch to retry.</string> - <!-- Displayed in the conversation view, as a header informing - the user that the following is the attachments. [CHAR LIMIT=100] --> - <string name="attachments_header">Attachments</string> <!-- Photo view screen, button name. Save all attachments to sd card. [CHAR LIMIT=17] --> <string name="menu_photo_save_all">Save all</string> <!-- Photo view screen, button name. Share attachment. [CHAR LIMIT=10] --> diff --git a/res/values/styles.xml b/res/values/styles.xml index 27eacbd77..cf6178b8b 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -320,15 +320,6 @@ <item name="android:layout_marginLeft">@dimen/attachment_icon_padding</item> </style> - <style name="AbstractMessageAttachmentsHeaderStyle" parent="MessageHeaderSmallStyle"> - <item name="android:textStyle">bold</item> - <item name="android:textAllCaps">true</item> - </style> - - <style name="MessageAttachmentsHeaderStyle" parent="AbstractMessageAttachmentsHeaderStyle"> - <item name="android:paddingLeft">@dimen/message_details_header_padding_start</item> - </style> - <style name="MessageDetailsValueStyle" parent="MessageHeaderSmallStyle"> <item name="android:autoLink">email</item> <item name="android:linksClickable">true</item> @@ -670,7 +661,6 @@ <style name="AttachmentMarginStyle"> <item name="android:layout_marginLeft">@dimen/attachment_margin_side</item> - <item name="android:layout_marginRight">@dimen/attachment_margin_side</item> </style> <style name="AttachmentIconStyle"> diff --git a/src/com/android/mail/browse/AttachmentActionHandler.java b/src/com/android/mail/browse/AttachmentActionHandler.java index 9d5ec8f25..073de9d05 100644 --- a/src/com/android/mail/browse/AttachmentActionHandler.java +++ b/src/com/android/mail/browse/AttachmentActionHandler.java @@ -29,7 +29,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.os.Parcelable; -import android.view.View; import com.android.mail.providers.Attachment; import com.android.mail.providers.Message; @@ -43,7 +42,6 @@ import com.android.mail.utils.LogUtils; import com.android.mail.utils.Utils; import java.util.ArrayList; -import java.util.List; public class AttachmentActionHandler { private static final String PROGRESS_FRAGMENT_TAG = "attachment-progress"; @@ -267,38 +265,6 @@ public class AttachmentActionHandler { sOptionHandler.handleOption1(mContext, mAccount, mMessage, mAttachment, mFragmentManager); } - public static boolean shouldShowAboveBarAttachmentLayout( - Context context, List<Attachment> attachments) { - return (sOptionHandler != null) && - sOptionHandler.shouldShowAboveBarAttachmentLayout(context, attachments); - } - - public static void setupAboveBarAttachmentLayout(View view) { - if (sOptionHandler != null) { - sOptionHandler.setupAboveBarAttachmentLayout(view); - } - } - - public static void onOverflowOpened(Context context, Attachment attachment) { - if(sOptionHandler != null) { - sOptionHandler.onOverflowOpened(context, attachment); - } - } - - public static void registerDismissListener(Uri conversationUri, - AboveAttachmentLayoutDismissedListener listener) { - if (sOptionHandler != null) { - sOptionHandler.registerDismissListener(conversationUri, listener); - } - } - - public static void unregisterDismissListeners(Uri conversationUri) { - if(sOptionHandler != null) { - sOptionHandler.unregisterDismissListeners(conversationUri); - } - } - - /** * A default, no-op option class. Override this and set it globally with * {@link AttachmentActionHandler#setOptionHandler(OptionHandler)}.<br> @@ -316,28 +282,5 @@ public class AttachmentActionHandler { Attachment attachment, FragmentManager fm) { // no-op } - - public boolean shouldShowAboveBarAttachmentLayout( - Context context, List<Attachment> attachments) { - return false; - } - - public void setupAboveBarAttachmentLayout(View view) { /* no-op */ } - - public void onOverflowOpened(Context context, Attachment attachment) { /* no-op */ } - - public void registerDismissListener(Uri conversationUri, - AboveAttachmentLayoutDismissedListener listener) { - // no-op - } - - public void unregisterDismissListeners(Uri conversationUri) { - // no-op - } } - - public interface AboveAttachmentLayoutDismissedListener { - void onOtherLayoutDismissed(); - } - } diff --git a/src/com/android/mail/browse/ConversationViewAdapter.java b/src/com/android/mail/browse/ConversationViewAdapter.java index f562dd554..b63305d13 100644 --- a/src/com/android/mail/browse/ConversationViewAdapter.java +++ b/src/com/android/mail/browse/ConversationViewAdapter.java @@ -342,8 +342,7 @@ public class ConversationViewAdapter extends BaseAdapter { } } - public static class MessageFooterItem extends ConversationOverlayItem implements - AttachmentActionHandler.AboveAttachmentLayoutDismissedListener { + public static class MessageFooterItem extends ConversationOverlayItem { private final ConversationViewAdapter mAdapter; /** @@ -374,7 +373,7 @@ public class ConversationViewAdapter extends BaseAdapter { @Override public void bindView(View v, boolean measureOnly) { final MessageFooterView attachmentsView = (MessageFooterView) v; - attachmentsView.bind(mHeaderItem, this, measureOnly); + attachmentsView.bind(mHeaderItem, measureOnly); } @Override @@ -407,23 +406,6 @@ public class ConversationViewAdapter extends BaseAdapter { public MessageHeaderItem getHeaderItem() { return mHeaderItem; } - - @Override - public void onOtherLayoutDismissed() { - final MessageFooterView view = mAdapter.mFooterCallbacks.getViewForItem(this); - - // the item has a view, use the normal path - if (view != null) { - view.collapseAboveBarAttachmentsView(); - return; - } - - // the item is offscreen or otherwise doesn't have a view - // just update the HTML - final int newHeight = mAdapter.mFooterCallbacks.getUpdatedHeight(this); - setHeight(newHeight); - mAdapter.mFooterCallbacks.setMessageSpacerHeight(this, newHeight); - } } public class SuperCollapsedBlockItem extends ConversationOverlayItem { diff --git a/src/com/android/mail/browse/EmlMessageViewFragment.java b/src/com/android/mail/browse/EmlMessageViewFragment.java index 2a146f238..306c138c7 100644 --- a/src/com/android/mail/browse/EmlMessageViewFragment.java +++ b/src/com/android/mail/browse/EmlMessageViewFragment.java @@ -187,12 +187,6 @@ public class EmlMessageViewFragment extends Fragment } @Override - public void onDestroyView() { - super.onDestroyView(); - mViewController.onDestroyView(); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (Utils.isRunningKitkatOrLater()) { inflater.inflate(R.menu.eml_fragment_menu, menu); diff --git a/src/com/android/mail/browse/MessageAttachmentBar.java b/src/com/android/mail/browse/MessageAttachmentBar.java index 238768e8c..c7121b2e0 100644 --- a/src/com/android/mail/browse/MessageAttachmentBar.java +++ b/src/com/android/mail/browse/MessageAttachmentBar.java @@ -235,8 +235,6 @@ public class MessageAttachmentBar extends FrameLayout implements OnClickListener menu.findItem(R.id.attachment_extra_option1).setVisible(shouldShowExtraOption1()); mPopup.show(); - - AttachmentActionHandler.onOverflowOpened(getContext(), mAttachment); } } else { // Handles clicking the attachment diff --git a/src/com/android/mail/browse/MessageFooterView.java b/src/com/android/mail/browse/MessageFooterView.java index a8ade0afe..d5b65d776 100644 --- a/src/com/android/mail/browse/MessageFooterView.java +++ b/src/com/android/mail/browse/MessageFooterView.java @@ -30,26 +30,21 @@ import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; import com.android.mail.R; import com.android.mail.analytics.Analytics; import com.android.mail.browse.AttachmentLoader.AttachmentCursor; import com.android.mail.browse.ConversationContainer.DetachListener; -import com.android.mail.browse.ConversationViewAdapter.MessageFooterItem; import com.android.mail.browse.ConversationViewAdapter.MessageHeaderItem; import com.android.mail.providers.Account; import com.android.mail.providers.Attachment; -import com.android.mail.providers.Conversation; import com.android.mail.providers.Message; import com.android.mail.ui.AccountFeedbackActivity; import com.android.mail.ui.AttachmentTile; import com.android.mail.ui.AttachmentTileGrid; import com.android.mail.utils.LogTag; import com.android.mail.utils.LogUtils; -import com.android.mail.utils.Utils; import com.google.common.base.Objects; import com.google.common.collect.Lists; @@ -59,16 +54,13 @@ import java.util.List; public class MessageFooterView extends LinearLayout implements DetachListener, LoaderManager.LoaderCallbacks<Cursor>, View.OnClickListener { - private MessageFooterItem mMessageFooterItem; private MessageHeaderItem mMessageHeaderItem; private LoaderManager mLoaderManager; private FragmentManager mFragmentManager; private AttachmentCursor mAttachmentsCursor; private View mViewEntireMessagePrompt; - private TextView mTitleText; private AttachmentTileGrid mAttachmentGrid; private LinearLayout mAttachmentBarList; - private View mAboveAttachmentBarListLayout; private final LayoutInflater mInflater; @@ -86,12 +78,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener, * Callbacks for the MessageFooterView to enable resizing the height. */ public interface MessageFooterCallbacks { - void setMessageSpacerHeight(MessageFooterItem item, int newSpacerHeight); - - MessageFooterView getViewForItem(MessageFooterItem item); - - int getUpdatedHeight(MessageFooterItem item); - /** * @return <tt>true</tt> if this footer is contained within a SecureConversationViewFragment * and cannot assume the content is <strong>not</strong> malicious @@ -114,10 +100,8 @@ public class MessageFooterView extends LinearLayout implements DetachListener, super.onFinishInflate(); mViewEntireMessagePrompt = findViewById(R.id.view_entire_message_prompt); - mTitleText = (TextView) findViewById(R.id.attachments_header_text); mAttachmentGrid = (AttachmentTileGrid) findViewById(R.id.attachment_tile_grid); mAttachmentBarList = (LinearLayout) findViewById(R.id.attachment_bar_list); - mAboveAttachmentBarListLayout = findViewById(R.id.above_attachment_bar_list_layout); mViewEntireMessagePrompt.setOnClickListener(this); } @@ -131,8 +115,7 @@ public class MessageFooterView extends LinearLayout implements DetachListener, } public void bind( - MessageHeaderItem headerItem, MessageFooterItem footerItem, boolean measureOnly) { - mMessageFooterItem = footerItem; + MessageHeaderItem headerItem, boolean measureOnly) { mMessageHeaderItem = headerItem; final Integer attachmentLoaderId = getAttachmentLoaderId(); @@ -149,10 +132,8 @@ public class MessageFooterView extends LinearLayout implements DetachListener, mAttachmentGrid.removeAllViewsInLayout(); mAttachmentBarList.removeAllViewsInLayout(); mViewEntireMessagePrompt.setVisibility(View.GONE); - mTitleText.setVisibility(View.GONE); mAttachmentGrid.setVisibility(View.GONE); mAttachmentBarList.setVisibility(View.GONE); - hideAboveAttachmentBarListLayout(); } mOldAttachmentLoaderId = attachmentLoaderId; @@ -176,25 +157,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener, setVisibility(mMessageHeaderItem.isExpanded() ? VISIBLE : GONE); } - private void hideAboveAttachmentBarListLayout() { - if (mAboveAttachmentBarListLayout != null) { - mAboveAttachmentBarListLayout.setVisibility(GONE); - } - } - - private void showAboveAttachmentBarListLayout() { - if (mAboveAttachmentBarListLayout != null) { - final Conversation conversation = mMessageHeaderItem.getMessage().getConversation(); - if (conversation == null) { - hideAboveAttachmentBarListLayout(); - return; - } - AttachmentActionHandler.registerDismissListener(conversation.uri, mMessageFooterItem); - mAboveAttachmentBarListLayout.setVisibility(VISIBLE); - AttachmentActionHandler.setupAboveBarAttachmentLayout(mAboveAttachmentBarListLayout); - } - } - private void renderAttachments(boolean loaderResult) { final List<Attachment> attachments; if (mAttachmentsCursor != null && !mAttachmentsCursor.isClosed()) { @@ -241,8 +203,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener, return; } - mTitleText.setVisibility(View.VISIBLE); - if (!tiledAttachments.isEmpty()) { renderTiledAttachments(tiledAttachments, loaderResult); } @@ -262,14 +222,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener, private void renderBarAttachments(List<Attachment> barAttachments, boolean loaderResult) { mAttachmentBarList.setVisibility(View.VISIBLE); - if (!barAttachments.isEmpty() && - AttachmentActionHandler.shouldShowAboveBarAttachmentLayout( - getContext(), barAttachments)) { - showAboveAttachmentBarListLayout(); - } else { - hideAboveAttachmentBarListLayout(); - } - final Account account = getAccount(); for (Attachment attachment : barAttachments) { final Uri id = attachment.getIdentifierUri(); @@ -368,28 +320,4 @@ public class MessageFooterView extends LinearLayout implements DetachListener, private Account getAccount() { return mAccountController != null ? mAccountController.getAccount() : null; } - - public void collapseAboveBarAttachmentsView() { - measureHeight(); - mAboveAttachmentBarListLayout.setVisibility(View.GONE); - updateSpacerHeight(); - } - - private int measureHeight() { - ViewGroup parent = (ViewGroup) getParent(); - if (parent == null) { - LogUtils.e(LOG_TAG, new Error(), "Unable to measure height of detached header"); - return getHeight(); - } - return Utils.measureViewHeight(this, parent); - } - - private void updateSpacerHeight() { - final int h = measureHeight(); - - mMessageFooterItem.setHeight(h); - if (mCallbacks != null) { - mCallbacks.setMessageSpacerHeight(mMessageFooterItem, h); - } - } } diff --git a/src/com/android/mail/text/UrlSpan.java b/src/com/android/mail/text/UrlSpan.java deleted file mode 100644 index 7d7f98949..000000000 --- a/src/com/android/mail/text/UrlSpan.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2014 Google Inc. - * Licensed to 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.mail.text; - -import android.text.TextPaint; -import android.text.style.URLSpan; - -/** - * Extension to URLSpan that does not have underlines. - * Stupid URLSpan.<p/> - * - * WARNING: this span will not work if the TextView it uses - * saves and restores its text since TextView can only save - * and restore {@link android.text.ParcelableSpan}s which - * can only be implemented by framework Spans. - */ -public class UrlSpan extends URLSpan { - public UrlSpan(String url) { - super(url); - } - - /** - * Makes the text in the link color and not underlined. - */ - @Override - public void updateDrawState(TextPaint ds) { - ds.setColor(ds.linkColor); - ds.setUnderlineText(false); - } -} diff --git a/src/com/android/mail/ui/AttachmentTileGrid.java b/src/com/android/mail/ui/AttachmentTileGrid.java index b5fefcc09..5b1e76f95 100644 --- a/src/com/android/mail/ui/AttachmentTileGrid.java +++ b/src/com/android/mail/ui/AttachmentTileGrid.java @@ -18,6 +18,7 @@ package com.android.mail.ui; import android.app.FragmentManager; import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -48,6 +49,7 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview MessageAttachmentTile.PhotoViewHandler { private final LayoutInflater mInflater; private final int mTileMinSize; + private final int mTilePadding; private int mColumnCount; private List<Attachment> mAttachments; private final HashMap<String, AttachmentPreview> mAttachmentPreviews; @@ -58,8 +60,9 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview public AttachmentTileGrid(Context context, AttributeSet attrs) { super(context, attrs); mInflater = LayoutInflater.from(context); - mTileMinSize = context.getResources() - .getDimensionPixelSize(R.dimen.attachment_tile_min_size); + final Resources res = context.getResources(); + mTileMinSize = res.getDimensionPixelSize(R.dimen.attachment_tile_min_size); + mTilePadding = res.getDimensionPixelSize(R.dimen.attachment_tile_padding); mAttachmentPreviews = Maps.newHashMap(); } @@ -150,8 +153,10 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview // Let width = given width. // Let height = image size + bottom padding. - final int imageSize = (width) / mColumnCount; - final int remainder = width - (imageSize * mColumnCount); + final int widthMinusPadding = width - (mColumnCount - 1) * mTilePadding; + + final int imageSize = (widthMinusPadding) / mColumnCount; + final int remainder = widthMinusPadding - (imageSize * mColumnCount); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); @@ -167,7 +172,8 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview // Then multiply by the height of one tile to get the grid height. final int numRows = ((childCount - 1) / mColumnCount) + 1; setMeasuredDimension(width, - numRows*(imageSize + getChildAt(0).getPaddingBottom())); + numRows * (imageSize + getChildAt(0).getPaddingBottom()) + + (numRows - 1) * mTilePadding); } @Override @@ -184,7 +190,7 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview boolean skipBeginningOfRowFirstTime = true; final boolean isRtl = ViewUtils.isViewRtl(this); final int width = getMeasuredWidth(); - int childLeft = (isRtl) ? width - getChildAt(0).getMeasuredWidth() : 0;; + int childLeft = (isRtl) ? width - getChildAt(0).getMeasuredWidth() : 0; int childTop = 0; // Layout the grid. @@ -200,7 +206,7 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview // to reflect the top of the new row. if (!skipBeginningOfRowFirstTime && i % mColumnCount == 0) { childLeft = (isRtl) ? width - childWidth : 0; - childTop += childHeight; + childTop += childHeight + mTilePadding; } else { skipBeginningOfRowFirstTime = false; } @@ -209,9 +215,9 @@ public class AttachmentTileGrid extends FrameLayout implements AttachmentPreview childLeft + childWidth, childTop + childHeight); if (isRtl) { - childLeft -= childWidth; + childLeft -= childWidth - mTilePadding; } else { - childLeft += childWidth; + childLeft += childWidth + mTilePadding; } } } diff --git a/src/com/android/mail/ui/ConversationViewFragment.java b/src/com/android/mail/ui/ConversationViewFragment.java index e0389d806..f5a0cdad7 100644 --- a/src/com/android/mail/ui/ConversationViewFragment.java +++ b/src/com/android/mail/ui/ConversationViewFragment.java @@ -48,7 +48,6 @@ import com.android.mail.FormattedDateBuilder; import com.android.mail.R; import com.android.mail.analytics.Analytics; import com.android.mail.analytics.AnalyticsTimer; -import com.android.mail.browse.AttachmentActionHandler; import com.android.mail.browse.ConversationContainer; import com.android.mail.browse.ConversationContainer.OverlayPosition; import com.android.mail.browse.ConversationFooterView.ConversationFooterCallbacks; @@ -453,10 +452,6 @@ public class ConversationViewFragment extends AbstractConversationViewFragment i public void onDestroyView() { super.onDestroyView(); mConversationContainer.setOverlayAdapter(null); - // AdViewFragment has no conversation and will crash. - if (mConversation != null) { - AttachmentActionHandler.unregisterDismissListeners(mConversation.uri); - } mAdapter = null; resetLoadWaiting(); // be sure to unregister any active load observer mViewsCreated = false; @@ -913,7 +908,7 @@ public class ConversationViewFragment extends AbstractConversationViewFragment i * @param convItem adapter item with data to render and measure * @return height of the rendered view in screen px */ - public int measureOverlayHeight(ConversationOverlayItem convItem) { + private int measureOverlayHeight(ConversationOverlayItem convItem) { final int type = convItem.getType(); final View convertView = mConversationContainer.getScrapView(type); @@ -1620,31 +1615,6 @@ public class ConversationViewFragment extends AbstractConversationViewFragment i mDiff = (expanded ? 1 : -1) * Math.abs(i.getHeight() - heightBefore); } - // START MessageFooterCallbacks - - @Override - public void setMessageSpacerHeight(MessageFooterItem item, int newSpacerHeight) { - mConversationContainer.invalidateSpacerGeometry(); - - // update message HTML spacer height - final int h = mWebView.screenPxToWebPx(newSpacerHeight); - LogUtils.i(LAYOUT_TAG, "setting HTML spacer h=%dwebPx (%dscreenPx)", h, newSpacerHeight); - mWebView.loadUrl(String.format("javascript:setMessageFooterSpacerHeight('%s', %s);", - mTemplates.getMessageDomId(item.getHeaderItem().getMessage()), h)); - } - - @Override - public MessageFooterView getViewForItem(MessageFooterItem item) { - return (MessageFooterView) mConversationContainer.getViewForItem(item); - } - - @Override - public int getUpdatedHeight(MessageFooterItem item) { - return measureOverlayHeight(item); - } - - // END MessageFooterCallbacks - /** * @return {@code true} because either the Print or Print All menu item is shown in GMail */ diff --git a/src/com/android/mail/ui/SecureConversationViewController.java b/src/com/android/mail/ui/SecureConversationViewController.java index ea38e5dff..325ad56ce 100644 --- a/src/com/android/mail/ui/SecureConversationViewController.java +++ b/src/com/android/mail/ui/SecureConversationViewController.java @@ -29,10 +29,8 @@ import android.webkit.WebSettings; import com.android.mail.FormattedDateBuilder; import com.android.mail.R; -import com.android.mail.browse.AttachmentActionHandler; import com.android.mail.browse.ConversationMessage; import com.android.mail.browse.ConversationViewAdapter; -import com.android.mail.browse.ConversationViewAdapter.MessageFooterItem; import com.android.mail.browse.ConversationViewAdapter.MessageHeaderItem; import com.android.mail.browse.ConversationViewHeader; import com.android.mail.browse.InlineAttachmentViewIntentBuilderCreator; @@ -166,12 +164,6 @@ public class SecureConversationViewController implements R.dimen.conversation_message_content_margin_side) / r.getDisplayMetrics().density); } - public void onDestroyView() { - if (mMessage != null && mMessage.getConversation() != null) { - AttachmentActionHandler.unregisterDismissListeners(mMessage.getConversation().uri); - } - } - @Override public void onNotifierScroll(final int y) { // We need to decide whether or not to display the snap header. @@ -222,8 +214,7 @@ public class SecureConversationViewController implements if (mMessage.hasAttachments) { mMessageFooterView.setVisibility(View.VISIBLE); - mMessageFooterView.bind( - item, ConversationViewAdapter.newMessageFooterItem(null, item), false); + mMessageFooterView.bind(item, false); } } @@ -299,23 +290,4 @@ public class SecureConversationViewController implements } // End MessageHeaderViewCallbacks implementations - - // START MessageFooterCallbacks - - @Override - public void setMessageSpacerHeight(MessageFooterItem item, int newSpacerHeight) { - // Do nothing. - } - - @Override - public MessageFooterView getViewForItem(MessageFooterItem item) { - return mMessageFooterView; - } - - @Override - public int getUpdatedHeight(MessageFooterItem item) { - return 0; // should never get called since we'll always have a footer view - } - - // END MessageFooterCallbacks } diff --git a/src/com/android/mail/ui/SecureConversationViewFragment.java b/src/com/android/mail/ui/SecureConversationViewFragment.java index 29b79a7ba..7c4a9d9c6 100644 --- a/src/com/android/mail/ui/SecureConversationViewFragment.java +++ b/src/com/android/mail/ui/SecureConversationViewFragment.java @@ -141,12 +141,6 @@ public class SecureConversationViewFragment extends AbstractConversationViewFrag mViewController.onActivityCreated(savedInstanceState); } - @Override - public void onDestroyView() { - super.onDestroyView(); - mViewController.onDestroyView(); - } - // Start implementations of SecureConversationViewControllerCallbacks @Override diff --git a/src/com/android/mail/utils/StyleUtils.java b/src/com/android/mail/utils/StyleUtils.java index 3943a5b56..622f19e02 100644 --- a/src/com/android/mail/utils/StyleUtils.java +++ b/src/com/android/mail/utils/StyleUtils.java @@ -24,30 +24,11 @@ import android.view.View; import android.widget.TextView; import com.android.mail.text.LinkStyleSpan; -import com.android.mail.text.UrlSpan; /** * Utility class for styling UI. */ public class StyleUtils { - - /** - * Removes any {@link android.text.style.URLSpan}s from the text view - * and replaces them with their non-underline version {@link com.android.mail.text.UrlSpan}. - */ - public static void stripUnderlines(TextView textView) { - final Spannable spannable = (Spannable) textView.getText(); - final URLSpan[] urls = textView.getUrls(); - - for (URLSpan span : urls) { - final int start = spannable.getSpanStart(span); - final int end = spannable.getSpanEnd(span); - spannable.removeSpan(span); - span = new UrlSpan(span.getURL()); - spannable.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - } - } - /** * Removes any {@link android.text.style.URLSpan}s from the text view and replaces them with a * non-underline version {@link LinkStyleSpan} which calls the supplied listener when clicked. |