summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2014-08-07 18:41:15 -0700
committerAndrew Sapperstein <asapperstein@google.com>2014-08-07 18:41:15 -0700
commitafaab1752ab5b507cdaad7b3619ffc1c9728368f (patch)
tree4c09a70ab0631654ad89575461eea97d86c32be7 /src
parent455565180998047c4706582da0509b0cb8464e64 (diff)
downloadandroid_packages_apps_UnifiedEmail-afaab1752ab5b507cdaad7b3619ffc1c9728368f.tar.gz
android_packages_apps_UnifiedEmail-afaab1752ab5b507cdaad7b3619ffc1c9728368f.tar.bz2
android_packages_apps_UnifiedEmail-afaab1752ab5b507cdaad7b3619ffc1c9728368f.zip
Remove above attachment promo. b/16138036.
Change-Id: I611f0f7e6eeea0247956e0f1a9f2ec3ec51c9eef
Diffstat (limited to 'src')
-rw-r--r--src/com/android/mail/browse/AttachmentActionHandler.java57
-rw-r--r--src/com/android/mail/browse/ConversationViewAdapter.java20
-rw-r--r--src/com/android/mail/browse/EmlMessageViewFragment.java6
-rw-r--r--src/com/android/mail/browse/MessageAttachmentBar.java2
-rw-r--r--src/com/android/mail/browse/MessageFooterView.java63
-rw-r--r--src/com/android/mail/text/UrlSpan.java45
-rw-r--r--src/com/android/mail/ui/ConversationViewFragment.java32
-rw-r--r--src/com/android/mail/ui/SecureConversationViewController.java27
-rw-r--r--src/com/android/mail/ui/SecureConversationViewFragment.java6
-rw-r--r--src/com/android/mail/utils/StyleUtils.java19
10 files changed, 2 insertions, 275 deletions
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..3408589ab 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;
/**
@@ -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..73f500217 100644
--- a/src/com/android/mail/browse/MessageFooterView.java
+++ b/src/com/android/mail/browse/MessageFooterView.java
@@ -30,7 +30,6 @@ 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;
@@ -42,14 +41,12 @@ 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;
@@ -68,7 +65,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener,
private TextView mTitleText;
private AttachmentTileGrid mAttachmentGrid;
private LinearLayout mAttachmentBarList;
- private View mAboveAttachmentBarListLayout;
private final LayoutInflater mInflater;
@@ -86,12 +82,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
@@ -117,7 +107,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener,
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);
}
@@ -152,7 +141,6 @@ public class MessageFooterView extends LinearLayout implements DetachListener,
mTitleText.setVisibility(View.GONE);
mAttachmentGrid.setVisibility(View.GONE);
mAttachmentBarList.setVisibility(View.GONE);
- hideAboveAttachmentBarListLayout();
}
mOldAttachmentLoaderId = attachmentLoaderId;
@@ -176,25 +164,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()) {
@@ -262,14 +231,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 +329,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/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..ea836e498 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.
@@ -299,23 +291,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.