Commit Graph

3144 Commits

Author SHA1 Message Date
Marc Blank
f19f9cf4d3 Simplify AttachmentDownloadService; add unit tests
* Changed our queue from a TreeMap to a TreeSet that uses an easily
  testable comparator
* Remove the ugly bit twiddling priority computation
* Test DownloadSet (the logic behind queue ordering, addition,
  removal, query, etc.)

Change-Id: Ia8427900b8f39a243a5407349775802d0a4fad4f
2010-08-23 11:42:40 -07:00
Makoto Onuki
567ed19f7b Follow up to I684ab2ed.
Catch RuntimeException so that it won't crash even with malformed URLs.

Change-Id: I58da906860ac30b5c9daf68bb672f19917ad0ece
2010-08-20 17:46:53 -07:00
Makoto Onuki
d755cdce13 Fix attaching from Gallery.
Fix the attachmentExists test, so that now it works with the content: URL.

Bug 2937846

Change-Id: I684ab2ed0e4fbe4784a165697084b868610bd274
2010-08-20 17:10:00 -07:00
Marc Blank
0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Andrew Stadler
a14a24a5bc Add Add & Remove Account options to AccountSettingsXL
* Add account is a large (+) in the action bar
* Remove account is a new item at the bottom of the settings fragment
Note: Add account works, remove account just toasts for now.

Change-Id: I5b3b8ab8c7d328cb78d103c47b9eca866466f9df
2010-08-19 16:28:52 -07:00
Marc Blank
7894ee82b3 New attachment download support for Controller (IMAP/POP3)
* Supports download via AttachmentDownloadService

Change-Id: I66143a79b99dcdbd307524ba0b81227f09a00e4a
2010-08-19 15:44:44 -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
Eric Fischer
2f375d0c1f Merge "Import Romansh translations." 2010-08-19 12:01:05 -07:00
Makoto Onuki
d111cc70aa Add a debug parameter to Welcome to force 1-pane/2-pane
- Now Welcome takes an EXTRA_DEBUG_PANE_MODE to force the
  one-pane/two-pane mode.

Use this to open one-pane.
adb shell am start -a android.intent.action.MAIN \
  -n com.google.android.email/com.android.email.activity.Welcome \
  -e DEBUG_PANE_MODE 1

Use this to open two-pane.
adb shell am start -a android.intent.action.MAIN \
  -n com.google.android.email/com.android.email.activity.Welcome \
  -e DEBUG_PANE_MODE 2

Change-Id: I6e96f80f53f4488152935502c19d3dd8e0788150
2010-08-18 16:57:27 -07:00
Andrew Stadler
5122417625 Make AccountSettingsXL the main settings UI
* Connect to it from all call sites
* Remove 1-pane and 2-pane icons
* Leave a few more breadcrumbs for launching into specific account
* Update the long TODO list in AccountSettingsXL

Change-Id: I502eda9a622518e8d4a23d46989340ad400cdd34
2010-08-18 16:47:42 -07:00
Eric Fischer
c1ac3078f9 Import Romansh translations.
Change-Id: I506f625fc7a35d7af545306201d7db90330c1e1c
2010-08-18 16:26:08 -07:00
Makoto Onuki
5e06d1714d Fix crash when refreshing magic mailboxes.
bug 2929867

Change-Id: I95c4f4e31c1db2139c96b623f9b9c2df7916e5e1
2010-08-18 15:44:41 -07:00
Makoto Onuki
f52afae942 Make sure RefreshManager's callbacks are called on UI thread.
Fixed the bug where callbacks for sendPendingMessagesForAllAccounts
are called on a worker threaed.

Change-Id: I28f1424cf67e15abf37c09b68050d1385f9ac3ee
2010-08-18 14:49:46 -07:00
Makoto Onuki
e112bd7648 Merge "Show "Send outgoing mesasges" button in outbox." 2010-08-18 14:24:05 -07:00
Makoto Onuki
715a19be28 Show "Send outgoing mesasges" button in outbox.
It works for regular outboxes.  Unfortunately it doesn't for
Combined Outbox, due to a bug in RefreshManager, which I'll fix
in a separate CL.  (The fix might be rather large.)

Change-Id: Ib904e2c672801debe3dd64e4bb0a464564d098da
2010-08-18 14:23:09 -07:00
Marc Blank
d14229872a Fix NPE in MailService
Bug: 2873538
Change-Id: Ida9135d3c8090abb63424cc2b2cb1b848785d571
2010-08-18 13:17:21 -07:00
Marc Blank
25dd2081a5 Merge "Remove db access in MailboxAlarmReceiver" 2010-08-18 13:15:37 -07:00
Andrew Stadler
2ae2a12d6b Initial implementation of SettingsXL (checkpoint)
* Create AccountSettingsXL
* Build headers dynamically based on accounts
* Launch account settings per-account
* Temporary launch point from menu in AccountFolderList

TODO: Fragment flip to incoming/outgoing/checksettings not implemented yet
TODO: Use more recent updates to PreferenceActivity
TODO: Finish plumbing into account settings fragment
TODO: Something more real for app settings

Change-Id: I6f4c5bb8cf691f25517c25950ef2049084335ce3
2010-08-18 11:29:46 -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
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
Eric Fischer
9d8aec8022 Merge "Import revised translations." 2010-08-17 17:24:17 -07:00
Makoto Onuki
c2585eb7f9 Merge "Implement "contextual" (selection) mode." 2010-08-17 17:16:56 -07:00
Eric Fischer
cd68a7caeb Import revised translations.
Change-Id: Ie4f5c8c899d93260df73861494bc168f7f77ddf4
2010-08-17 16:52:30 -07:00
Makoto Onuki
2127964d0f Implement "contextual" (selection) mode.
Now MessageListFragment itself takes care of the selection mode,
without help from activities.

Change-Id: Ia1a9942d0d3ca87b4f0938a3bf8172466f53b5d6
2010-08-17 13:22:36 -07:00
Marc Blank
75153d3122 Fix broken unit test
Bug: 2900294
Change-Id: I61e002061b1d743327a84e64925e64cb6228b879
2010-08-16 23:31:23 -07:00
Marc Blank
5f299d2176 Remove db access in MailboxAlarmReceiver
Bug: 2835313
Change-Id: I61e3672efed85bfa101c731a08cfec8141860c94
2010-08-16 20:38:07 -07:00
Makoto Onuki
a241d61ce8 Merge "Deal with fragment API change." 2010-08-16 14:12:35 -07:00
Makoto Onuki
6956533103 Deal with fragment API change.
- Use the class attribute instead of android:name in fragment tags.
- Use FragmentManager rather than openFragmentTransaction.

(There's a change on the PreferenceHeader tag too, but seems like we're
not using it.)

Bug 2922220

Change-Id: If604a97ac73b9ad7d84e453d36beb84bf31ff98f
2010-08-16 14:10:47 -07:00
Marc Blank
a83e4fdf14 Merge "Run AccountsUpdatedListener work in worker thread" 2010-08-16 11:16:49 -07:00
Makoto Onuki
52cd3c9a26 Revived removed string and moved up to the deleted section
Change-Id: I77d6fbcbb0d1d8fcb7fcaa94b6bf643cb00db368
2010-08-16 10:41:27 -07:00
Marc Blank
a09459f6f4 Run AccountsUpdatedListener work in worker thread
Bug: 2922224
Change-Id: If7b61c4f41d901fd71d571450fa5fa7f3ff11535
2010-08-16 09:44:54 -07:00
Andrew Stadler
7b5c5cf2a9 Use new fragment API features for dialog fragments
* Use fragment arguments for dialog parameters
* Use target fragments to report ok/cancel

Change-Id: Id2a4cc91b1f589273b1000dca30e8c2feff6d32e
2010-08-15 23:00:08 -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
2866a0a8d7 Merge "Properly unregister mock controllers" 2010-08-13 15:45:52 -07:00
Makoto Onuki
70bfdab6a3 Merge "Remove debug log from MailboxFinder." 2010-08-13 15:45:48 -07:00
Makoto Onuki
130686327a Merge "Reworking MessageListFragment." 2010-08-13 15:40:28 -07:00
Makoto Onuki
4be3bc1ec8 Properly unregister mock controllers
Some tests create mock controllers.  They register themselves to
MessagingController when instantiated, but never unregister.

Added a cleanup method, and call it for each instance.

(I was hoping it would spped up unit tests, but it didn't.  Still
it's a nice thing to do.)

Change-Id: Ia90f0380aef388d22f7cfcf6e9203e05444b3285
2010-08-13 15:28:23 -07:00
Makoto Onuki
b7d637232e Remove debug log from MailboxFinder.
It was temporarily added purely for debugging, and forgot to remove.

Change-Id: I7424465e12faf7f3344206ad9baac075a0b18b26
2010-08-13 13:18:31 -07:00
Makoto Onuki
ab3b066fb8 Merge "Handle multiple IMAP SEARCH results." 2010-08-13 11:20:35 -07:00
Andrew Stadler
ea49ac3f0d am c2631344: (-s ours) am 9382eb9f: am a30631da: Clear password related policies in PolicySet when p/w not required
Merge commit 'c2631344929f3befcfb3730930daa4cbaac057ba'

* commit 'c2631344929f3befcfb3730930daa4cbaac057ba':
  Clear password related policies in PolicySet when p/w not required
2010-08-12 15:31:45 -07:00
Andrew Stadler
c263134492 am 9382eb9f: am a30631da: Clear password related policies in PolicySet when p/w not required
Merge commit '9382eb9ff21855e98b67392f99d721a78a4cfab0' into gingerbread-plus-aosp

* commit '9382eb9ff21855e98b67392f99d721a78a4cfab0':
  Clear password related policies in PolicySet when p/w not required
2010-08-12 15:18:24 -07:00
Andrew Stadler
9382eb9ff2 am a30631da: Clear password related policies in PolicySet when p/w not required
Merge commit 'a30631da1cae25be3f75137133297e30cef2db9c' into gingerbread

* commit 'a30631da1cae25be3f75137133297e30cef2db9c':
  Clear password related policies in PolicySet when p/w not required
2010-08-12 15:15:59 -07:00
Makoto Onuki
187d033484 Reworking MessageListFragment.
- Now MessageListFragment uses loaders to load data.

- Now that we use Loader's auto-requery with throttling,
  removed the throttling timer from MessagesAdapter.

- Simplified footer mode.  (now only "no footer" or "load more")

- Removed saving/restoring list state code.
  These method don't really look like working, or at least
  not always working.  Now that UI's lifecycle is changing,
  we'd better redo it from scratch.

- Removed MessageListUnitTests.
  It only has tests for onSaveInstanceState/restore of the fragment,
  which I virtually disabled.

And minor clean-ups
- Moved the code to save/restore selected state from the fragment
  to Adapter.

Bug 2911766
Bug 2897500

Change-Id: I16c7aefecc5409c57fc5fc8c59b5c80d9b7fc164
2010-08-12 15:06:37 -07:00
Andrew Stadler
a30631da1c Clear password related policies in PolicySet when p/w not required
Merge from master of c263810b08

Bug: 2883736
Change-Id: Iec4ed0e320d67aee8a89092ac650c0960540057b
2010-08-12 14:56:32 -07:00
Makoto Onuki
ccd4dbee8f Merge "Make use of the retaining-loader feature." 2010-08-12 11:31:55 -07:00
Makoto Onuki
79d4a2d9e1 Make use of the retaining-loader feature.
Don't use restartLoader().  Use initLoader() with stopLoader() when necessary.
This allows us to make use of LoaderManager's "retaining" feature.
i.e. We won't have to requery when the screen orientation changes.

Also, don't start loading in onStart().  Fragment manager seems to kick
exisiting loaders after onStart(), so you'll end up getting onLoadFinished()
twice.
(Looks like I got unluck with this--there was no strong reason to start loading
in onStart rather than onResume, but I think we can leave other fragments as-is
as long as they don't use loaders.)

Seems to be working.

Change-Id: Ib4f72098bd0fcbfce284ae6e16055d20ee410cf3
2010-08-12 11:31:14 -07:00
Marc Blank
b6ad4c252f Merge "Fix AttachmentProvider to work properly w/ EmailProvider" 2010-08-12 11:21:19 -07:00
Makoto Onuki
367ebd7fa5 Handle multiple IMAP SEARCH results.
Apparently IMAP servers may return multiple SEARCH responses for a
single SEARCH command, and we need to handle all of them.

Before the IMAP rework there was 3 methods that issued the SEARCH command.
Two of them ware doing it right, but the other wasn't, which was what
I copied from, unfortunately!

In case you're wondering, originally the test for this method was done through
upper methods, e.g. getMessage().

Bug 2911647

Change-Id: Ia50072944d5b01c1e59541c3a966067b13910cc4
2010-08-12 11:10:00 -07:00
Makoto Onuki
86dc43d492 Merge "Improve logging in MailboxFinder." 2010-08-12 10:04:21 -07:00
Marc Blank
1ec89e6290 Fix AttachmentProvider to work properly w/ EmailProvider
* Apps trying to open attachments using AttachmentProvider were
  seeing SecurityExceptions due to the fact that internal calls
  from AttachmentProvider to EmailProvider didn't have their
  calling identity saved/restored.
* Updated provider calls so that these calls use the Email
  process' identity.

Bug: 2908737
Change-Id: Ifb71ad834530c6232728e1aad31439991f8ed379
2010-08-11 17:31:45 -07:00