Commit Graph

135 Commits

Author SHA1 Message Date
Marc Blank 31d9acbf06 Email split, part huit: Refactor constants, clean emailcommon
* There are three pieces to this CL (sorry):
  1) Move and/or rename some constants into emailcommon
  2) Move Utility to emailcommon, moving the few UI
     related utilities back into Email (FolderProperties
     and UiUtilities)
  3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
  the emailcommon static library to compile cleanly

Bug: 3442973

Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
2011-02-14 12:18:10 -08:00
Marc Blank a7bc0319a7 Email split, part six: EmailContent
* Moved EmailContent to emailcommon

Change-Id: Ib3db1bfcfe74554c0e5afd3cfce6d72f26e9aeb9
2011-02-10 19:44:29 -08:00
Makoto Onuki f7b8bc1ed7 Show newer/older in landscape as well, below message list
Now the button area is owned by the 3-pane layout, rather than the message view
fragment.

Bug 3327153

Change-Id: I9c262086c5a001cfe6e81b788c27d05d490c9830
2011-01-11 16:02:19 -08:00
Dianne Hackborn 6c7075fb86 Remove use of old methods.
Change-Id: Ibc686a39cb2c481e6cd57b1d6029979cfd9f5b71
2011-01-08 13:08:04 -08:00
Marc Blank 1b9337ea4f Wireframe email widget
* Formatting and assets are preliminary
* Functionality correct
* Needs cleanup, etc.

Change-Id: I75051df93d233ef529a616c7a9efae403d320bd2
2010-12-01 13:37:57 -08:00
Makoto Onuki 01b7e67f78 Move reply/forward buttons to header
Moved the buttons to the header.  All other buttons below the message view
go away, so I just hid the old buttons.

Also now we stop trying to hide these buttons when entering contextual mode,
which fixes bug 3044284: Message view buttons get disabled when closing
quick contact

Assets were temporarily copied from gmail.

Change-Id: Ib178c6221dfab02832a10d0c0441044e4969fb70
2010-10-05 11:04:10 -07:00
Makoto Onuki 2dbb510657 Hide bottom buttons when message list enters selection mode
Hide the command buttons at the bottom of the message view when the message
list enters the selection mode.

Change-Id: Id825bb5183673e9def055b6480fa180beab51178
2010-09-22 18:00:21 -07:00
Makoto Onuki 0435a0775e Let MessageViewFragment own bottom buttons.
Create a custom view containing the bottons below MVF
(delete, move, reply, etc) and let MVF own this.

These buttons used to be owned by the XL activity itself, because
the UI for these commands will most likely be totally different
from the tablet UI, so the fragment having them looked wrong.

However, this made it harder to make changes suggested by the latest
mock, such as "put reply/forward in the message header".
I think the buttons are semantically part of the message view anyway,
so the fragment owning UI for these commands is probably the way to go.
(And let's worry about the phone UI later.)

Reason for the use of a custom view is that it will make it easier
to make non-trivial UI changes, e.g. "combine reply, reply-all and
forward and make it dropdown."

Also removed obsolete TODOs from MessageListXL.

Change-Id: Ibf93f4c70fe07bdbbe33d2adb6bbd2b96812830d
2010-09-17 14:23:56 -07:00
Makoto Onuki 8f78d57a1f Implement "auto-advance" on two-pane
- Two-pane now respects the auto-advance setting.
- Added another TODO for one-pane.
- Removed unused method.

Change-Id: If2cfb8cc1de04c48cd2f6075bc01bef830425662
2010-09-10 14:40:37 -07:00
Makoto Onuki 0f52e546ef Implement General Preferences
- Removed the place holder setting
- Added "auto-advance" setting, which has "newer",
  "older" (original behavior, default) and "message list"
- Strings were copied from Gmail

This CL has preference change only (i.e. the setting isn't used yet).
The actual implementation will come later.

Change-Id: I9f90a723c67e066fdc536a73490101817a127933
2010-09-09 17:02:02 -07:00
Makoto Onuki 646b5e062e Disable forward/reply for trashed messages.
* Now the message shown/gone callbacks are called directly by
  MessageViewFragment, rather than MessageListXLFragmentManager.

* The buttons are enabled/disabled per messages, so it even works
  properly when you move around in All Starred. (if you ever star
  trashed messages.)

* Fixed one-pane as well.

Bug 2968810

Change-Id: Ie6de1dc7ea0bd18c40c091a6685629c26ffb7110
2010-09-03 10:42:15 -07:00
Makoto Onuki f513fbd8cb Implement UI event handlers.
Implemented
- The bottom buttons for MessageViwe
  Delete, Mark unread, Reply, Reply all, Forward.

- Buttons for exchange invitation
  View in Calender, "Yes", "No", "Maybe"

- Other MessageView events
  onUrlInMessageClicked()
  (Most other methods will probably be deprecated)

- Removed obsolete MailboxListFragment.Callback.onRefresh()

Fixes bug 2926517 minus "the background color of respond buttons
being black" part.

Change-Id: Ie58cbc9fde95a3e67d96846450f77ab58b175a55
2010-08-18 10:57:45 -07:00
Makoto Onuki b6c1ad0f01 Rename MessageViewFragment2
Change-Id: I28e23c0ff18211db999396c5ba1ad9ef898d4515
2010-07-30 15:41:40 -07:00
Makoto Onuki 206d4e842d Split up MessageViewFragment like we did to MessageView.
Break MessageViewFragment up into two fragments, MessageViewFragment, which
is used to show regular messages, and MessageFileViewFragment, which shows
EML messages.  (And their base class, MessageViewFragmentBase.)

MessageViewFragmentBase's javadoc has a class diagram.

MessageViewFragment is actually named MessageViewFragment2 at this point
so that GIT correctly finds out the rename from MessageViewFragment to
MessageViewFragmentBase.  I'll rename it back in a following CL.

Also added very basic unit tests for MessageView and MessageFileView.
At this point, they just make sure the activities really open and show
messages without exceptions.

I feel like the current naming schema for the activities/fragments is
kinda confusing.  Let me know if you come up with better names.

Change-Id: Iff948f4b68cfdb7c1e68f225927b0ce58d34766b
2010-07-30 15:38:53 -07:00
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