Commit Graph

42 Commits

Author SHA1 Message Date
Makoto Onuki ab1674a2d6 Cosmetic changes to MessageView
- Don't show the progress icon unless loading from network
- Don't show the content until LoadAttachmentsTask finishes
- Disable the fade-in animation.  It causes some weird positioning issue
  with the GL accelerated webview.
- Use WebView.clearView() to clear its content.
- Use the "normal" layout mode, otherwise WebView won't use its entire
  width
- Don't hide the vertical scrollbar

Bug 3287729
Bug 3225068
Bug 3295761
Bug 3304396

Change-Id: Ic4b8baac99b71dc0da58021849ff7c1dbd6dbe55
2010-12-21 17:57:16 -08:00
Marc Blank 9c4458dcd7 Don't try to show thumbnail for unloaded attachments
Bug: 3292689
Change-Id: I7575cb891f0b46c4a8564b5d2c4907025d91c639
2010-12-21 12:37:40 -08:00
Makoto Onuki 28d6e09575 Follow-up to the loader API change
This should fix the "attempt to re-open an already-closed object" exception
from SQLite.

(destroy()s don't have @Override becuase the base method is now depricated
and will be removed someday.)

Bug 3288666

Change-Id: I4780f6c8d89c7204b266608462c0833ad5af4e5f
2010-12-17 13:36:51 -08:00
Dianne Hackborn 80769cefb3 Prepare for some changes to LoaderManager/Loader.
Sorry it is a bit ugly, it is to allow this change to be
checked in prior to the first stage of the framework change
without breaking the build.

Change-Id: I1828579019ac0325d19c070a4c62cd79549e7d51
2010-12-16 13:20:39 -08:00
Andy Stadler c1c3b6f21e Use generic contact icon for notifications & messages
* Copies the icon from contacts
* Used whenever the sender doesn't have a local photo
* Used in notifications and in messageview

Bug: 3282187 (notification)
Bug: 3285156 (memory leak from the placeholder graphic)
Change-Id: I528cae20355aa8cce7be37b26f32aa90e092708b
2010-12-15 15:26:30 -08:00
Andy Stadler 05340736da Only show attachments UI for downloadable attachments
Bug: 3286678
Change-Id: Ied64674cbfaef95228d5d3d8c99e5f5989b8a3c0
2010-12-14 20:19:52 -08:00
Makoto Onuki aef9515ee7 Controller.Result callbacks should all have accountId
- Added accountId to loadAttachmentCallback/loadMessageForViewCallback

- Cleaned up LegacyListener/MessagingListener.
  Removed the constructors which take messageId and attachmentId, which
  are used to bridge loadAttachmentProgress, which the callsite doesn't know
  these IDs.  The inconsistency (only loadAttachmentProgress() uses the member
  messageId) doesn't look too good, so extracted this into a separate class,
  MessageRetrievalListenerBridge.

Change-Id: I46303e50df2b0e1fe8616e7c9cef632ac14f23aa
2010-12-10 18:11:44 -08:00
Makoto Onuki 4d02297f4a MessageView: Show progress icon while loading
To avoid flicker.

Bug 3225088

Change-Id: Ic5faea4e6fc810aa751b9f0b9d04537e5dc29970
2010-12-07 14:36:09 -08:00
Makoto Onuki 2ac95b550d Message view: Use system tab style
Bug 3138021

Change-Id: I18ec66966e984a4f2b9e330d0ef14dbca5cce5e3
2010-12-06 16:51:01 -08:00
Makoto Onuki 2201b38fe3 Add error message UI
Show an error message in a yellow bar at the top of the activity.

Bug 3230116

Change-Id: I45dad233c1ab52de365c8caedb4eeff29aefac65
2010-11-29 16:07:38 -08:00
Makoto Onuki b715ea1d76 Fix & cleanup on EML viewer (MessageFileView)
- Fix the XL layout: Don't refer to "GONE" views in RelativeLayout.
- Don't always (re-)load message on onResume().
  This will make it lose all state (e.g. webview's zoom level) when coming
  back from other activities.
- Change the default visibility of some views so that it'll look okay
  while loading the message.
- Remove the use of obsolete fragment APIs.
- And some other minor cleanups...

Bug 3221066

Change-Id: I475bc229f4ea9e0e480f528389f5180e1d63fcd6
2010-11-22 17:02:48 -08:00
Makoto Onuki deda053f7c Fix NPE in MessageViewFragment
Call clearContent() in onDestroy(), instead of cancelAllTasks().
(This is what I thought I was doing.)

Calling clearContent() tells the BG thread that the activity has already
been destroyed, and prevents them from loading a message.

Also as a precaution, don't load a message if getActivity() returns null,
which means the activity has already been destroyed.

Bug 3134403

Change-Id: I0d591e0dd147f73e70b0c027dc8037482197f7b4
2010-11-22 14:29:29 -08:00
Makoto Onuki 4c9e1a3fde Don't reset message view when becoming active again.
- We used to (re-)load the content on every onStart(),
  which is called too when coming back from other actibities.
  So if you go home and come back with the task switcher,
  all state get reset, including webview zoom/pan and the current tab.

- Introduce a new flag, mLoadWhenResumed, to tell if we really need to
  load a message.

Also:
- Start loading a message in onResume() rather than onStart()
  to keep it consistent with other fragments.

Bug 3215269

Change-Id: I1cc6e12c3cc3c08065da3696603a3247f341469a
2010-11-19 15:12:54 -08:00
Makoto Onuki 8e8e371260 Add XL layout for message view
- Added the xl layout
- Cleaned up the existing one

Bug 3138021

Change-Id: Ic6ab5e38c10ac12ffeeb6b12319d1e192ac2a40c
2010-11-17 15:19:00 -08:00
Makoto Onuki 65b1eef31b Message view code change
- Show sender email address
- Show BCC for sent messages
- Don't show the default quick contact badge frame.
  (change QuickContact to ImageView)

Bug 1501239
Bug 3138021

Change-Id: I0e8d91ad3a6a3a021c8aff0945a1ce11d13b2728
2010-11-15 12:03:36 -08:00
Andrew Stadler 997a022c9b Enable zooming in MessageView
Bug: 2282390
Change-Id: Ie5be3c4adb8cc3bef5ccf4fccbfefe8a40872b17
2010-11-03 15:31:08 -07:00
Andrew Stadler ba0b1bbc8d Implement text zoom for Message View
* Add preference for default text size
* Move saveSettings logic into onPreferenceChange handler
* Per user tests, default setting is large (not "normal") for XL devices.
* Use setting in MessageView's WebView

TODO: Investigate zooming header (to/from/subject/etc) as well.

Bug: 2282390
Change-Id: If32ed3626244b046941a461f974b3dbdb535f592
2010-11-02 14:58:24 -07:00
Marc Blank fdc41d4ffc Delay appearance of "stop" button when loading attachments
Bug: 3082804
Change-Id: Ib8b0fcec36a7303b2094bd0e49645d11aa2ff2db
2010-11-01 13:48:53 -07:00
Makoto Onuki 09eb977c06 Fix potential crash in MessageViewFragment.openMessageSync
The problem is that ths method is called in a worker thread, so
there's nothing to prevent it from running just after/at the same
time as clearContent() (which sets -1 to mMessageIdToOpen).
If it does, it passes -1 to restoreMessageWithId() and crashes.

Also removed a half-obsolete comment which is a bit too obvious for its length.

Bug 3077387

Change-Id: I736d696046e6d8964a16c80515544c582aca3943
2010-10-12 16:38:40 -07:00
Makoto Onuki de936b83ac Fix race condition regarding message reload.
The method to start ReloadMessageTask() when detecting content
changed events is delay-called, so need to make sure the fragment
is still in the valid state.

Bug 3069896

Change-Id: I1991d902e8044b4f8ca3ffd7d3e2e66005f1e960
2010-10-06 17:48:48 -07:00
Makoto Onuki f54e08eaee Introduce tabs to view message, attachment and invite separately
Added "tabs" to the message view according to the latset mock.
This removes the necessity of putting a WebView inside a ScrollView,
which caused the infinitely-growing email bug (issue 6882).

Right now the tabs are actually just Buttons.  Complete visual refresh
should follow it.

http://code.google.com/p/android/issues/detail?id=6882
Bug 2349275

Change-Id: I897a3a32e0dd7a90d637ac5ea1d47e5e65a1eabe
2010-10-05 16:53:59 -07:00
Makoto Onuki d058f8abcd Auto-refresh message view
Now MessageViewFragment detects changes made to the current message,
and update the UI.
(Although it doesn't really know if the message is really changed, or just
something else was changed in the DB.  It updates the header regardless.)

Change-Id: I35627c7aff129723b83605fc84521da907078571
2010-10-05 11:11:31 -07:00
Makoto Onuki 61eec98d39 Switch to static fragments
- Now we declare all fragments in the layouts.
- Added clearContent() to MessageList/MessageView to keep them calm when not
  used.  (e.g. MessageView.clearContent() will be called when closing message
  view and going back to the mailbox list+message list screen.)

- Some of the processes have moved from onStop to onPause.
- Now that we don't use the fragment transaction, the "restored fragments"
  has been removed, and the separation between selectXxx() methods and
  updateXxx() methods are gone.

Bug 3045555
Bug 3041502

Change-Id: I958897a8a38bccea1dfed7cfcd900e6dd52d2eed
2010-09-30 11:03:33 -07:00
Makoto Onuki ddfae933da Don't use QuickContactBadge.assignContactFromEmail
* assignContactFromEmail("") was causing the following exception on logcat.
"java.lang.IllegalArgumentException: URI: content://com.android.contacts/data/emails/lookup/,"

* This method is to set the contact to open when the badge is tapped,
  but we trigger quick contact by ourselves, so don't have to do call this.

Bug 3013527

Change-Id: I16e1573bd82ffe5c39d30b69361354010f508f91
2010-09-28 16:32:18 -07:00
Makoto Onuki 250ca15b88 Show MessageList with MessageView, rather than MailboxList
In message view mode, show MessageListFragment on the left pane.

TODO: Highlight opened message on message list
TODO: If the opened message is moved/deleted/starred/etc, update
message view
TODO: Collapsible left pane on portrait

Change-Id: I9b26f7291648da0e08bc526b79305ab65ce4d926
2010-09-22 13:13:59 -07:00
Makoto Onuki 353b75b04b Fix NPE -- check isCancelled in onPostExecute
Bug 3024665

Change-Id: I97c122a6c66a7d4245187961cb90ea874d0e305d
2010-09-22 13:12:13 -07:00
Andrew Stadler 625451ed25 Harden thumbnail creation
* Catch some errors earlier;  Log all errors.

Bug: 2905324
Change-Id: Icdf4ec881f404787a0621e606d7e611d5e50aab1
2010-09-22 09:22:15 -07:00
Makoto Onuki 263ef7ddd4 Small change to MessageViewFragment
resetView() shouldn't kick LoadMessageTask(). (it's not what its name implies)
Added a TODO.

Change-Id: I0523696f3883a905d9732626824efda598bf10ed
2010-09-21 11:25:53 -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
Marc Blank 11d37a7fa9 Check file name before allowing attachment save
Bug: 2992710
Change-Id: I56893366226168669788b78b53bfd3f996dd96cd
2010-09-11 15:34:28 -07:00
Makoto Onuki b1ea9c3c12 Add quick contact badge to MessageView.
- Added "quick contact badge" to MessageView
- Removed PresenceUpdater, and added new implementation based
  on Loader, which is much simpler.
- Changed some text color, so they're visible now.

Bug 2988625

Change-Id: I688a3217178ee8fd0b7245c0ab36a633687ea525
2010-09-09 13:57:31 -07:00
Makoto Onuki 27c6547968 Remove obsolete TODOs
They're all obsolete.
(Fix is already in, change in a different place made it obsolete, etc.)

Change-Id: I04452a973c86d39aca8e89f8883dcf1d7e480dee
2010-09-08 12:14:24 -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 b8efc2d048 Make sure MessageView series don't use mMailboxKey
Because "move" and "delete" are asynchronous operations, Message.mMailboxKey
can change any time.  We can't use stored values.

(Fortunately it was used at only one place, and this was actually unused.)

Change-Id: Idc1300a00122fe0e6372b0374cddc98aa54a47fc
2010-09-02 10:53:47 -07:00
Marc Blank 4dcb1c5fda Fix attachmentExists (recognize mContentBytes)
* Add unit test for attachmentExists

Bug: 2937856
Change-Id: I020f58740618c084676bbf1cdfad3795edb07688
2010-08-25 22:34:22 -07:00
Marc Blank c184f36c2d Revert "Convert Controller to a full service"
This reverts commit 0e6d972641.

Change-Id: I005fc34152396806468edef919a3620961ddb4fe
2010-08-24 10:27:58 -07:00
Marc Blank 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Marc Blank 09fd4d0a18 New asynchronous attachment loading code
* Create AttachmentDownloadService to manage all attachment downloads
  1) User requested
  2) Required for email forwarding
  3) Opportunistic downloads to enhance offline use
* New attachment related UI (pending UX approval, of course)
  1) MessageView (attachment actions, progress bar, etc.)
  2) MessageCompose (attachments for forwarded messages)
  3) Associated toasts, notifications, etc.

TODO:
* Unit tests
* Cache Management (separate CL)

Change-Id: I7864a5fb1c3f4f2be68d98341a971edc6cbacfe1
2010-08-19 14:01:08 -07:00
Makoto Onuki 21efedb67f Rework/cleanup of "refresh".
Added RefreshManager, which is responsible for getting refresh requests
from UI and keeping track of what is being refreshed.

Conceptually it's a part of Controller, but extracted for easier testing.

- Now sendPendingMessagesForAllAccounts() is owned by RefreshManager
  rather than Controller.
- Also updateMailboxRefreshTime/mailboxRequiresRefresh have been moved
  in from the Email class.
- Now MessagingException implements a method to return an error message
  for the UI.

The refresh button on 2-pane doesn't work as intended yet, because the
spec is a bit too complicated (as described in the TODO in
MessageListXLFragmentManager.onRefhres()).

This change touches many file mostly because it cleans up a lot
of code duplication.

Change-Id: I058ab745ccff10f6e574f6ec4569c84ac4a3e10e
2010-08-18 11:06:45 -07:00
Makoto Onuki 8479032c12 Fix the bug in LoadBodyTask.
doInBackground() returned a string[] when error, but onPostExecute() expects
null.

Also added isCancelled() check, just in case.

Bug 2918930

Change-Id: Ie87ff2e2e5b7c3fd77a062944759d03f8f09d3d9
2010-08-13 15:47:50 -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