Commit Graph

121 Commits

Author SHA1 Message Date
Makoto Onuki e105fbe510 Break MessageView into 2 separate activities.
MessageView for regular messages and MessageFileView for EML files.

I'll break down MessageViewFragment too.

Change-Id: Iae66f33d8fb5de58084ab4aef31588e9743c5a18
2010-07-27 15:45:58 -07:00
Makoto Onuki 16a60dca84 Fragmentize MessageView.
This version is hybrid of the old design and what Andy's suggested.
- MessageViewFragment is responsible to show a single message at a time.
- Call MVF.openMessage() to tell it to open another message.
  No need to re-create a new MVF to do this.
- MessageView manages the message list, and handles "move-to-newer/older"
  buttons.

Reason for not re-creating a fragment when opening another message is:
- Re-using the same fragment doesn't make it as complecated/ugly as I
  was initially afraid.
  It's basically cancelling all running tasks, re-initializee some views,
  and load a message.
- We don't have to run MVF.onCreate() over and over again when moving through
  messages.
We may change the strategy later, but I think it's suffice for now.
(Changing this might affect how the back key works, so let's revisit it
when the fragment manager supports back.)

Basically this CL is all about internal changes.
No UI should have changed except for:
- Moved "Move to newer/older" buttons to the bottom.

Also fixes:
Bug: 2849129

Change-Id: I00c05069231afded9d98d3d52dd9a7925ebdee9d
2010-07-19 18:34:40 -07:00
Makoto Onuki de0a1c33c9 Extract MessageListTask and make it self-contained.
Introducing MessageOrderManager which maintains a message list for
MessageView.  It's used to tell if there is newer/older messages
in a mailbox, and the id of them.

Also, slightly related to this, moved mWaitForLoadMessageId to
ControllerResults where it should belong.

Change-Id: I84e32180c7e84a317f2204bb10ad7245ec022dca
2010-07-13 11:26:01 -07:00
Makoto Onuki e60d3648fd Extract presence check logic into its own class.
Change-Id: I12e449ce7f1d10ed4737581e35367eae84a7f29e
2010-07-13 11:19:04 -07:00
Makoto Onuki 7f247d1cd3 Disable MessageViewTests
- These tests will probably not make sense with the upcoming UI change.
- Moved testAttachmentWritePermissions to UtilityUnitTests.
  It's a test for createUniqueFile, which is now owned by Utility.
- Removed Long.MIN_VALUE hack from MessageView.
  New tests should have something better.

Change-Id: I9a09e5e8080a165b010607d1fa3112bcaaab4f90
2010-07-12 16:14:29 -07:00
Makoto Onuki c6886ed3ad Fixing UI for EML files.
For EML,
- No menu
- No older/newer buttons
- No star
- No bottom buttons.

I've started to feel like the two UIs (one for regular messages and the
other for EML files) shouldn't be handled by one class; we probably
should separate them into two different classes.  I'll see if I can
do that after fragmentize it.

Bug 2804147

Change-Id: I5ae162af546bfc21af27352c642d6b2a1e16cf0f
2010-07-02 13:49:47 -07:00
Makoto Onuki 44b5242edd Cleaning up MessageView
- Removed dead code/dead comment.
- Moved static utility methods to Utility.
- Renamed some methods.
- Changed the timing to call super methods.

Also:
- Internationalized formatSize()
- Added unit tests for createUniqueFile() and formatSize()
- createUniqueFile now uses File.createNewFile() instead of exists().

Change-Id: Ibc30e15b029ed5088954bd6fc9032e25dddf176e
2010-07-02 13:26:05 -07:00
Marc Blank 391ae25c43 Handle viewing of attachments that are, themselves, emails
* Add intent filter for application/eml and message/rfc822 mime types,
  launching MessageView with a Uri
* Modify loadMessageTask to handle the Uri by parsing the attachment's
  input stream with Pop3Message.parse(), and then creating an
  EmailProvider message in a special Mailbox created to hold
  "attachment" messages
* Delete all "attachment" messages after the parent message is closed
* Add unit tests

Change-Id: I20276ee006b9f05b889f3c808d3dc407cde26d49
2010-06-22 18:39:18 -07:00
Makoto Onuki 3f545a4060 Controller rework.
- Controller.Result is now a class rather than an interface,
  so subclasses don't have to implement empty methods.

- Replaced Threads with AsyncTasks, which is more light weighted
  because it uses pooled threads.

- Removed the Result argument from Controller's methods.
  These argumetns weren't used, except in serviceCheckMail.

  Regarding serviceCheckMail, the new code behave differenly from the old code.
  If there's already listeners registered when it's colled, they wouldn't get
  called in the old code, but they will in the new code.
  But I think this difference is okay because that's how it works for
  POP/IMAP accounts.

Change-Id: I37a857ce7c089c1a411cb7f1fcfcb72c9f5fd2a6
2010-06-07 16:33:44 -07:00
Makoto Onuki 4a2615e2a5 Remove Handlers from Activities.
AccountFolderList, MessageCompose and MailboxList.

Also,
- ControllerResultUiThreadWrapper now takes a Handler instead of an Activity.
  So that it can be used from a Service as well.

- ControllerResultUiThreadWrapper.getWrappee() to get the wrapped object.
  We'll eventually need this.

- I'll work on MessageList too, but the might be relatively
  large, so I'll do that in a separate CL

Change-Id: I281d88d5af1834248ec3f7463f0df3f5635149be
2010-06-02 16:47:18 -07:00
Makoto Onuki 7e24c6c6f9 Get rid of Handlers and make activities (more) BG thread free.
Part 1: MessageView

- It's an attempt to get rid of Handlers from Activities, and
  reduce the amount of code that runs run a BG thread in them.

- Introduced ResultUiThreadWrapper, which wraps another Controller.Result
  and make callbacks get called on the UI thread.

  - It'll make the logic in ControllerResults cleaner and more straightforward.

  - ResultUiThreadWrapper isn't too memory efficient because it allocates a
    Runnable even if the wrappee's target method is empty.
    However these callbacks don't get called often, and optimizing it would
    make code more complicated, so I don't think it's worth optimizing.

- Now we can assume all the methods in activities except
  AsyncTask.doInBackground runs on the UI thread, with some special exceptions
  like MediaScannerNotifier.
  In my previous abandoned change, I named methods that can run on BG threads
  '*OnUiThread', but now there's no need to do that.

  This also means we can minimize the use of synchronizations.

Change-Id: Ia6d9d2a266ebf5a4b23d712e9eaea3272adbd2a6
2010-05-28 16:02:21 -07:00
Andrew Stadler 80ebde2897 Better handling for untyped attachments
* IMAP/POP rely on sender to set mime type of attachments
* Which doesn't always work, because senders don't always provide it
* Remap using filename extensions, when needed
* This is applied as late as possible - in the MessageView, and in
  the content provider getType().  No changes to how we write databases,
  and no change to existing attachment rows.

Bug: 2356638
Change-Id: Ie69e3fd12f406aac803583f9d1299a8af4fba010
2010-04-30 15:01:10 -07:00
Andrew Stadler 5e354cd1db Exit most activities when accounts are deleted
This resolves cases like this:  You are in the inbox of an Exchange
account.  You click home, settings, accounts & sync, and you delete
the account.  Now re-enter the Email app.  You'll be left in a strangely
empty inbox, for an account that no longer exists.

* Set a flag any time the reconciler deletes an account
* Check that flag in onResume of any activity that depends on the account
    list and could be left in an "empty" state if account(s) are deleted.
* The Activities in which we check it are:
  * AccountFolderList
  * AccountSettings
  * MailboxList
  * MessageCompose
  * MessageList
  * MessageView
* Clear the flag any time we come in through Welcome, which will dispatch
    to other activities properly based on the number of accounts found.

Bug: 2563998
Change-Id: I00fc542581c2bed92d744a4c2e48a88f83737f11
2010-04-14 09:28:04 -07:00
Makoto Onuki f793cd93b9 Set CLEAR_WHEN_TASK_RESET flag when launching Calendar
and Contacts, so that when you relaunch Email from Home, you always see
the Email app, not Calendar/Contacts.

Note as stated in the corresponding bug, this CL itself won't fix the issue,
because CLEAR_WHEN_TASK_RESET will be lost when Contacts/Calendar apps handle
the intent.
There's a feature request against the framework (bug 2586404) which should fix
this losing flag problem.

Bug 2584792

Change-Id: I34ac3707b99926fc07529ea2229f2a6b3c4f93e4
2010-04-12 13:09:56 -07:00
Makoto Onuki 78e06eb894 Fix NPE caused by I34451000
It's unfortunate but some of the fields we cleared in I34451000 are accessed
in BG threads or after the activity is destroyed.  We could add != null checks
everywhere, but it'll be a mess.  I also think it's safer to simply remove
the "= null" lines.

On the other hand, clearing AsyncTasks are relatively safer because they are
kept only so that we can cancel them afterwards, so I kept them.  But let me
know if you want to revert the original CL.

Bug 2570603

Change-Id: I04a10dd7382bfcceb686c3e9af92f8949caf619e
2010-04-08 11:57:26 -07:00
Makoto Onuki 59cf1d05c1 Clear references to inner classes in onDestroy().
Also
- Made inner classes private if possible.
- Made some members final.

Bug 2570603

Change-Id: I34451000f2540c67e1039ea9dc4839dbec5ffab7
2010-04-07 11:54:57 -07:00
Mihai Preda e2c2d81c31 MessageView: on answering invitation move in only one direction.
Bug 2541925

Change-Id: I62b454069f8c20403f15e0b58e597963809f830d
2010-03-31 16:03:46 +02:00
Mihai Preda e281ebc4e2 MessageView: reject early invalid messageId.
Bug 2507898

Change-Id: I13148c49d9ad5ddfcf7a757e11651762fc8d1922
2010-03-17 11:25:26 +01:00
Marc Blank ad809fd744 Send appropriate response email when reply from MessageView
* The code was hard-wired to accept (ancient placehold code)
* Send code that depends on the user's actual response
* Rename inappropriately named method in Controller

Bug: 2515961
Change-Id: I8985a3206fc8c4498521b08806a1093abaf4a42c
2010-03-16 10:48:12 -07:00
Mihai Preda 989552c107 Move parseDateTimeToMillis() to com.android.email.Utility. 2010-03-04 12:45:37 +01:00
Mihai Preda a597b59f46 MessageView: invoke calendar for EAS meeting invitation. 2010-03-03 13:42:24 +01:00
Mihai Preda 777dbe5999 MessageView: use WebView setBlockNetworkLoads().
Instead of setBlockNetworkImage, for security reasons.
Bug 2440315.
2010-03-02 15:13:18 +01:00
Mihai Preda 794f29176d MessageView: EAS calendar meeting invite answer buttons. 2010-02-26 21:12:24 +01:00
Dianne Hackborn 4c868ce21f Update to reflect android-common no longer in framework. 2010-02-25 10:57:59 -08:00
Marc Blank 438dfe64ec Fix visibility of meeting invite controls
* Was checking for any meeting related email
* Changed to look specifically for incoming meeting invites
* Bug noticed during debugging

Change-Id: I8f43d7a506939dbfc0504f96b249e5c17107bf47
2010-02-23 14:44:43 -08:00
Andrew Stadler 643ca675b6 Placeholder invite-accept UI
This is a lightweight placeholder so calendar functionality can be
tested.  Simply presents a message about the invitation, and a set of
yes/maybe/no buttons to click.

The UI is shown whenever the message appears to contain an invite.

There are many elements left to be done here:
TODO: response code (EAS protocol) doesn't seem to work
TODO: use real assets & design
TODO: provide a click-link into calendar event
TODO: show calendar icon in messagelist too
TODO: (if possible) persist user's response in button state?
2010-02-16 22:02:50 -08:00
satok dffe2f486d Make "Message deleted" be plural
Bug: 2264751
2010-02-15 15:31:30 +09:00
Makoto Onuki bb9b5163c1 Move non-exchange specific classes to com.android.email.service. 2010-01-29 10:37:39 -08:00
Marc Blank 5de54008e5 Handle Exchange meeting invitation responses
* Includes some refactoring of internal "request" code in SyncManager
* Adds Message flags to tag meeting invites and cancellations
* Adds meetingResponse method in EmailService
* Hooks into Controller and MessageView UI included

Change-Id: I4c5e10bccc4b41956b94d9dfa55925e5af030939
2010-01-26 09:08:52 -08:00
Mihai Preda af1bf48773 MessageView: upon delete move to older instead of newer.
Bug 2233586
2009-12-22 15:16:14 +01:00
Dan Egnor 2da2e4632d Change android.text.util.Regex to com.android.common.Patterns 2009-11-18 12:11:55 -08:00
Mihai Preda 6bb7c7248a MessageView: disable reply&forward for Trash messages.
Bug 2170118
2009-10-29 14:11:10 +01:00
Mihai Preda 2bc47f24a4 MessageView: use FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET when viewing attachments.
Bug 2180995.
2009-10-13 12:53:16 +02:00
Mihai Preda affa5660e7 MessageView: UI change prev/next arrows.
Bug: 2149187

The prev/next buttons now each extends half the width, and are on black background.
2009-10-09 14:17:49 +02:00
Mihai Preda 73032f4657 Email: exit AsyncTask.onPostExecute() if the result is null or isCancelled().
Bug: 2167479
2009-10-08 11:58:45 +02:00
Andrew Stadler 5b26bbe455 Switch QuickContact presentation from MEDIUM to LARGE.
Bug # http://b/issue?id=2170878
2009-10-07 15:18:13 -07:00
Mihai Preda 1ef86a50f8 MessageView: scroll to (0,0) on message change.
Bug 2156934.
2009-10-06 16:36:44 +02:00
Mihai Preda 2d34c669c1 MessageView: scroll webview to (0,0) on message change.
Bug 2156934.
2009-10-01 13:21:59 +02:00
Evan Millar 82d201b33a FastTrack->QuickContact
Change-Id: I7fc4b053ef86c9bc8374167dc11b1c04934a77bb
2009-09-30 19:49:39 -07:00
Andrew Stadler f9597e71d5 Fix assets & colors for MessageList & MessageView
* change read/unread list bkgnds
* change read/unread list text params
* new checkbox
* new stars

Bugs:http://b/issue?id=2156331 & http://b/issue?id=2156332
2009-09-30 16:18:36 -07:00
Mihai Preda 536f04d3fb MessageView: UI: change prev/next arrows, re-enable notification bar shadow.
Bug: 2149187.
2009-09-30 15:10:17 +02:00
Mihai Preda 7f025a15c4 MessageView: check for null mMessageContentView on access.
Bug 2148358.

It seems that AsyncTask.onPostExecute() can be invoked even after the task
was cancelled, and after Activity.onDestroy().
2009-09-28 16:47:25 +02:00
Dmitri Plotnikov fff989df75 Renaming Presence and Presence-related columns.
Change-Id: Icba02cdb905ae3514ec16bea097167e09bc18a63
2009-09-27 19:46:59 -07:00
Andrew Stadler 9d249df5b8 Add WebViewClient to specialize link-click behaviors.
* If external, set FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
* If mailto: always open the composer

Fixes bugs 1631784 and 2122326
2009-09-27 17:23:46 -07:00
Andrew Stadler ad4ec0590d Fix broken MessageView tests
I'm surprised these were working at all.
2009-09-21 12:59:25 -07:00
Andrew Stadler 8d5004a6eb Modernize the code to load message and body from DB.
* Don't use unneeded managed cursors
* Put more of the DB work in async
* Don't try to load HTML and plaintext simultaneously
* Explicitly catch & handle exceptions during db ops

Bug # 2087051  (see also bug # 2122960 re unexpected db exceptions)

Change-Id: I446086bc4f3a85b2e766b12d1f7271e61e3ae8d5
2009-09-20 10:06:08 -07:00
Andrew Stadler b4626d151c Fix bug that caused Cc field to be displayed when empty.
The IMAP & POP messages are being stored with cc="" instead of null,
which is taken care of by testing the output of toFriendly() instead
of the raw field from the DB.

Change-Id: I9460e7ae098ac5cd0ccd527381ffd4e6d9defae4
2009-09-18 22:54:30 -07:00
Jeff Sharkey 68b620cca0 Switch Email to new FastTrack API.
As part of http://b/2087222 we have a new API specifically
for launching FastTrack.  This allows SHOW_OR_CREATE to be
returned to its original behavior.

I've tested this change and confirmed that it's WAI, and
may have also fixed up some deprecated references.
2009-09-17 23:59:32 -07:00
satok d2174733b1 Auto-sync of stale mailboxes
BUG: 2050116
- auto sync onResume
- add mNonPushMode
-- mNonPushMode is updated in SetFooterTask
2009-09-15 14:38:13 +09:00
Andrew Stadler 6c21942ec4 Implement move-to-trash for IMAP and POP3.
* Define new message-loaded state "FLAG_LOADED_DELETED" (used only for
   POP3, which needs to write sentinel messages that are not displayed.)
* Also renamed the other flags to make the naming more consistent.
* Tweak MessageList query generation to inhibit display of deleted
    message sentinels, and MessagingController won't try to resync them.
* Clean up implementation of Controller.deleteMessage()
* Add support for move to trash to MessagingController.  This operates
    in three primary modes:
  * POP3 local delete (no server-side interaction)
  * POP3 server delete
  * IMAP server delete (and copy to IMAP trash mailbox)
* Add missing implementation in provider to delete all of the attachments
    for a given message
* Fix progress reporting in activities (the test for error vs. progress
    was inverted, which caused progress indicators to keep spinning
    after errors.)
* Fix broken account settings UI (POP3 delete policy was not persisting)

Addresses bug 2097409

TODO delete from trash / empty trash

Change-Id: I00188e6dc2093823106e009f35b68c760227c9e6
2009-09-10 12:44:05 -07:00