2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.activity;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2009-01-19 09:54:05 -05:00
|
|
|
import android.content.res.Configuration;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.BitmapFactory;
|
2010-05-21 11:34:29 -04:00
|
|
|
import android.graphics.Typeface;
|
2009-01-24 13:58:40 -05:00
|
|
|
import android.graphics.drawable.Drawable;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.media.MediaScannerConnection;
|
|
|
|
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Environment;
|
|
|
|
import android.os.Handler;
|
2009-06-06 11:55:26 -04:00
|
|
|
import android.provider.Contacts;
|
|
|
|
import android.provider.Contacts.Intents;
|
2010-05-21 11:34:29 -04:00
|
|
|
import android.text.SpannableString;
|
|
|
|
import android.text.SpannableStringBuilder;
|
|
|
|
import android.text.style.StyleSpan;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.util.Config;
|
|
|
|
import android.util.Log;
|
2010-04-20 12:37:03 -04:00
|
|
|
import android.util.TypedValue;
|
2010-07-05 09:41:52 -04:00
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
2010-07-07 18:14:45 -04:00
|
|
|
import android.view.MotionEvent;
|
2010-07-05 09:41:52 -04:00
|
|
|
import android.view.View;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.view.View.OnClickListener;
|
2010-07-05 09:41:52 -04:00
|
|
|
import android.view.Window;
|
2009-12-09 22:16:42 -05:00
|
|
|
import android.view.animation.AccelerateInterpolator;
|
|
|
|
import android.view.animation.Animation;
|
|
|
|
import android.view.animation.TranslateAnimation;
|
2010-07-05 09:41:52 -04:00
|
|
|
import android.webkit.WebSettings;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import com.fsck.k9.Account;
|
|
|
|
import com.fsck.k9.FontSizes;
|
|
|
|
import com.fsck.k9.K9;
|
|
|
|
import com.fsck.k9.Preferences;
|
|
|
|
import com.fsck.k9.R;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.controller.MessagingController;
|
|
|
|
import com.fsck.k9.controller.MessagingListener;
|
2010-07-05 09:41:52 -04:00
|
|
|
import com.fsck.k9.mail.Address;
|
|
|
|
import com.fsck.k9.mail.Flag;
|
|
|
|
import com.fsck.k9.mail.Message;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.Message.RecipientType;
|
2010-07-05 09:41:52 -04:00
|
|
|
import com.fsck.k9.mail.MessagingException;
|
|
|
|
import com.fsck.k9.mail.Multipart;
|
|
|
|
import com.fsck.k9.mail.Part;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.internet.MimeUtility;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBodyPart;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore.LocalTextBody;
|
|
|
|
import com.fsck.k9.provider.AttachmentProvider;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-04-17 17:28:59 -04:00
|
|
|
public class MessageView extends K9Activity implements OnClickListener
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
|
|
|
|
private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences";
|
2009-12-14 21:50:53 -05:00
|
|
|
private static final String EXTRA_NEXT = "com.fsck.k9.MessageView_next";
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-03-05 02:32:45 -05:00
|
|
|
private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1;
|
|
|
|
private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private TextView mFromView;
|
|
|
|
private TextView mDateView;
|
2009-06-14 10:03:30 -04:00
|
|
|
private TextView mTimeView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private TextView mToView;
|
2009-06-14 10:03:30 -04:00
|
|
|
private TextView mCcView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private TextView mSubjectView;
|
2010-04-25 12:33:32 -04:00
|
|
|
public View chip;
|
2009-11-17 20:59:41 -05:00
|
|
|
private CheckBox mFlagged;
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
private int defaultSubjectColor;
|
2008-11-01 17:32:06 -04:00
|
|
|
private WebView mMessageContentView;
|
|
|
|
private LinearLayout mAttachments;
|
2010-04-26 11:23:57 -04:00
|
|
|
private LinearLayout mCcContainerView;
|
2010-05-21 11:34:29 -04:00
|
|
|
private TextView mAdditionalHeadersView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private View mAttachmentIcon;
|
2010-02-06 09:49:36 -05:00
|
|
|
private View mDownloadingIcon;
|
2008-11-01 17:32:06 -04:00
|
|
|
private View mShowPicturesSection;
|
2009-05-03 00:36:33 -04:00
|
|
|
View next;
|
|
|
|
View next_scrolling;
|
|
|
|
View previous;
|
|
|
|
View previous_scrolling;
|
2010-07-05 09:41:52 -04:00
|
|
|
private View mArchive;
|
|
|
|
private View mMove;
|
|
|
|
private View mSpam;
|
|
|
|
private View mArchiveScrolling;
|
|
|
|
private View mMoveScrolling;
|
|
|
|
private View mSpamScrolling;
|
2010-07-07 18:14:45 -04:00
|
|
|
private ToggleScrollView mToggleScrollView;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private Account mAccount;
|
2010-04-24 10:59:27 -04:00
|
|
|
private MessageReference mMessageReference;
|
|
|
|
private ArrayList<MessageReference> mMessageReferences;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private Message mMessage;
|
2009-11-29 23:03:00 -05:00
|
|
|
|
|
|
|
private static final int PREVIOUS = 1;
|
2009-11-29 23:14:24 -05:00
|
|
|
private static final int NEXT = 2;
|
2009-11-29 23:03:00 -05:00
|
|
|
|
|
|
|
private int mLastDirection = PREVIOUS;
|
|
|
|
|
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
private MessageReference mNextMessage = null;
|
|
|
|
private MessageReference mPreviousMessage = null;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
private Menu optionsMenu = null;
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private Listener mListener = new Listener();
|
|
|
|
private MessageViewHandler mHandler = new MessageViewHandler();
|
|
|
|
|
2010-04-20 12:37:03 -04:00
|
|
|
private FontSizes mFontSizes = K9.getFontSizes();
|
|
|
|
|
2010-05-30 00:17:00 -04:00
|
|
|
/**
|
2010-05-21 11:34:29 -04:00
|
|
|
* Pair class is only available since API Level 5, so we need
|
|
|
|
* this helper class unfortunately
|
|
|
|
*/
|
|
|
|
private class HeaderEntry
|
|
|
|
{
|
|
|
|
public String label;
|
|
|
|
public String value;
|
2010-05-30 00:17:00 -04:00
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
public HeaderEntry(String label, String value)
|
|
|
|
{
|
|
|
|
this.label = label;
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-07 18:14:45 -04:00
|
|
|
@Override
|
|
|
|
public boolean dispatchTouchEvent(MotionEvent ev)
|
|
|
|
{
|
|
|
|
if (ev.getAction() == MotionEvent.ACTION_UP)
|
|
|
|
{
|
|
|
|
// Text selection is finished. Allow scrolling again.
|
|
|
|
mToggleScrollView.setScrolling(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.dispatchTouchEvent(ev);
|
|
|
|
}
|
2009-10-21 20:41:06 -04:00
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean dispatchKeyEvent(KeyEvent event)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
boolean ret = false;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (KeyEvent.ACTION_DOWN == event.getAction())
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
ret = onKeyDown(event.getKeyCode(), event);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ret == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
ret = super.dispatchKeyEvent(event);
|
|
|
|
}
|
|
|
|
return ret;
|
2009-10-21 20:41:06 -04:00
|
|
|
}
|
|
|
|
|
2010-04-17 17:28:59 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
|
|
{
|
|
|
|
switch (keyCode)
|
|
|
|
{
|
2010-07-07 18:14:45 -04:00
|
|
|
case KeyEvent.KEYCODE_SHIFT_LEFT:
|
|
|
|
case KeyEvent.KEYCODE_SHIFT_RIGHT:
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Selecting text started via shift key. Disable scrolling as
|
|
|
|
* this causes problems when selecting text.
|
|
|
|
*/
|
|
|
|
mToggleScrollView.setScrolling(false);
|
|
|
|
break;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
case KeyEvent.KEYCODE_DEL:
|
|
|
|
{
|
|
|
|
onDelete();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_D:
|
|
|
|
{
|
|
|
|
onDelete();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_F:
|
|
|
|
{
|
|
|
|
onForward();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_A:
|
|
|
|
{
|
|
|
|
onReplyAll();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_R:
|
|
|
|
{
|
|
|
|
onReply();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_G:
|
|
|
|
{
|
|
|
|
onFlag();
|
|
|
|
return true;
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
case KeyEvent.KEYCODE_M:
|
|
|
|
{
|
|
|
|
onMove();
|
|
|
|
return true;
|
|
|
|
}
|
2010-07-05 09:41:52 -04:00
|
|
|
case KeyEvent.KEYCODE_S:
|
|
|
|
{
|
|
|
|
onSpam();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_V:
|
|
|
|
{
|
|
|
|
onArchive();
|
|
|
|
return true;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
case KeyEvent.KEYCODE_Y:
|
|
|
|
{
|
|
|
|
onCopy();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_J:
|
|
|
|
case KeyEvent.KEYCODE_P:
|
|
|
|
{
|
2009-12-26 19:54:19 -05:00
|
|
|
onPrevious(K9.isAnimations());
|
2009-11-24 19:40:29 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_N:
|
|
|
|
case KeyEvent.KEYCODE_K:
|
|
|
|
{
|
2009-12-26 19:54:19 -05:00
|
|
|
onNext(K9.isAnimations());
|
2009-11-24 19:40:29 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_Z:
|
|
|
|
{
|
|
|
|
if (event.isShiftPressed())
|
|
|
|
{
|
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
mMessageContentView.zoomIn();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
mMessageContentView.zoomOut();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case KeyEvent.KEYCODE_H:
|
|
|
|
{
|
|
|
|
Toast toast = Toast.makeText(this, R.string.message_help_key, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
|
|
|
return true;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-10-21 20:41:06 -04:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
}
|
2008-12-21 12:44:18 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class MessageViewHandler extends Handler
|
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
public void progress(final boolean progress)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
setProgressBarIndeterminateVisibility(progress);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addAttachment(final View attachmentView)
|
|
|
|
{
|
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
mAttachments.addView(attachmentView);
|
2009-11-24 19:40:29 -05:00
|
|
|
mAttachments.setVisibility(View.VISIBLE);
|
2010-01-03 21:06:40 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAttachmentsEnabled(final boolean enabled)
|
|
|
|
{
|
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++)
|
|
|
|
{
|
|
|
|
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
|
2010-01-03 21:06:40 -05:00
|
|
|
attachment.viewButton.setEnabled(enabled);
|
|
|
|
attachment.downloadButton.setEnabled(enabled);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
2010-01-03 21:06:40 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHeaders(
|
|
|
|
final String subject,
|
|
|
|
final String from,
|
|
|
|
final String date,
|
|
|
|
final String time,
|
|
|
|
final String to,
|
|
|
|
final String cc,
|
2010-04-25 12:33:32 -04:00
|
|
|
final int accountColor,
|
|
|
|
final boolean unread,
|
2010-01-03 21:06:40 -05:00
|
|
|
final boolean hasAttachments,
|
2010-02-06 09:49:36 -05:00
|
|
|
final boolean isDownloading,
|
2010-01-03 21:06:40 -05:00
|
|
|
final boolean flagged,
|
|
|
|
final boolean answered)
|
|
|
|
{
|
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
setTitle(subject);
|
2010-05-01 19:15:59 -04:00
|
|
|
if (subject == null || subject.equals(""))
|
|
|
|
{
|
|
|
|
mSubjectView.setText(getText(R.string.general_no_subject));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mSubjectView.setText(subject);
|
|
|
|
}
|
2010-01-03 21:06:40 -05:00
|
|
|
mFromView.setText(from);
|
|
|
|
if (date != null)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
mDateView.setText(date);
|
2009-11-24 19:40:29 -05:00
|
|
|
mDateView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mDateView.setVisibility(View.GONE);
|
|
|
|
}
|
2010-01-03 21:06:40 -05:00
|
|
|
mTimeView.setText(time);
|
|
|
|
mToView.setText(to);
|
2010-04-26 11:23:57 -04:00
|
|
|
|
2010-04-29 00:59:14 -04:00
|
|
|
mCcContainerView.setVisibility((cc != null && cc.length() > 0)? View.VISIBLE : View.GONE);
|
2010-04-26 11:23:57 -04:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
mCcView.setText(cc);
|
|
|
|
mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
|
2010-02-06 09:49:36 -05:00
|
|
|
mDownloadingIcon.setVisibility(isDownloading ? View.VISIBLE : View.GONE);
|
2010-01-03 21:06:40 -05:00
|
|
|
if (flagged)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
|
|
|
mFlagged.setChecked(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mFlagged.setChecked(false);
|
|
|
|
}
|
|
|
|
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
|
|
|
|
|
2010-04-25 12:33:32 -04:00
|
|
|
chip.setBackgroundColor(accountColor);
|
|
|
|
chip.getBackground().setAlpha(unread ? 255 : 127);
|
2009-11-24 19:40:29 -05:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
if (answered)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
|
|
|
Drawable answeredIcon = getResources().getDrawable(
|
|
|
|
R.drawable.ic_mms_answered_small);
|
|
|
|
mSubjectView.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
|
answeredIcon, // left
|
|
|
|
null, // top
|
|
|
|
null, // right
|
|
|
|
null); // bottom
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mSubjectView.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
|
null, // left
|
|
|
|
null, // top
|
|
|
|
null, // right
|
|
|
|
null); // bottom
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
public void networkError()
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageView.this,
|
|
|
|
R.string.status_network_error, Toast.LENGTH_LONG).show();
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
public void invalidIdError()
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageView.this,
|
|
|
|
R.string.status_invalid_id_error, Toast.LENGTH_LONG).show();
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
public void attachmentSaved(final String filename)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageView.this, String.format(
|
|
|
|
getString(R.string.message_view_status_attachment_saved), filename),
|
|
|
|
Toast.LENGTH_LONG).show();
|
2009-10-19 15:35:31 -04:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void attachmentNotSaved()
|
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
|
|
|
|
Toast.makeText(MessageView.this,
|
|
|
|
getString(R.string.message_view_status_attachment_not_saved),
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void fetchingAttachment()
|
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageView.this,
|
|
|
|
getString(R.string.message_view_fetching_attachment_toast),
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
public void showShowPictures(final boolean show)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-03 21:06:40 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
mShowPicturesSection.setVisibility(show ? View.VISIBLE : View.GONE);
|
|
|
|
}
|
|
|
|
});
|
2008-12-21 12:44:18 -05:00
|
|
|
|
2010-01-03 21:06:40 -05:00
|
|
|
}
|
2008-12-21 12:44:18 -05:00
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
/**
|
|
|
|
* Clear the text field for the additional headers display if they are
|
|
|
|
* not shown, to save UI resources.
|
|
|
|
*/
|
|
|
|
public void hideAdditionalHeaders()
|
|
|
|
{
|
2010-05-30 00:17:00 -04:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
2010-05-21 11:34:29 -04:00
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
mAdditionalHeadersView.setVisibility(View.GONE);
|
|
|
|
mAdditionalHeadersView.setText("");
|
|
|
|
mTopView.scrollTo(0, 0);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up and then show the additional headers view. Called by
|
|
|
|
* {@link #onShowAdditionalHeaders()} and
|
|
|
|
* {@link #setHeaders(Account, String, String, Message)}
|
|
|
|
* (when switching between messages).
|
|
|
|
*/
|
|
|
|
public void showAdditionalHeaders()
|
|
|
|
{
|
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
2010-05-30 00:17:00 -04:00
|
|
|
public void run()
|
2010-05-21 11:34:29 -04:00
|
|
|
{
|
|
|
|
Integer messageToShow = null;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Retrieve additional headers
|
|
|
|
boolean allHeadersDownloaded = mMessage.isSet(Flag.X_GOT_ALL_HEADERS);
|
2010-05-30 00:17:00 -04:00
|
|
|
List<HeaderEntry> additionalHeaders = getAdditionalHeaders(mMessage);
|
2010-05-21 11:34:29 -04:00
|
|
|
|
|
|
|
if (!additionalHeaders.isEmpty())
|
|
|
|
{
|
|
|
|
// Show the additional headers that we have got.
|
2010-05-30 00:17:00 -04:00
|
|
|
setupAdditionalHeadersView(additionalHeaders);
|
2010-05-21 11:34:29 -04:00
|
|
|
mAdditionalHeadersView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!allHeadersDownloaded)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Tell the user about the "save all headers" setting
|
|
|
|
*
|
|
|
|
* NOTE: This is only a temporary solution... in fact,
|
|
|
|
* the system should download headers on-demand when they
|
|
|
|
* have not been saved in their entirety initially.
|
2010-05-30 00:17:00 -04:00
|
|
|
*/
|
2010-05-21 11:34:29 -04:00
|
|
|
messageToShow = R.string.message_additional_headers_not_downloaded;
|
|
|
|
}
|
|
|
|
else if (additionalHeaders.isEmpty())
|
|
|
|
{
|
|
|
|
// All headers have been downloaded, but there are no additional headers.
|
|
|
|
messageToShow = R.string.message_no_additional_headers_available;
|
|
|
|
}
|
|
|
|
}
|
2010-05-30 00:17:00 -04:00
|
|
|
catch (MessagingException e)
|
2010-05-21 11:34:29 -04:00
|
|
|
{
|
|
|
|
messageToShow = R.string.message_additional_headers_retrieval_failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show a message to the user, if any
|
|
|
|
if (messageToShow != null)
|
|
|
|
{
|
|
|
|
Toast toast = Toast.makeText(MessageView.this, messageToShow, Toast.LENGTH_LONG);
|
|
|
|
toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);
|
|
|
|
toast.show();
|
2010-05-30 00:17:00 -04:00
|
|
|
}
|
|
|
|
}
|
2010-05-21 11:34:29 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up the additional headers text view with the supplied header data.
|
2010-05-30 00:17:00 -04:00
|
|
|
*
|
2010-05-21 11:34:29 -04:00
|
|
|
* @param additionalHeaders
|
2010-05-30 00:17:00 -04:00
|
|
|
* List of header entries. Each entry consists of a header
|
|
|
|
* name and a header value. Header names may appear multiple
|
2010-05-21 11:34:29 -04:00
|
|
|
* times.
|
2010-05-30 00:17:00 -04:00
|
|
|
*
|
2010-05-21 11:34:29 -04:00
|
|
|
* This method is always called from within the UI thread by
|
|
|
|
* {@link #showAdditionalHeaders()}.
|
|
|
|
*/
|
|
|
|
private void setupAdditionalHeadersView(final List<HeaderEntry> additionalHeaders)
|
|
|
|
{
|
|
|
|
SpannableStringBuilder sb = new SpannableStringBuilder();
|
|
|
|
boolean first = true;
|
|
|
|
for (HeaderEntry additionalHeader : additionalHeaders)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
{
|
|
|
|
sb.append("\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
|
|
|
|
SpannableString label = new SpannableString(additionalHeader.label + ": ");
|
|
|
|
label.setSpan(boldSpan, 0, label.length(), 0);
|
|
|
|
|
|
|
|
sb.append(label);
|
2010-07-02 10:57:55 -04:00
|
|
|
sb.append(MimeUtility.unfoldAndDecode(additionalHeader.value));
|
2010-05-21 11:34:29 -04:00
|
|
|
}
|
2008-12-21 12:44:18 -05:00
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
mAdditionalHeadersView.setText(sb);
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class Attachment
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
public String name;
|
|
|
|
public String contentType;
|
|
|
|
public long size;
|
|
|
|
public LocalAttachmentBodyPart part;
|
|
|
|
public Button viewButton;
|
|
|
|
public Button downloadButton;
|
|
|
|
public ImageView iconView;
|
|
|
|
}
|
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
public static void actionView(Context context, MessageReference messRef, List<MessageReference> messReferences)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
actionView(context, messRef, messReferences, null);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
public static void actionView(Context context, MessageReference messRef, List<MessageReference> messReferences, Bundle extras)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(context, MessageView.class);
|
2010-04-24 10:59:27 -04:00
|
|
|
i.putExtra(EXTRA_MESSAGE_REFERENCE, messRef);
|
|
|
|
i.putExtra(EXTRA_MESSAGE_REFERENCES, (Serializable)messReferences);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (extras != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
i.putExtras(extras);
|
|
|
|
}
|
|
|
|
context.startActivity(i);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onCreate(Bundle icicle)
|
|
|
|
{
|
2010-05-01 20:10:55 -04:00
|
|
|
super.onCreate(icicle, false);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
2009-11-21 17:45:14 -05:00
|
|
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
setContentView(R.layout.message_view);
|
|
|
|
|
2009-11-27 16:52:48 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mFromView = (TextView)findViewById(R.id.from);
|
|
|
|
mToView = (TextView)findViewById(R.id.to);
|
2009-06-14 10:03:30 -04:00
|
|
|
mCcView = (TextView)findViewById(R.id.cc);
|
2010-04-26 11:23:57 -04:00
|
|
|
mCcContainerView = (LinearLayout)findViewById(R.id.cc_container);
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView = (TextView)findViewById(R.id.subject);
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
mAdditionalHeadersView = (TextView)findViewById(R.id.additional_headers_view);
|
|
|
|
|
2010-04-25 12:33:32 -04:00
|
|
|
chip = findViewById(R.id.chip);
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mDateView = (TextView)findViewById(R.id.date);
|
2009-06-14 10:03:30 -04:00
|
|
|
mTimeView = (TextView)findViewById(R.id.time);
|
2010-07-07 18:14:45 -04:00
|
|
|
mTopView = mToggleScrollView = (ToggleScrollView)findViewById(R.id.top_view);
|
2008-11-01 17:32:06 -04:00
|
|
|
mMessageContentView = (WebView)findViewById(R.id.message_content);
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAttachments = (LinearLayout)findViewById(R.id.attachments);
|
|
|
|
mAttachmentIcon = findViewById(R.id.attachment);
|
2010-02-06 09:49:36 -05:00
|
|
|
mDownloadingIcon = findViewById(R.id.downloading);
|
2008-11-01 17:32:06 -04:00
|
|
|
mShowPicturesSection = findViewById(R.id.show_pictures_section);
|
|
|
|
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
|
2009-11-17 20:59:41 -05:00
|
|
|
mFlagged = (CheckBox)findViewById(R.id.flagged);
|
2009-11-24 19:40:29 -05:00
|
|
|
mFlagged.setOnClickListener(new OnClickListener()
|
|
|
|
{
|
|
|
|
public void onClick(View v)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
onFlag();
|
|
|
|
}
|
2009-11-19 01:03:59 -05:00
|
|
|
});
|
2009-11-17 20:59:41 -05:00
|
|
|
|
2009-11-16 11:42:15 -05:00
|
|
|
mMessageContentView.setVerticalScrollBarEnabled(true);
|
|
|
|
mMessageContentView.setVerticalScrollbarOverlay(true);
|
|
|
|
mMessageContentView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
|
|
|
|
|
|
|
|
final WebSettings webSettings = mMessageContentView.getSettings();
|
|
|
|
|
|
|
|
webSettings.setSupportZoom(true);
|
2009-11-22 16:23:27 -05:00
|
|
|
webSettings.setLoadsImagesAutomatically(true);
|
2009-11-22 16:23:09 -05:00
|
|
|
//webSettings.setBuiltInZoomControls(true);
|
2009-11-16 11:42:15 -05:00
|
|
|
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
|
|
|
|
|
2010-04-20 12:37:03 -04:00
|
|
|
webSettings.setTextSize(mFontSizes.getMessageViewContent());
|
|
|
|
|
|
|
|
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender());
|
|
|
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
|
|
|
((TextView)findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
|
|
|
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
|
|
|
((TextView)findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
|
|
|
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject());
|
|
|
|
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
|
|
|
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
2010-05-21 11:34:29 -04:00
|
|
|
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
|
2010-05-30 00:17:00 -04:00
|
|
|
mAdditionalHeadersView.setVisibility(View.GONE);
|
2008-11-01 17:32:06 -04:00
|
|
|
mAttachments.setVisibility(View.GONE);
|
|
|
|
mAttachmentIcon.setVisibility(View.GONE);
|
|
|
|
|
2009-06-06 11:55:26 -04:00
|
|
|
setOnClickListener(R.id.from);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
setOnClickListener(R.id.reply);
|
2009-01-24 13:58:40 -05:00
|
|
|
setOnClickListener(R.id.reply_all);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
setOnClickListener(R.id.delete);
|
|
|
|
setOnClickListener(R.id.forward);
|
2009-01-24 13:58:40 -05:00
|
|
|
setOnClickListener(R.id.next);
|
|
|
|
setOnClickListener(R.id.previous);
|
2010-07-05 09:41:52 -04:00
|
|
|
setOnClickListener(R.id.archive);
|
|
|
|
setOnClickListener(R.id.move);
|
|
|
|
setOnClickListener(R.id.spam);
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
// To show full header
|
|
|
|
setOnClickListener(R.id.header_container);
|
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
setOnClickListener(R.id.reply_scrolling);
|
2009-11-21 17:45:14 -05:00
|
|
|
// setOnClickListener(R.id.reply_all_scrolling);
|
2009-01-24 13:58:40 -05:00
|
|
|
setOnClickListener(R.id.delete_scrolling);
|
|
|
|
setOnClickListener(R.id.forward_scrolling);
|
|
|
|
setOnClickListener(R.id.next_scrolling);
|
|
|
|
setOnClickListener(R.id.previous_scrolling);
|
2010-07-05 09:41:52 -04:00
|
|
|
setOnClickListener(R.id.archive_scrolling);
|
|
|
|
setOnClickListener(R.id.move_scrolling);
|
|
|
|
setOnClickListener(R.id.spam_scrolling);
|
2009-01-24 13:58:40 -05:00
|
|
|
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
setOnClickListener(R.id.show_pictures);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
setTitle("");
|
|
|
|
|
|
|
|
Intent intent = getIntent();
|
2009-10-19 15:35:31 -04:00
|
|
|
Uri uri = intent.getData();
|
2009-10-22 11:54:49 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (icicle!=null)
|
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference = (MessageReference)icicle.getSerializable(EXTRA_MESSAGE_REFERENCE);
|
|
|
|
mMessageReferences = (ArrayList<MessageReference>)icicle.getSerializable(EXTRA_MESSAGE_REFERENCES);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (uri==null)
|
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference = (MessageReference)intent.getSerializableExtra(EXTRA_MESSAGE_REFERENCE);
|
|
|
|
mMessageReferences = (ArrayList<MessageReference>)intent.getSerializableExtra(EXTRA_MESSAGE_REFERENCES);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-22 11:54:49 -04:00
|
|
|
List<String> segmentList = uri.getPathSegments();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (segmentList.size()==3)
|
|
|
|
{
|
2009-10-22 11:54:49 -04:00
|
|
|
String accountId = segmentList.get(0);
|
|
|
|
Account[] accounts = Preferences.getPreferences(this).getAccounts();
|
|
|
|
boolean found = false;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (Account account : accounts)
|
|
|
|
{
|
|
|
|
if (String.valueOf(account.getAccountNumber()).equals(accountId))
|
|
|
|
{
|
2009-10-22 11:54:49 -04:00
|
|
|
mAccount = account;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!found)
|
|
|
|
{
|
2009-10-22 11:54:49 -04:00
|
|
|
//TODO: Use ressource to externalize message
|
|
|
|
Toast.makeText(this, "Invalid account id: " + accountId, Toast.LENGTH_LONG).show();
|
|
|
|
return;
|
2009-10-19 15:35:31 -04:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference = new MessageReference();
|
|
|
|
mMessageReference.accountUuid = mAccount.getUuid();
|
|
|
|
mMessageReference.folderName = segmentList.get(1);
|
|
|
|
mMessageReference.uid = segmentList.get(2);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReferences = new ArrayList<MessageReference>();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-19 15:35:31 -04:00
|
|
|
//TODO: Use ressource to externalize message
|
2009-10-22 11:54:49 -04:00
|
|
|
Toast.makeText(this, "Invalid intent uri: " + uri.toString(), Toast.LENGTH_LONG).show();
|
2009-10-19 15:35:31 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-24 10:59:27 -04:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "MessageView got message " + mMessageReference);
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-05-03 00:36:33 -04:00
|
|
|
next = findViewById(R.id.next);
|
|
|
|
previous = findViewById(R.id.previous);
|
2009-10-22 11:54:49 -04:00
|
|
|
|
2009-05-03 00:36:33 -04:00
|
|
|
next_scrolling = findViewById(R.id.next_scrolling);
|
|
|
|
previous_scrolling = findViewById(R.id.previous_scrolling);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
mArchive = findViewById(R.id.archive);
|
|
|
|
mMove = findViewById(R.id.move);
|
|
|
|
mSpam = findViewById(R.id.spam);
|
|
|
|
|
|
|
|
mArchiveScrolling = findViewById(R.id.archive_scrolling);
|
|
|
|
mMoveScrolling = findViewById(R.id.move_scrolling);
|
|
|
|
mSpamScrolling = findViewById(R.id.spam_scrolling);
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
boolean goNext = intent.getBooleanExtra(EXTRA_NEXT, false);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (goNext)
|
|
|
|
{
|
2009-01-24 13:58:40 -05:00
|
|
|
next.requestFocus();
|
|
|
|
}
|
2010-04-24 10:59:27 -04:00
|
|
|
// Perhaps the hideButtons should be global, instead of account-specific
|
|
|
|
mAccount = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
2009-01-24 13:58:40 -05:00
|
|
|
Account.HideButtons hideButtons = mAccount.getHideMessageViewButtons();
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-10-22 11:54:49 -04:00
|
|
|
//MessagingController.getInstance(getApplication()).addListener(mListener);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (Account.HideButtons.ALWAYS == hideButtons)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
hideButtons();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (Account.HideButtons.NEVER == hideButtons)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
showButtons();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else // Account.HideButtons.KEYBOARD_AVAIL
|
|
|
|
{
|
2009-01-24 13:58:40 -05:00
|
|
|
final Configuration config = this.getResources().getConfiguration();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
hideButtons();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
showButtons();
|
2009-01-19 09:54:05 -05:00
|
|
|
}
|
|
|
|
}
|
2010-07-05 09:41:52 -04:00
|
|
|
|
|
|
|
Account.HideButtons hideMoveButtons = mAccount.getHideMessageViewMoveButtons();
|
|
|
|
if (Account.HideButtons.ALWAYS == hideMoveButtons)
|
|
|
|
{
|
|
|
|
hideMoveButtons();
|
|
|
|
}
|
|
|
|
else if (Account.HideButtons.NEVER == hideMoveButtons)
|
|
|
|
{
|
|
|
|
showMoveButtons();
|
|
|
|
}
|
|
|
|
else // Account.HideButtons.KEYBOARD_AVAIL
|
|
|
|
{
|
|
|
|
final Configuration config = this.getResources().getConfiguration();
|
|
|
|
if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
|
|
|
|
{
|
|
|
|
hideMoveButtons();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
showMoveButtons();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mAccount.getEnableMoveButtons())
|
|
|
|
{
|
|
|
|
View buttons = findViewById(R.id.move_buttons);
|
|
|
|
if (buttons != null)
|
|
|
|
{
|
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
buttons = findViewById(R.id.scrolling_move_buttons);
|
|
|
|
if (buttons != null)
|
|
|
|
{
|
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
displayMessage(mMessageReference);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2009-05-03 00:36:33 -04:00
|
|
|
|
2009-10-22 11:54:49 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
protected void onSaveInstanceState(Bundle outState)
|
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
outState.putSerializable(EXTRA_MESSAGE_REFERENCE, mMessageReference);
|
|
|
|
outState.putSerializable(EXTRA_MESSAGE_REFERENCES, mMessageReferences);
|
2009-10-22 11:54:49 -04:00
|
|
|
}
|
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
private void displayMessage(MessageReference ref)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference = ref;
|
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
mAccount = Preferences.getPreferences(this).getAccount(ref.accountUuid);
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2009-11-13 02:36:05 -05:00
|
|
|
mMessageContentView.getSettings().setBlockNetworkImage(true);
|
2010-02-07 22:23:41 -05:00
|
|
|
K9.setBlockNetworkLoads(mMessageContentView.getSettings(), true);
|
2009-11-22 16:23:00 -05:00
|
|
|
|
2009-05-03 00:36:33 -04:00
|
|
|
mAttachments.removeAllViews();
|
|
|
|
findSurroundingMessagesUid();
|
2009-11-22 16:23:00 -05:00
|
|
|
|
2010-04-24 10:59:27 -04:00
|
|
|
boolean enableNext = (mNextMessage != null);
|
|
|
|
boolean enablePrev = (mPreviousMessage != null);
|
2010-01-03 21:11:33 -05:00
|
|
|
|
|
|
|
if (next.isEnabled() != enableNext)
|
|
|
|
next.setEnabled(enableNext);
|
|
|
|
if (previous.isEnabled() != enablePrev)
|
|
|
|
previous.setEnabled(enablePrev);
|
|
|
|
|
|
|
|
if (next_scrolling != null && (next_scrolling.isEnabled() != enableNext))
|
|
|
|
next_scrolling.setEnabled(enableNext);
|
|
|
|
if (previous_scrolling != null && (previous_scrolling.isEnabled() != enablePrev))
|
|
|
|
previous_scrolling.setEnabled(enablePrev);
|
2009-07-01 17:31:51 -04:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
// If moving isn't support at all, then all of them must be disabled anyway.
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
|
|
|
|
{
|
|
|
|
mArchive.setEnabled(false);
|
|
|
|
mMove.setEnabled(false);
|
|
|
|
mSpam.setEnabled(false);
|
|
|
|
mArchiveScrolling.setEnabled(false);
|
|
|
|
mMoveScrolling.setEnabled(false);
|
|
|
|
mSpamScrolling.setEnabled(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Only enable the button if the Archive folder is not the current folder and not NONE.
|
|
|
|
boolean enableArchive = !mMessageReference.folderName.equals(mAccount.getArchiveFolderName()) &&
|
|
|
|
!K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getArchiveFolderName());
|
|
|
|
boolean enableMove = true;
|
|
|
|
// Only enable the button if the Spam folder is not the current folder and not NONE.
|
|
|
|
boolean enableSpam = !mMessageReference.folderName.equals(mAccount.getSpamFolderName()) &&
|
|
|
|
!K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName());
|
|
|
|
mArchive.setEnabled(enableArchive);
|
|
|
|
mMove.setEnabled(enableMove);
|
|
|
|
mSpam.setEnabled(enableSpam);
|
|
|
|
mArchiveScrolling.setEnabled(enableArchive);
|
|
|
|
mMoveScrolling.setEnabled(enableMove);
|
|
|
|
mSpamScrolling.setEnabled(enableSpam);
|
|
|
|
}
|
|
|
|
|
2009-09-15 00:28:37 -04:00
|
|
|
MessagingController.getInstance(getApplication()).loadMessageForView(
|
|
|
|
mAccount,
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference.folderName,
|
|
|
|
mMessageReference.uid,
|
2009-09-16 08:31:52 -04:00
|
|
|
mListener);
|
2009-11-22 16:23:00 -05:00
|
|
|
|
|
|
|
mTopView.scrollTo(0, 0);
|
|
|
|
mMessageContentView.scrollTo(0, 0);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void showButtons()
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
View buttons = findViewById(R.id.scrolling_buttons);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (buttons != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
2009-01-24 13:58:40 -05:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void hideButtons()
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
View buttons = findViewById(R.id.bottom_buttons);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (buttons != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
2009-01-24 13:58:40 -05:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
private void showMoveButtons()
|
|
|
|
{
|
|
|
|
View buttons = findViewById(R.id.scrolling_move_buttons);
|
|
|
|
if (buttons != null)
|
|
|
|
{
|
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void hideMoveButtons()
|
|
|
|
{
|
|
|
|
View buttons = findViewById(R.id.move_buttons);
|
|
|
|
if (buttons != null)
|
|
|
|
{
|
|
|
|
buttons.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void setOnClickListener(int viewCode)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
View thisView = findViewById(viewCode);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (thisView != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
thisView.setOnClickListener(this);
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void findSurroundingMessagesUid()
|
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
mNextMessage = mPreviousMessage = null;
|
|
|
|
int i = mMessageReferences.indexOf(mMessageReference);
|
2009-11-21 17:45:14 -05:00
|
|
|
if (i < 0)
|
2009-05-03 00:36:33 -04:00
|
|
|
return;
|
2009-11-21 17:45:14 -05:00
|
|
|
if (i != 0)
|
2010-04-24 10:59:27 -04:00
|
|
|
mNextMessage = mMessageReferences.get(i - 1);
|
|
|
|
if (i != (mMessageReferences.size() - 1))
|
|
|
|
mPreviousMessage = mMessageReferences.get(i + 1);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onResume()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onResume();
|
|
|
|
}
|
2009-10-22 11:54:49 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onDelete()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
Message messageToDelete = mMessage;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-06-20 08:15:29 -04:00
|
|
|
if (K9.messageViewReturnToList())
|
|
|
|
{
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
showNextMessage();
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-29 13:07:34 -05:00
|
|
|
MessagingController.getInstance(getApplication()).deleteMessages(
|
|
|
|
new Message[] { messageToDelete },
|
2009-01-29 08:35:43 -05:00
|
|
|
null);
|
2010-06-14 09:46:08 -04:00
|
|
|
}
|
|
|
|
}
|
2009-11-29 23:03:00 -05:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
private void onArchive()
|
|
|
|
{
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mMessage) == false)
|
|
|
|
{
|
|
|
|
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
String srcFolder = mMessageReference.folderName;
|
|
|
|
String dstFolder = mAccount.getArchiveFolderName();
|
|
|
|
Message messageToMove = mMessage;
|
2010-07-05 14:06:30 -04:00
|
|
|
if (K9.FOLDER_NONE.equalsIgnoreCase(dstFolder))
|
|
|
|
{
|
2010-07-05 09:41:52 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
showNextMessage();
|
|
|
|
MessagingController.getInstance(getApplication())
|
2010-07-06 06:29:26 -04:00
|
|
|
.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
|
2010-07-05 09:41:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private void onSpam()
|
|
|
|
{
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mMessage) == false)
|
|
|
|
{
|
|
|
|
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
String srcFolder = mMessageReference.folderName;
|
|
|
|
String dstFolder = mAccount.getSpamFolderName();
|
|
|
|
Message messageToMove = mMessage;
|
2010-07-05 14:06:30 -04:00
|
|
|
if (K9.FOLDER_NONE.equalsIgnoreCase(dstFolder))
|
|
|
|
{
|
2010-07-05 09:41:52 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
showNextMessage();
|
|
|
|
MessagingController.getInstance(getApplication())
|
2010-07-06 06:29:26 -04:00
|
|
|
.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
|
2010-07-05 09:41:52 -04:00
|
|
|
}
|
|
|
|
|
2010-06-14 09:46:08 -04:00
|
|
|
private void showNextMessage()
|
|
|
|
{
|
|
|
|
findSurroundingMessagesUid();
|
|
|
|
mMessageReferences.remove(mMessageReference);
|
2009-11-29 23:03:00 -05:00
|
|
|
|
2010-06-14 09:46:08 -04:00
|
|
|
if (mLastDirection == NEXT && mNextMessage != null)
|
|
|
|
{
|
|
|
|
onNext(K9.isAnimations());
|
|
|
|
}
|
|
|
|
else if (mLastDirection == PREVIOUS && mPreviousMessage != null)
|
|
|
|
{
|
|
|
|
onPrevious(K9.isAnimations());
|
|
|
|
}
|
|
|
|
else if (mNextMessage != null)
|
|
|
|
{
|
|
|
|
onNext(K9.isAnimations());
|
|
|
|
}
|
|
|
|
else if (mPreviousMessage != null)
|
|
|
|
{
|
|
|
|
onPrevious(K9.isAnimations());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
finish();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
2010-07-05 09:41:52 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onClickSender()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2009-06-06 11:55:26 -04:00
|
|
|
Address senderEmail = mMessage.getFrom()[0];
|
|
|
|
Uri contactUri = Uri.fromParts("mailto", senderEmail.getAddress(), null);
|
|
|
|
|
|
|
|
Intent contactIntent = new Intent(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
|
|
|
|
contactIntent.setData(contactUri);
|
|
|
|
|
|
|
|
// Pass along full E-mail string for possible create dialog
|
|
|
|
contactIntent.putExtra(Contacts.Intents.EXTRA_CREATE_DESCRIPTION,
|
2009-11-21 17:45:14 -05:00
|
|
|
senderEmail.toString());
|
2009-06-06 11:55:26 -04:00
|
|
|
|
|
|
|
// Only provide personal name hint if we have one
|
|
|
|
String senderPersonal = senderEmail.getPersonal();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (senderPersonal != null)
|
|
|
|
{
|
2009-06-06 11:55:26 -04:00
|
|
|
contactIntent.putExtra(Intents.Insert.NAME, senderPersonal);
|
|
|
|
}
|
|
|
|
|
|
|
|
startActivity(contactIntent);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
|
|
|
if (Config.LOGV)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.v(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
|
2009-06-06 11:55:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onReply()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
MessageCompose.actionReply(this, mAccount, mMessage, false);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onReplyAll()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
MessageCompose.actionReply(this, mAccount, mMessage, true);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onForward()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
MessageCompose.actionForward(this, mAccount, mMessage);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onFlag()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-29 11:55:35 -05:00
|
|
|
MessagingController.getInstance(getApplication()).setFlag(mAccount,
|
|
|
|
mMessage.getFolder().getName(), new String[] { mMessage.getUid() }, Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
|
|
|
setHeaders(mAccount, mMessage.getFolder().getName(), mMessage.getUid(), mMessage);
|
2010-05-21 11:34:29 -04:00
|
|
|
prepareMenuItems();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Could not set flag on local message", me);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
|
|
|
}
|
2009-03-05 02:32:45 -05:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onMove()
|
|
|
|
{
|
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
return;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mMessage) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Intent intent = new Intent(this, ChooseFolder.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
|
2010-04-24 10:59:27 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.folderName);
|
2010-07-04 19:29:57 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_SEL_FOLDER, mAccount.getLastSelectedFolderName());
|
2010-05-01 16:06:52 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_MESSAGE, mMessageReference);
|
2009-11-21 17:45:14 -05:00
|
|
|
startActivityForResult(intent, ACTIVITY_CHOOSE_FOLDER_MOVE);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onCopy()
|
|
|
|
{
|
|
|
|
if (MessagingController.getInstance(getApplication()).isCopyCapable(mAccount) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
return;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (MessagingController.getInstance(getApplication()).isCopyCapable(mMessage) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
Toast toast = Toast.makeText(this, R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG);
|
|
|
|
toast.show();
|
|
|
|
return;
|
|
|
|
}
|
2009-03-05 02:32:45 -05:00
|
|
|
Intent intent = new Intent(this, ChooseFolder.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
|
2010-04-24 10:59:27 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.folderName);
|
2010-07-04 19:29:57 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_SEL_FOLDER, mAccount.getLastSelectedFolderName());
|
2010-05-01 16:06:52 -04:00
|
|
|
intent.putExtra(ChooseFolder.EXTRA_MESSAGE, mMessageReference);
|
2009-03-05 02:32:45 -05:00
|
|
|
startActivityForResult(intent, ACTIVITY_CHOOSE_FOLDER_COPY);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
private void onShowAdditionalHeaders()
|
|
|
|
{
|
|
|
|
int currentVisibility = mAdditionalHeadersView.getVisibility();
|
|
|
|
|
|
|
|
if (currentVisibility == View.VISIBLE)
|
|
|
|
{
|
|
|
|
mHandler.hideAdditionalHeaders();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mHandler.showAdditionalHeaders();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private List<HeaderEntry> getAdditionalHeaders(final Message message)
|
2010-05-30 00:17:00 -04:00
|
|
|
throws MessagingException
|
|
|
|
{
|
2010-05-21 11:34:29 -04:00
|
|
|
List<HeaderEntry> additionalHeaders = new LinkedList<HeaderEntry>();
|
|
|
|
|
2010-06-16 15:58:09 -04:00
|
|
|
/*
|
|
|
|
* Remove "Subject" header as it is already shown in the standard
|
|
|
|
* message view header. But do show "From", "To", and "Cc" again.
|
|
|
|
* This time including the email addresses. See issue 1805.
|
|
|
|
*/
|
2010-05-21 11:34:29 -04:00
|
|
|
Set<String> headerNames = new HashSet<String>(message.getHeaderNames());
|
|
|
|
headerNames.remove("Subject");
|
|
|
|
|
|
|
|
for (String headerName : headerNames)
|
|
|
|
{
|
|
|
|
String[] headerValues = message.getHeader(headerName);
|
|
|
|
for (String headerValue : headerValues)
|
|
|
|
{
|
|
|
|
additionalHeaders.add(new HeaderEntry(headerName, headerValue));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return additionalHeaders;
|
|
|
|
}
|
|
|
|
|
2009-11-21 17:45:14 -05:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
if (resultCode != RESULT_OK)
|
|
|
|
return;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
switch (requestCode)
|
|
|
|
{
|
|
|
|
case ACTIVITY_CHOOSE_FOLDER_MOVE:
|
|
|
|
case ACTIVITY_CHOOSE_FOLDER_COPY:
|
|
|
|
if (data == null)
|
|
|
|
return;
|
|
|
|
String destFolderName = data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER);
|
|
|
|
String srcFolderName = data.getStringExtra(ChooseFolder.EXTRA_CUR_FOLDER);
|
2010-05-01 16:06:52 -04:00
|
|
|
MessageReference ref = (MessageReference)data.getSerializableExtra(ChooseFolder.EXTRA_MESSAGE);
|
2009-11-24 19:40:29 -05:00
|
|
|
|
2010-05-01 16:06:52 -04:00
|
|
|
if (mMessageReference.equals(ref))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-07-04 19:29:57 -04:00
|
|
|
mAccount.setLastSelectedFolderName(destFolderName);
|
2009-11-24 19:40:29 -05:00
|
|
|
|
|
|
|
switch (requestCode)
|
|
|
|
{
|
|
|
|
case ACTIVITY_CHOOSE_FOLDER_MOVE:
|
2010-06-14 09:46:08 -04:00
|
|
|
Message messageToMove = mMessage;
|
|
|
|
|
|
|
|
showNextMessage();
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
MessagingController.getInstance(getApplication()).moveMessage(mAccount,
|
2010-06-14 09:46:08 -04:00
|
|
|
srcFolderName, messageToMove, destFolderName, null);
|
2009-11-24 19:40:29 -05:00
|
|
|
break;
|
|
|
|
case ACTIVITY_CHOOSE_FOLDER_COPY:
|
|
|
|
MessagingController.getInstance(getApplication()).copyMessage(mAccount,
|
|
|
|
srcFolderName, mMessage, destFolderName, null);
|
|
|
|
break;
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onSendAlternate()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
MessagingController.getInstance(getApplication()).sendAlternate(this, mAccount, mMessage);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-03-07 18:43:27 -05:00
|
|
|
@Override
|
|
|
|
protected void onNext(boolean animate)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
if (mNextMessage == null)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-05-03 00:36:33 -04:00
|
|
|
Toast.makeText(this, getString(R.string.end_of_folder), Toast.LENGTH_SHORT).show();
|
|
|
|
return;
|
|
|
|
}
|
2009-11-29 23:03:00 -05:00
|
|
|
mLastDirection = NEXT;
|
2009-12-26 13:31:55 -05:00
|
|
|
if (animate)
|
|
|
|
{
|
|
|
|
mTopView.startAnimation(outToLeftAnimation());
|
|
|
|
}
|
2010-04-24 10:59:27 -04:00
|
|
|
displayMessage(mNextMessage);
|
2009-05-03 00:36:33 -04:00
|
|
|
next.requestFocus();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2010-03-07 18:43:27 -05:00
|
|
|
protected void onPrevious(boolean animate)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-04-24 10:59:27 -04:00
|
|
|
if (mPreviousMessage == null)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-05-03 00:36:33 -04:00
|
|
|
Toast.makeText(this, getString(R.string.end_of_folder), Toast.LENGTH_SHORT).show();
|
|
|
|
return;
|
|
|
|
}
|
2009-12-06 19:56:06 -05:00
|
|
|
|
2009-11-29 23:03:00 -05:00
|
|
|
mLastDirection = PREVIOUS;
|
2009-12-26 13:31:55 -05:00
|
|
|
if (animate)
|
|
|
|
{
|
|
|
|
mTopView.startAnimation(inFromRightAnimation());
|
|
|
|
}
|
2010-04-24 10:59:27 -04:00
|
|
|
displayMessage(mPreviousMessage);
|
2009-05-03 00:36:33 -04:00
|
|
|
previous.requestFocus();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onMarkAsUnread()
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-29 11:55:35 -05:00
|
|
|
MessagingController.getInstance(getApplication()).setFlag(
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount,
|
2010-04-24 10:59:27 -04:00
|
|
|
mMessageReference.folderName,
|
2009-11-29 11:55:35 -05:00
|
|
|
new String[] { mMessage.getUid() },
|
|
|
|
Flag.SEEN,
|
2008-11-01 17:32:06 -04:00
|
|
|
false);
|
2010-04-25 12:33:32 -04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
mMessage.setFlag(Flag.SEEN, false);
|
|
|
|
setHeaders(mAccount, mMessage.getFolder().getName(), mMessage.getUid(), mMessage);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Log.e(K9.LOG_TAG, "Unable to unset SEEN flag on message", e);
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a unique file in the given directory by appending a hyphen
|
|
|
|
* and a number to the given filename.
|
|
|
|
* @param directory
|
|
|
|
* @param filename
|
|
|
|
* @return
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
private File createUniqueFile(File directory, String filename)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
File file = new File(directory, filename);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!file.exists())
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return file;
|
|
|
|
}
|
|
|
|
// Get the extension of the file, if any.
|
|
|
|
int index = filename.lastIndexOf('.');
|
|
|
|
String format;
|
2009-11-24 19:40:29 -05:00
|
|
|
if (index != -1)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
String name = filename.substring(0, index);
|
|
|
|
String extension = filename.substring(index);
|
|
|
|
format = name + "-%d" + extension;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
format = filename + "-%d";
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 2; i < Integer.MAX_VALUE; i++)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
file = new File(directory, String.format(format, i));
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!file.exists())
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onDownloadAttachment(Attachment attachment)
|
|
|
|
{
|
|
|
|
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* Abort early if there's no place to save the attachment. We don't want to spend
|
|
|
|
* the time downloading it and then abort.
|
|
|
|
*/
|
|
|
|
Toast.makeText(this,
|
2009-11-21 17:45:14 -05:00
|
|
|
getString(R.string.message_view_status_attachment_not_saved),
|
|
|
|
Toast.LENGTH_SHORT).show();
|
2008-11-01 17:32:06 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
MessagingController.getInstance(getApplication()).loadAttachment(
|
|
|
|
mAccount,
|
|
|
|
mMessage,
|
|
|
|
attachment.part,
|
|
|
|
new Object[] { true, attachment },
|
|
|
|
mListener);
|
2009-02-24 21:32:20 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onViewAttachment(Attachment attachment)
|
|
|
|
{
|
|
|
|
if (mMessage != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
MessagingController.getInstance(getApplication()).loadAttachment(
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount,
|
|
|
|
mMessage,
|
|
|
|
attachment.part,
|
|
|
|
new Object[] { false, attachment },
|
|
|
|
mListener);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onShowPictures()
|
|
|
|
{
|
2010-02-07 22:23:41 -05:00
|
|
|
K9.setBlockNetworkLoads(mMessageContentView.getSettings(), false);
|
2008-11-01 17:32:06 -04:00
|
|
|
mMessageContentView.getSettings().setBlockNetworkImage(false);
|
|
|
|
mShowPicturesSection.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onClick(View view)
|
|
|
|
{
|
|
|
|
switch (view.getId())
|
|
|
|
{
|
|
|
|
case R.id.from:
|
|
|
|
onClickSender();
|
|
|
|
break;
|
|
|
|
case R.id.reply:
|
|
|
|
case R.id.reply_scrolling:
|
|
|
|
onReply();
|
|
|
|
break;
|
|
|
|
case R.id.reply_all:
|
|
|
|
onReplyAll();
|
|
|
|
break;
|
|
|
|
case R.id.delete:
|
|
|
|
case R.id.delete_scrolling:
|
|
|
|
onDelete();
|
|
|
|
break;
|
|
|
|
case R.id.forward:
|
|
|
|
case R.id.forward_scrolling:
|
|
|
|
onForward();
|
|
|
|
break;
|
2010-07-05 09:41:52 -04:00
|
|
|
case R.id.archive:
|
|
|
|
case R.id.archive_scrolling:
|
|
|
|
onArchive();
|
|
|
|
break;
|
|
|
|
case R.id.spam:
|
|
|
|
case R.id.spam_scrolling:
|
|
|
|
onSpam();
|
|
|
|
break;
|
|
|
|
case R.id.move:
|
|
|
|
case R.id.move_scrolling:
|
|
|
|
onMove();
|
|
|
|
break;
|
2009-11-24 19:40:29 -05:00
|
|
|
case R.id.next:
|
|
|
|
case R.id.next_scrolling:
|
2009-12-26 19:54:19 -05:00
|
|
|
onNext(K9.isAnimations());
|
2009-11-24 19:40:29 -05:00
|
|
|
break;
|
|
|
|
case R.id.previous:
|
|
|
|
case R.id.previous_scrolling:
|
2009-12-26 19:54:19 -05:00
|
|
|
onPrevious(K9.isAnimations());
|
2009-11-24 19:40:29 -05:00
|
|
|
break;
|
|
|
|
case R.id.download:
|
|
|
|
onDownloadAttachment((Attachment) view.getTag());
|
|
|
|
break;
|
|
|
|
case R.id.view:
|
|
|
|
onViewAttachment((Attachment) view.getTag());
|
|
|
|
break;
|
|
|
|
case R.id.show_pictures:
|
|
|
|
onShowPictures();
|
|
|
|
break;
|
2010-05-21 11:34:29 -04:00
|
|
|
case R.id.header_container:
|
2010-05-30 00:17:00 -04:00
|
|
|
onShowAdditionalHeaders();
|
|
|
|
break;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onOptionsItemSelected(MenuItem item)
|
|
|
|
{
|
|
|
|
switch (item.getItemId())
|
|
|
|
{
|
|
|
|
case R.id.delete:
|
|
|
|
onDelete();
|
|
|
|
break;
|
|
|
|
case R.id.reply:
|
|
|
|
onReply();
|
|
|
|
break;
|
|
|
|
case R.id.reply_all:
|
|
|
|
onReplyAll();
|
|
|
|
break;
|
|
|
|
case R.id.forward:
|
|
|
|
onForward();
|
|
|
|
break;
|
|
|
|
case R.id.send_alternate:
|
|
|
|
onSendAlternate();
|
|
|
|
break;
|
|
|
|
case R.id.mark_as_unread:
|
|
|
|
onMarkAsUnread();
|
|
|
|
break;
|
|
|
|
case R.id.flag:
|
|
|
|
onFlag();
|
|
|
|
break;
|
2010-07-05 09:41:52 -04:00
|
|
|
case R.id.archive:
|
|
|
|
onArchive();
|
|
|
|
break;
|
|
|
|
case R.id.spam:
|
|
|
|
onSpam();
|
|
|
|
break;
|
2009-11-24 19:40:29 -05:00
|
|
|
case R.id.move:
|
|
|
|
onMove();
|
|
|
|
break;
|
|
|
|
case R.id.copy:
|
|
|
|
onCopy();
|
|
|
|
break;
|
2010-05-21 11:34:29 -04:00
|
|
|
case R.id.show_full_header:
|
|
|
|
onShowAdditionalHeaders();
|
|
|
|
break;
|
2010-07-07 18:14:45 -04:00
|
|
|
case R.id.select_text:
|
|
|
|
emulateShiftHeld(mMessageContentView);
|
|
|
|
break;
|
2009-11-24 19:40:29 -05:00
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-16 14:27:57 -05:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onCreateOptionsMenu(Menu menu)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onCreateOptionsMenu(menu);
|
|
|
|
getMenuInflater().inflate(R.menu.message_view_option, menu);
|
2009-01-24 13:58:40 -05:00
|
|
|
optionsMenu = menu;
|
2010-05-21 11:34:29 -04:00
|
|
|
prepareMenuItems();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (MessagingController.getInstance(getApplication()).isCopyCapable(mAccount) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
menu.findItem(R.id.copy).setVisible(false);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
menu.findItem(R.id.move).setVisible(false);
|
2010-07-05 09:41:52 -04:00
|
|
|
menu.findItem(R.id.archive).setVisible(false);
|
|
|
|
menu.findItem(R.id.spam).setVisible(false);
|
|
|
|
}
|
|
|
|
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getArchiveFolderName()))
|
|
|
|
{
|
|
|
|
menu.findItem(R.id.archive).setVisible(false);
|
|
|
|
}
|
|
|
|
if (K9.FOLDER_NONE.equalsIgnoreCase(mAccount.getSpamFolderName()))
|
|
|
|
{
|
|
|
|
menu.findItem(R.id.spam).setVisible(false);
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
return true;
|
|
|
|
}
|
2009-11-16 14:27:57 -05:00
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onPrepareOptionsMenu(Menu menu)
|
|
|
|
{
|
2010-05-21 11:34:29 -04:00
|
|
|
prepareMenuItems();
|
2009-11-16 14:27:57 -05:00
|
|
|
return super.onPrepareOptionsMenu(menu);
|
|
|
|
}
|
|
|
|
|
2010-05-21 11:34:29 -04:00
|
|
|
private void prepareMenuItems()
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
Menu menu = optionsMenu;
|
2009-11-24 19:40:29 -05:00
|
|
|
if (menu != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
MenuItem flagItem = menu.findItem(R.id.flag);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (flagItem != null && mMessage != null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
flagItem.setTitle((mMessage.isSet(Flag.FLAGGED) ? R.string.unflag_action : R.string.flag_action));
|
|
|
|
}
|
2010-05-21 11:34:29 -04:00
|
|
|
|
|
|
|
MenuItem additionalHeadersItem = menu.findItem(R.id.show_full_header);
|
|
|
|
if (additionalHeadersItem != null)
|
|
|
|
{
|
|
|
|
additionalHeadersItem.setTitle((mAdditionalHeadersView.getVisibility() == View.VISIBLE) ?
|
2010-05-30 00:17:00 -04:00
|
|
|
R.string.hide_full_header_action : R.string.show_full_header_action);
|
2010-05-21 11:34:29 -04:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
}
|
2009-01-24 13:58:40 -05:00
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Bitmap getPreviewIcon(Attachment attachment) throws MessagingException
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return BitmapFactory.decodeStream(
|
2009-11-21 17:45:14 -05:00
|
|
|
getContentResolver().openInputStream(
|
|
|
|
AttachmentProvider.getAttachmentThumbnailUri(mAccount,
|
|
|
|
attachment.part.getAttachmentId(),
|
|
|
|
62,
|
|
|
|
62)));
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* We don't care what happened, we just return null for the preview icon.
|
|
|
|
*/
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Formats the given size as a String in bytes, kB, MB or GB with a single digit
|
|
|
|
* of precision. Ex: 12,315,000 = 12.3 MB
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
public static String formatSize(float size)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
long kb = 1024;
|
|
|
|
long mb = (kb * 1024);
|
|
|
|
long gb = (mb * 1024);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (size < kb)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return String.format("%d bytes", (int) size);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (size < mb)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return String.format("%.1f kB", size / kb);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (size < gb)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return String.format("%.1f MB", size / mb);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return String.format("%.1f GB", size / gb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void renderAttachments(Part part, int depth) throws MessagingException
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
String contentType = MimeUtility.unfoldAndDecode(part.getContentType());
|
2009-01-29 08:35:43 -05:00
|
|
|
String contentDisposition = MimeUtility.unfoldAndDecode(part.getDisposition());
|
2008-11-01 17:32:06 -04:00
|
|
|
String name = MimeUtility.getHeaderParameter(contentType, "name");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (name == null)
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
name = MimeUtility.getHeaderParameter(contentDisposition, "filename");
|
2009-01-29 08:35:43 -05:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (name != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* We're guaranteed size because LocalStore.fetch puts it there.
|
|
|
|
*/
|
|
|
|
int size = Integer.parseInt(MimeUtility.getHeaderParameter(contentDisposition, "size"));
|
|
|
|
|
|
|
|
Attachment attachment = new Attachment();
|
|
|
|
attachment.size = size;
|
2010-01-11 21:06:46 -05:00
|
|
|
String mimeType = part.getMimeType();
|
|
|
|
if (MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE.equals(mimeType))
|
|
|
|
{
|
|
|
|
mimeType = MimeUtility.getMimeTypeByExtension(name);
|
|
|
|
}
|
|
|
|
attachment.contentType = mimeType;
|
2008-11-01 17:32:06 -04:00
|
|
|
attachment.name = name;
|
|
|
|
attachment.part = (LocalAttachmentBodyPart) part;
|
|
|
|
|
|
|
|
LayoutInflater inflater = getLayoutInflater();
|
|
|
|
View view = inflater.inflate(R.layout.message_view_attachment, null);
|
|
|
|
|
|
|
|
TextView attachmentName = (TextView)view.findViewById(R.id.attachment_name);
|
|
|
|
TextView attachmentInfo = (TextView)view.findViewById(R.id.attachment_info);
|
|
|
|
ImageView attachmentIcon = (ImageView)view.findViewById(R.id.attachment_icon);
|
|
|
|
Button attachmentView = (Button)view.findViewById(R.id.view);
|
|
|
|
Button attachmentDownload = (Button)view.findViewById(R.id.download);
|
|
|
|
|
|
|
|
if ((!MimeUtility.mimeTypeMatches(attachment.contentType,
|
2009-12-14 21:50:53 -05:00
|
|
|
K9.ACCEPTABLE_ATTACHMENT_VIEW_TYPES))
|
2008-11-01 17:32:06 -04:00
|
|
|
|| (MimeUtility.mimeTypeMatches(attachment.contentType,
|
2009-12-14 21:50:53 -05:00
|
|
|
K9.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES)))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachmentView.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
if ((!MimeUtility.mimeTypeMatches(attachment.contentType,
|
2009-12-14 21:50:53 -05:00
|
|
|
K9.ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES))
|
2008-11-01 17:32:06 -04:00
|
|
|
|| (MimeUtility.mimeTypeMatches(attachment.contentType,
|
2009-12-14 21:50:53 -05:00
|
|
|
K9.UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES)))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachmentDownload.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
if (attachment.size > K9.MAX_ATTACHMENT_DOWNLOAD_SIZE)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachmentView.setVisibility(View.GONE);
|
|
|
|
attachmentDownload.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
attachment.viewButton = attachmentView;
|
|
|
|
attachment.downloadButton = attachmentDownload;
|
|
|
|
attachment.iconView = attachmentIcon;
|
|
|
|
|
|
|
|
view.setTag(attachment);
|
|
|
|
attachmentView.setOnClickListener(this);
|
|
|
|
attachmentView.setTag(attachment);
|
|
|
|
attachmentDownload.setOnClickListener(this);
|
|
|
|
attachmentDownload.setTag(attachment);
|
|
|
|
|
|
|
|
attachmentName.setText(name);
|
|
|
|
attachmentInfo.setText(formatSize(size));
|
|
|
|
|
|
|
|
Bitmap previewIcon = getPreviewIcon(attachment);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (previewIcon != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachmentIcon.setImageBitmap(previewIcon);
|
|
|
|
}
|
2010-02-16 01:53:02 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
attachmentIcon.setImageResource(R.drawable.attached_image_placeholder);
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
mHandler.addAttachment(view);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part.getBody() instanceof Multipart)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Multipart mp = (Multipart)part.getBody();
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 0; i < mp.getCount(); i++)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
renderAttachments(mp.getBodyPart(i), depth + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
private void setHeaders(Account account, String folder, String uid,
|
2009-11-24 19:40:29 -05:00
|
|
|
final Message message) throws MessagingException
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
String subjectText = message.getSubject();
|
|
|
|
String fromText = Address.toFriendly(message.getFrom());
|
2010-05-01 20:10:55 -04:00
|
|
|
String dateText = getDateFormat().format(message.getSentDate());
|
2009-12-05 08:47:28 -05:00
|
|
|
String timeText = getTimeFormat().format(message.getSentDate());
|
2009-11-21 17:45:14 -05:00
|
|
|
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
|
|
|
|
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
|
2010-05-21 11:34:29 -04:00
|
|
|
|
2010-04-25 12:33:32 -04:00
|
|
|
int color = mAccount.getChipColor();
|
2009-11-21 17:45:14 -05:00
|
|
|
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
|
2010-02-07 01:00:28 -05:00
|
|
|
boolean isDownloading = !message.isSet(Flag.X_DOWNLOADED_FULL);
|
2010-04-25 12:33:32 -04:00
|
|
|
boolean unread = !message.isSet(Flag.SEEN);
|
2010-05-21 11:34:29 -04:00
|
|
|
|
2009-11-21 17:45:14 -05:00
|
|
|
mHandler.setHeaders(subjectText,
|
|
|
|
fromText,
|
|
|
|
dateText,
|
|
|
|
timeText,
|
|
|
|
toText,
|
|
|
|
ccText,
|
2010-04-25 12:33:32 -04:00
|
|
|
color,
|
|
|
|
unread,
|
2009-11-21 17:45:14 -05:00
|
|
|
hasAttachments,
|
2010-02-06 09:49:36 -05:00
|
|
|
isDownloading,
|
2009-11-21 17:45:14 -05:00
|
|
|
message.isSet(Flag.FLAGGED),
|
|
|
|
message.isSet(Flag.ANSWERED));
|
2010-05-21 11:34:29 -04:00
|
|
|
|
|
|
|
// Update additional headers display, if visible
|
|
|
|
if (mAdditionalHeadersView.getVisibility() == View.VISIBLE)
|
|
|
|
{
|
|
|
|
mHandler.showAdditionalHeaders();
|
|
|
|
}
|
2009-01-24 13:58:40 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class Listener extends MessagingListener
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadMessageForViewHeadersAvailable(Account account, String folder, String uid,
|
2009-11-24 19:40:29 -05:00
|
|
|
final Message message)
|
|
|
|
{
|
2010-04-29 00:59:14 -04:00
|
|
|
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|
2010-04-24 10:59:27 -04:00
|
|
|
|| !mMessageReference.accountUuid.equals(account.getUuid()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
MessageView.this.mMessage = message;
|
2010-02-06 09:49:36 -05:00
|
|
|
if (!message.isSet(Flag.X_DOWNLOADED_FULL)
|
2010-04-29 00:59:14 -04:00
|
|
|
&& !message.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
mMessageContentView.loadUrl("file:///android_asset/downloading.html");
|
|
|
|
}
|
2009-10-07 13:23:34 -04:00
|
|
|
});
|
2009-09-17 13:40:05 -04:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2009-01-24 13:58:40 -05:00
|
|
|
setHeaders(account, folder, uid, message);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2010-04-25 12:33:32 -04:00
|
|
|
Log.e(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid,
|
2009-11-24 19:40:29 -05:00
|
|
|
Message message)
|
|
|
|
{
|
2010-04-29 00:59:14 -04:00
|
|
|
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|
2010-04-24 10:59:27 -04:00
|
|
|
|| !mMessageReference.accountUuid.equals(account.getUuid()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-11-21 17:45:14 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2010-02-06 09:49:36 -05:00
|
|
|
if (MessageView.this.mMessage!=null
|
2010-04-29 00:59:14 -04:00
|
|
|
&& MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)
|
|
|
|
&& message.isSet(Flag.X_DOWNLOADED_FULL))
|
2010-02-06 09:49:36 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
setHeaders(account, folder, uid, message);
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageView.this.mMessage = message;
|
|
|
|
|
2009-05-20 00:36:20 -04:00
|
|
|
String text;
|
|
|
|
Part part = MimeUtility.findFirstPartByMimeType(mMessage, "text/html");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part == null)
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
part = MimeUtility.findFirstPartByMimeType(mMessage, "text/plain");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part == null)
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
text = null;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
LocalTextBody body = (LocalTextBody)part.getBody();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (body == null)
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
text = null;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
text = body.getBodyForDisplay();
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
text = MimeUtility.getTextFromPart(part);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (text != null)
|
|
|
|
{
|
2009-05-20 00:36:20 -04:00
|
|
|
/*
|
|
|
|
* TODO this should be smarter, change to regex for img, but consider how to
|
|
|
|
* get background images and a million other things that HTML allows.
|
|
|
|
*/
|
2009-10-07 14:19:56 -04:00
|
|
|
final String emailText = text;
|
2009-11-24 19:40:29 -05:00
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2010-07-07 06:54:50 -04:00
|
|
|
mMessageContentView.loadDataWithBaseURL("http://", emailText, "text/html", "utf-8", null);
|
2009-10-07 14:19:56 -04:00
|
|
|
}
|
|
|
|
});
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
mHandler.showShowPictures(text.contains("<img"));
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
mMessageContentView.loadUrl("file:///android_asset/empty.html");
|
|
|
|
}
|
2009-10-07 14:19:56 -04:00
|
|
|
});
|
2009-05-20 00:36:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
renderAttachments(mMessage, 0);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
if (Config.LOGV)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.v(K9.LOG_TAG, "loadMessageForViewBodyAvailable", e);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
2009-05-20 00:36:20 -04:00
|
|
|
}//loadMessageForViewBodyAvailable
|
2009-05-03 16:52:32 -04:00
|
|
|
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
|
|
|
public void loadMessageForViewFailed(Account account, String folder, String uid,
|
2009-11-24 19:40:29 -05:00
|
|
|
final Throwable t)
|
|
|
|
{
|
2010-04-29 00:59:14 -04:00
|
|
|
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|
2010-04-24 10:59:27 -04:00
|
|
|
|| !mMessageReference.accountUuid.equals(account.getUuid()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
setProgressBarIndeterminateVisibility(false);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (t instanceof IllegalArgumentException)
|
|
|
|
{
|
2009-10-19 15:35:31 -04:00
|
|
|
mHandler.invalidIdError();
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:14 -05:00
|
|
|
mHandler.networkError();
|
2009-10-19 15:35:31 -04:00
|
|
|
}
|
2010-07-10 12:41:48 -04:00
|
|
|
if ((MessageView.this.mMessage == null) ||
|
2010-07-07 21:09:43 -04:00
|
|
|
!MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
2010-02-06 09:49:36 -05:00
|
|
|
{
|
|
|
|
mMessageContentView.loadUrl("file:///android_asset/empty.html");
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadMessageForViewFinished(Account account, String folder, String uid,
|
2009-11-24 19:40:29 -05:00
|
|
|
Message message)
|
|
|
|
{
|
2010-04-29 00:59:14 -04:00
|
|
|
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|
2010-04-24 10:59:27 -04:00
|
|
|
|| !mMessageReference.accountUuid.equals(account.getUuid()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
setProgressBarIndeterminateVisibility(false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void loadMessageForViewStarted(Account account, String folder, String uid)
|
|
|
|
{
|
2010-04-29 00:59:14 -04:00
|
|
|
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|
2010-04-24 10:59:27 -04:00
|
|
|
|| !mMessageReference.accountUuid.equals(account.getUuid()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mMessageContentView.loadUrl("file:///android_asset/loading.html");
|
2009-11-21 17:45:14 -05:00
|
|
|
setProgressBarIndeterminateVisibility(true);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadAttachmentStarted(Account account, Message message,
|
2009-11-24 19:40:29 -05:00
|
|
|
Part part, Object tag, boolean requiresDownload)
|
|
|
|
{
|
|
|
|
if (mMessage!=message)
|
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.setAttachmentsEnabled(false);
|
|
|
|
mHandler.progress(true);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (requiresDownload)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.fetchingAttachment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadAttachmentFinished(Account account, Message message,
|
2009-11-24 19:40:29 -05:00
|
|
|
Part part, Object tag)
|
|
|
|
{
|
|
|
|
if (mMessage!=message)
|
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.setAttachmentsEnabled(true);
|
|
|
|
mHandler.progress(false);
|
|
|
|
|
|
|
|
Object[] params = (Object[]) tag;
|
|
|
|
boolean download = (Boolean) params[0];
|
|
|
|
Attachment attachment = (Attachment) params[1];
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (download)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
File file = createUniqueFile(Environment.getExternalStorageDirectory(),
|
2009-11-21 17:45:14 -05:00
|
|
|
attachment.name);
|
2008-11-01 17:32:06 -04:00
|
|
|
Uri uri = AttachmentProvider.getAttachmentUri(
|
2009-11-21 17:45:14 -05:00
|
|
|
mAccount,
|
|
|
|
attachment.part.getAttachmentId());
|
2008-11-01 17:32:06 -04:00
|
|
|
InputStream in = getContentResolver().openInputStream(uri);
|
|
|
|
OutputStream out = new FileOutputStream(file);
|
|
|
|
IOUtils.copy(in, out);
|
|
|
|
out.flush();
|
|
|
|
out.close();
|
|
|
|
in.close();
|
|
|
|
mHandler.attachmentSaved(file.getName());
|
|
|
|
new MediaScannerNotifier(MessageView.this, file);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (IOException ioe)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.attachmentNotSaved();
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Uri uri = AttachmentProvider.getAttachmentUri(
|
2009-11-21 17:45:14 -05:00
|
|
|
mAccount,
|
|
|
|
attachment.part.getAttachmentId());
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
intent.setData(uri);
|
|
|
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2009-08-29 18:55:14 -04:00
|
|
|
startActivity(intent);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Could not display attachment of type " + attachment.contentType, e);
|
2009-10-21 20:41:06 -04:00
|
|
|
Toast toast = Toast.makeText(MessageView.this, getString(R.string.message_view_no_viewer, attachment.contentType), Toast.LENGTH_LONG);
|
2009-08-29 18:55:14 -04:00
|
|
|
toast.show();
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadAttachmentFailed(Account account, Message message, Part part,
|
2009-11-24 19:40:29 -05:00
|
|
|
Object tag, String reason)
|
|
|
|
{
|
|
|
|
if (mMessage!=message)
|
|
|
|
{
|
2009-07-01 17:31:51 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.setAttachmentsEnabled(true);
|
|
|
|
mHandler.progress(false);
|
|
|
|
mHandler.networkError();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class MediaScannerNotifier implements MediaScannerConnectionClient
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
private MediaScannerConnection mConnection;
|
|
|
|
private File mFile;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public MediaScannerNotifier(Context context, File file)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mFile = file;
|
|
|
|
mConnection = new MediaScannerConnection(context, this);
|
|
|
|
mConnection.connect();
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onMediaScannerConnected()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mConnection.scanFile(mFile.getAbsolutePath(), null);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onScanCompleted(String path, Uri uri)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (uri != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
intent.setData(uri);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mConnection.disconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-03 00:36:33 -04:00
|
|
|
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Animation inFromRightAnimation()
|
|
|
|
{
|
2009-11-22 16:23:36 -05:00
|
|
|
return slideAnimation(0.0f, +1.0f);
|
|
|
|
}
|
2009-11-19 01:03:59 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Animation outToLeftAnimation()
|
|
|
|
{
|
2009-11-22 16:23:36 -05:00
|
|
|
return slideAnimation(0.0f, -1.0f);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Animation slideAnimation(float right, float left)
|
|
|
|
{
|
2009-11-22 16:23:36 -05:00
|
|
|
|
|
|
|
Animation slide = new TranslateAnimation(
|
|
|
|
Animation.RELATIVE_TO_PARENT, right, Animation.RELATIVE_TO_PARENT, left,
|
|
|
|
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
|
|
|
|
);
|
2010-01-13 20:26:09 -05:00
|
|
|
slide.setDuration(125);
|
2009-11-22 16:23:36 -05:00
|
|
|
slide.setFillBefore(true);
|
|
|
|
slide.setInterpolator(new AccelerateInterpolator());
|
|
|
|
return slide;
|
|
|
|
}
|
2010-07-07 18:14:45 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Emulate the shift key being pressed to trigger the text selection mode
|
|
|
|
* of a WebView.
|
|
|
|
*/
|
|
|
|
private void emulateShiftHeld(WebView view)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
mToggleScrollView.setScrolling(false);
|
2010-07-10 12:41:48 -04:00
|
|
|
|
2010-07-07 18:14:45 -04:00
|
|
|
KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
|
2010-07-10 12:41:48 -04:00
|
|
|
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
|
2010-07-07 18:14:45 -04:00
|
|
|
shiftPressEvent.dispatch(view);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Log.e(K9.LOG_TAG, "Exception in emulateShiftHeld()", e);
|
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|