Commit Graph

143 Commits

Author SHA1 Message Date
Todd Kennedy f04c832f23 Add ability to track mailbox recency
Change-Id: I1bcc7928ea7065a5daa262b7cea7ee3e21981675
2011-06-06 10:30:01 -07:00
Jorge Lugo 15842c522e Fixed reply-all bug
Upon hitting reply all, all email addresses except that of the source message sender
go in the CC: field. Previously they all went in the TO: field. Updated 3 tests
in MessageComposeTests.java (testReplyAllAddresses1(), testReplyAllAddresses2(), and
testReplyAllAddresses3()) to reflect this new behavior.

Bug: 4534058
Change-Id: I852daebdd8843a45f685eecc67f757c87925bb6c
2011-06-03 10:16:05 -07:00
Makoto Onuki 844bf74504 MailboxListFragment: In-place nested mailbox navigation
Now we reuse the same instance of the fragment for nested mailbox
navigation.  (Don't use fragment transaction)

"CursorWithExtras" now only has the child count, so I removed the
bundle version and added a concrete class to MailboxFragmentAdapter.

With this CL the nested mailbox navigation on 1-pane should work, but
not back navigation.  (Back press event isn't connected to the
fragment yet.)

Change-Id: I2c23651d9c8edb5fe062c68bbb9b462c8949ded4
2011-06-01 15:06:42 -07:00
Ben Komalo b535e436f3 Merge "Move HostAuth to top level class." 2011-05-19 16:28:18 -07:00
Ben Komalo 12b82d9374 Move HostAuth to top level class.
No other changes made.

Change-Id: I1c6497c98abc0f99443ea42d8aed6295b263c123
2011-05-19 15:28:48 -07:00
Makoto Onuki d531dc3058 Fix opening Starred mailbox.
We need to pass around the account ID with onMailboxSelected too.
(It's kinda sad it wouldn't have happened if we had par-account starred
mailbox.)

Also made sure MailboxListItem.mMailboxId now really contains only a mailbox
ID.  Before this chage, we stored an account ID to this for an account row
on the combined mailbox.

Bug 4452811

Change-Id: I732fd8eb18f787f4a700a45a40768f96e3bb8751
2011-05-19 15:10:51 -07:00
Makoto Onuki 2ed7a86949 Support pre-HC style account shortcuts
Account shortcuts used to point at MessageList directly with a
content://com.android.email.provider/account/ACCOUNT-UUID URI.

Hook these intents and open Welcome instead.

On Eclair and before, we stored an account-ID directly as an extra,
but this style is no longer supported.

Bug 4208879

Change-Id: I9fecb0723743377a6d7c7e84626e8613f2356492
2011-05-19 13:47:25 -07:00
Makoto Onuki 4c4e4c3515 Clean up the method to build message list selection.
- Moved the method to EmailCommon.
- Use *_SELECTION for magic mailboxes
  (meaning we now use subqueries for magic mailbox selections, rather than
   building the mailbox ID list by ourselves)

Change-Id: I3ebf6af62fd912fea6faea0f75e05fc61c87af3b
2011-05-16 11:08:05 -07:00
Ben Komalo 53ea83ebf9 Move Mailbox to top level class.
No other changes made.

Change-Id: I3d8f3c521dc0d902be313b25252b4b6a4a96e7ee
2011-05-13 17:42:02 -07:00
Ben Komalo 2866284a6d Rename AccountSettingsXL -> AccountSettings
This activity already supports phone and tablet mode.
Only renames in this change - no other change.

Change-Id: Ieca17137af45e3860812091f69cd4d9b55ddf3ec
2011-05-13 09:58:15 -07:00
Makoto Onuki 94331c96d9 Remove phone activities and implement one-pane
The primary purpose of this CL is to remove phone activities, so the
one pane implementation is very much temporary and primitive, but it
should offer minimal operations.

Change-Id: If57f81db7c605c95664d49044a5cc082beda59c0
2011-05-11 15:35:27 -07:00
Ben Komalo 5b7e434917 Support switching between reply/replyall/forward
This introduces tab navigation on large screens with action bar (a
dropdown for the phone view is yet to be implemented, though the
internals are ready for it).

This requires the side effect that restoring a draft
reply/replyall/forward will attempt to also load the source message in
full for additional information. If that load fails for whatever reason,
the draft just remains a "compose" as it used to before.

Bug: 3117253
Change-Id: I9cff5ed4a5e9abd1338b6dbde28ceb3e4dc2b761
2011-05-10 10:36:22 -07:00
Ben Komalo 8d042850fb Re-work the way MessageCompose handles attachments
Now attachments are actually stored in an explicit list, instead of
being inferred from the state of the UI. This makes it possible to
switch states and restore attachments, and test.

Change-Id: I8c5f80f17f8c9e78d880ac4a1ac6ae22c2ec0579
2011-05-06 11:53:53 -07:00
Ben Komalo c6beaaea59 Update MessageComposetests with latest refactors
Change-Id: I7ab1275f4f4a803588619952f55fd81520036526
2011-05-04 16:34:32 -07:00
Makoto Onuki 8112732376 Move more UI stuff from activity to the UI controller
- Now all the UI stuff is owned by the UI controller
- Except temporary UI (exchange search and per-mailbox-settings)
- Except error banner
  This should be moved too eventually, but I consider it as a low-priority.
  I'll leave it as-is for the time being.
- Moved RefreshTask too.  The spec for refresh has dependency to the UI.
  (i.e. implicit refresh of the mailbox list may not be necessary for
  the phone.)

Also renamed the main activity to EmailActivity.

Change-Id: I00585856bdacf69aa4e104178a5cf7352ff6d592
2011-04-28 10:59:55 -07:00
Todd Kennedy 22208771b7 Add hierarchical folders to IMAP
We now create folder hierarcies for IMAP. This also includes a nifty SQL
statement that will get your existing database into shape.

Change-Id: If07a0632e9b250cf0c33c3e16bfba5816beab94c
2011-04-25 15:11:38 -07:00
Ben Komalo 0fb68c8f0c Add signature when starting from external intents.
Also update some of the tests.

Bug: 3122070
Change-Id: Ia0e4620f54279dc53ca1c4484fec6508c411b418
2011-04-12 18:10:05 -07:00
Todd Kennedy 3659fdf5af Don't use hidden API
AndroidTestCase#getTestContext() is decorated with @hide. Instead, use
InstrumentationTestCase#getContext(). This gives us the same functionality
[i.e. the ability to load a test-only XML resource] without using a hidden
API.

Change-Id: I866234e227d975bac62c12e6a2e8efe90de0261c
2011-04-05 14:40:10 -07:00
Makoto Onuki 0b6cb1c330 Store UUIDs in account shortcuts, rather than IDs.
Bug 4192836

Change-Id: I1d6349ed3ad70867f113b9a9f7eb8717b88b24c1
2011-04-04 14:12:05 -07:00
Todd Kennedy 74bf57cfaf Create separate adapters for mailbox lists
There are currently two places where we use a mailbox list -- in the main
view and in the "move to" dialog. We've replaced the single, modally
configured adapter with two specialized subclasses.

Change-Id: I5dfd5ccd435fefbab4b7647c2bd7a14818f73bf3
2011-03-31 15:27:12 -07:00
Todd Kennedy 5e4f1c3872 Allow globals in the providers.xml
There are two ways globals can be specified. There can be only one global
character ['*'] and/or multiple wildcard characters ['?']. The global
will match zero or more characters. The wildcard will match any character.

bug 4090086

Change-Id: I07e3edebd1fe989094c68cf047ce5bc9fb91aba0
2011-03-31 14:28:43 -07:00
Makoto Onuki 44f45f4221 Merge "Don't use findViewById (part 1 -- account setup)" 2011-03-31 11:06:15 -07:00
Makoto Onuki 2fbb3db5d8 Don't use findViewById (part 1 -- account setup)
Added two new functions:
- UiUtilities.getView()
  is a fail-fast version of findViewById().  Crashes when there's no view
- setVisibilitySafe()
  same as View.setVisibility, but doesn't crash even if a view doesn't exist

Let's try to avoid the use of findViewById(), and instead use getView(), *right
after* the layout is inflated, so that we'll always fail-fast if a layout
doesn't have a required view.  (Rather than getting a NPE only when the view
is really accessed, which can be in a code path which is rarely executed--e.g.
only when there's a protocol error.)

Let's only use findViewById() only when we're sure no all the variants of a
layout have the view in question and leave a comment to make it clear it's on
purpose.

(UiUtilities has been moved from com.android.email to
com.android.email.activity)

Change-Id: I36e0bab65a989f5d34cf636f13e1eaee084547af
2011-03-30 13:47:13 -07:00
Todd Kennedy 08534762bd Allow globals in the providers.xml
We now allow a single global character ['*'] to be specified somewhere in
the domain attribute. Additionally, we will replace the string "$domain"
with the matched domain in all attributes -- user name, password and URIs.

bug 4090086

Change-Id: I46a637ed364c1a079e1230fa22393a1bac059b1f
2011-03-29 11:12:13 -07:00
Makoto Onuki 308ce92847 Better fix for the PendingIntent issue.
Refactor the changes introduced in Ib02842bb.

- Now Welcome and AccountSettingsXL accept intents with URLs of the following
style, and get IDs from query params, rather than extras.

Welcome:
content://ui.email.android.com/view/mailbox?ACCOUNT_ID=1&MAILBOX_ID=2&MESSAGE_ID=3

AccountSettingsXL:
content://ui.email.android.com/settings?ACCOUNT_ID=1

- Now the "new message" and "login failed" notifications use these new style
intents, so the system wouldn't merge PendingIntents for different accounts.

Also:
- Moved all notification creation logic to NotificationController.
  (Except the one in CalendarSyncEnabler; which is used only to support
  upgrading from pre-froyo and I don't think it's worth refactoring.)

- Note the "password expired/expiring" and "security needed" notifications
aren't changed; they still use extras to store account IDs.  This is okay
because these notifications are not per-account.

Bug 4065269

Change-Id: I70737438d2e7c45fd7488a5b0a7105c8568e02f7
2011-03-23 14:49:38 -07:00
Makoto Onuki d72f7bdf11 Improve EmailAsyncTask
Added 6 methods:
- execute{Parallel,Serial}
- cancelPreviousAndExecute{Parallel,Serial}
- runAsyncParallel{Parallel,Serial} (replacement for Utility.runAsync)

Bug 4083415

Change-Id: I5ca33000e52fc5265ccc84a6e5acb0d3359d0eb4
2011-03-21 16:41:08 -07:00
Todd Kennedy fe68c0e7c2 Use HostAuth to determine settings changes
There were two TODO's from a prior CL where deprecated HostAuth methods
were removed.

1. Do not use a generated URI to determine if account settings have changed.
   Instead, use the HostAuth structure for this purpose.
2. The account key in the HostAuth structure has been deprecated. Remove as
   much of it as possible (until the schema of the host auth database changes,
   we must still refer to it when adding rows).

In the process, HostAuth tests were broken out into a separate unit test
file.

Change-Id: I4075da09af168f734db7b20a9ef63d4178ac2064
2011-03-01 07:49:54 -08:00
Todd Kennedy 040ddf60cf Resolve build warnings; part 5
Remove dependence upon URIs for creating the host auth structure

Change-Id: I92dee36fa329a8976b76bbd4991ed3469c6475f2
2011-02-16 17:38:31 -08:00
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
Marc Blank 2193962ca2 Email split, part quatre: Move along, nothing to see here
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
  Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
  length of the CL

Change-Id: I4e12455ba057a4a8054fdbd0b578c73afa411c8a
2011-02-10 16:28:37 -08:00
Todd Kennedy 34e487594d Remove unused import for Log class
Change-Id: I5edb48c11bde8d0785dd6e1857a04949ea122a46
2011-02-08 15:04:40 -08:00
Todd Kennedy bddc4e87ef Fix mailbox adapter & message order manager unit tests
* the new mailbox queries will only catch message that are
"loaded"; by default, messages were created "unloaded", so,
the query was returning 0 results

* extra parens were removed from the query string; the text
needed to be updated to not check for the extra parens

bug 3428077

Change-Id: Iea5867e741b9673985ca020aa3a8425c061324bf
2011-02-07 15:07:55 -08:00
Makoto Onuki 7c1fa2c161 Unit test for change Ieec04881 (make sure CC is visible)
Change-Id: Ic6ffbddf80dcbfe39e55d9b579316767a0ff1180
2011-01-31 15:42:58 -08:00
Makoto Onuki d0ee1e404d Fix bug where mailbox list won't update in combined view
The problem was that CombinedMailboxesLoader used the cursor returned by
super.loadInBackground() (which contains accounts), to build a matrix
cursor (which contains special mailboxes and accounts and will be returned),
and *it closed the first cursor* after building the matrix cursor.

However, because this first cursor is the one that CursorLoader sets an
observer, it shouldn't be closed until the returned matix cursor closes.
In other words the two cursors should have the same lifecycle.

Fixed it by using ClosingMatrixCursor that used by AccountsLoader, which
is doing a similar thing, but properly.

Bug 3387730

Change-Id: I554ade001dc25afa869eefb4dcf9887495e6753e
2011-01-26 13:40:53 -08:00
Makoto Onuki 7093746dd5 Don't modify content URI to non-email providers
The "?limit=" param is only supported by EmailProvider, so don't add
it to other URIs.

Doing so causes a permission error when opening an EML attachment on gmail,
because we're granted the permission only to the passed URI, but not to
the URI with the "?limit=" param.

Bug 3371630

Change-Id: I88fff88a7e48e5bc958124eedec3e592978a40c7
2011-01-20 16:28:36 -08:00
Andy Stadler 946239e8a0 Add per-account preference for bkgnd attachments
* Add flag to Account record
* Add checkbox to Account Settings (IMAP & EAS)
* Add checkbox to Account Setup (IMAP & EAS)
* Add flag to backup/restore logic
* Update Account & AccountSetupOptions unit tests

Bug: 3360873
Change-Id: I0c407776ede4110f33716644f6f027938f21130a
2011-01-18 10:53:37 -08:00
Makoto Onuki d072f9905d Don't show trashed messages in Starred mailbox
Also show the *total* starred message count (excluding trashed starred)
in the mailbox list, not *per-account* starred count.

Bug 3346872
Bug 2149412

Change-Id: I2274f215f994b62280ac6138982b927cec22c677
2011-01-13 15:41:22 -08:00
Andy Stadler 2959a7e073 Fix ANRs from Email.setServicesEnabled()
* Create sync & async versions
* Rename all callsites so sync is very apparent
* Fix callsites appropriately
* Clean up interaction between reconciler and setServicesEnabled

Bug: 3133770
Bug: 3134677
Change-Id: Iefbc7814d9aa390baea6345e450e2a4768bf0a9a
2010-12-23 13:19:55 -08:00
Makoto Onuki c849936a36 Fix unit tests
- Now ProviderContextSetupHelper.getProviderContext() invalidates DB cache

* MailboxAccountLoaderTestCase
- Save hostauth properly
- (ProviderContextSetupHelper invalidates cache before each test)

Bug 3280911

* SmtpSenderUnitTests
- Use ProviderContextSetupHelper to create isolated context,
  which now also invalidates DB cache

Bug 3280913

* MailboxFinderTest
- When kicking Controller.Result methods directly from tests,
  call the raw callback, rather than the one wrapped with
  ControllerResultUiThreadWrapper, to make it synchronous.

Bug 3280898

* MessageViewTest
- Disable testOpenMessage()
  This test doesn't work because it sets up test data in an isolated
  context but the activity/fragment don't see them because they
  use the real context.
  I have no idea why it worked before... Maybe because there were
  accounts/mailbox/message with the same ID in the DB by chance.

Bug 3280905

Change-Id: I6beb08c58fff102e90bebd2c35f70820268b9e62
2010-12-13 16:29:57 -08:00
Andy Stadler 3a4b9e140e Fix failing tests in AccountSetupExchange
A recent change was short-circuiting the logic that loads
the UI from the account.  This fix simply resets the flag
so the test can reload the UI multiple times as it tests things.

Change-Id: I7cc53e2766b78172e5a7b05088e94fdec99ae0d6
2010-12-08 00:22:23 -08:00
Makoto Onuki d1ee5b8fa5 EML viewer: Set title, and show arrow next to the app icon
- Set "Viewing FILENAME" as title.
- Home icon now has "back" arrow.  Closes the activity when clicked.

Bug 3221312

Change-Id: I689499e10704d3c5d206df4aa12e21db9687c4c5
2010-12-01 11:35:09 -08:00
Makoto Onuki 08e1f2f782 Don't show account dropdown when there's only 1 account.
Bug 3225851

Change-Id: I7b411f8047e3b26cfe53f17c46c3e2611fb8ae9d
2010-11-23 17:23:36 -08:00
Makoto Onuki 931ca67a1f New message view command layout
UI Changes:
- "Move", "Delete" and "Mark as unread" became action bar commands.
- The message view bottom panel now only has "newer" and "older" buttons,
  with  the current position in the message list.  (shown as POS of TOTAL)
- The buttom panel is now shown only on portrait

Non UI changes
- MessageOrderManager now keeps track of the current cursor position
  as well as the total message count.

- Fixed the "move_action" string, which was wrongly marked as non-translatable.

Bug 3169454

Change-Id: I599543f9e11000a4ee283d31fbd407b2ab53ac44
2010-11-10 11:08:14 -08:00
Andy Stadler ba4e72a947 Cleanup various IMAP/POP manual account setup defaults
These defaults affect manual setup only.  There should be no changes
observed in automatic setup, and no changes observed in EAS setup.

* user $email instead of $user as default login
* guess "imap." or "pop3." for server name
* propagate the incoming server name to the outgoing server name, and
  replace "imap.", "pop3." or "pop." with "smtp."

Also, fixed a couple of leftover places where we were trimming
passwords (and should not be, since some people insist on having
spaces in their passwords.)

Bug: 2978634
Change-Id: I9b0e345aa9550b5e1cc29aaa22109f03da61af20
2010-11-03 09:31:45 -07:00
Makoto Onuki 730cc6724a Add "Combined view".
- Don't show combined mailboxes with regular mailboxes in the mailbox list.
- Add "Combined view" to the account selector instead.
- "Combined view" has all the combined mailboxes and accounts.
- Renambed these combined boxes.  (e.g. "Combined inbox" -> "Inbox")
- Regular account view still has "Starred" mailbox, but it's actually
  "combined" and not per-account.
- Re-order special mailboxes per latest wireframe.

Bug 3138004

Change-Id: I4c5860c6774b10c55ba0ca599373e51105432cf8
2010-11-01 11:51:51 -07:00
Makoto Onuki e9919377ee Skip testCommaInserting if screen is off or locked.
sendKey() doesn't work if the screen is off or locked.

We could probably use a WakeLock and KeyguardLock to force the
screen to be on, but that'd require adding unnecessary permissions
to the email app. (not the test apk)

Bug 1737038

Change-Id: Ic036dc4d12770e82bc5de1133d6dd34cd8465f30
2010-10-21 13:51:46 -07:00
Makoto Onuki 9b5001a34c Don't use negative IDs with ListView
ListView uses the _id column for some operations, including
onSave/RestoreInstanceState, and if the column contains negative values
they don't work as expected.  The same assumption seems to be in other places
as well, so let's just avoid using negative IDs.

With this CL we now use two different IDs, one for ListView, which will
never be negative, and the other for us, the actual mailbox ID.

Bug 3049315

Change-Id: I263b4895212b5f8bb80c98acaf5c4eccd0bfef55
2010-10-14 14:42:46 -07:00
Makoto Onuki 02a750dd64 Fix tests
Bug 3077014
Bug 2992255

Change-Id: I1e8127327158b0821177d0744a60132f89dccdd8
2010-10-08 14:53:40 -07:00
Andrew Stadler fb4333b3a5 Allow spaces in passwords
* Separate/identical fixes for incoming, outgoing, exchange
* Unit tests
* Some protocols will fail anyway (e.g. POP3)

TODO: Some sort of warning (master only - won't backport that)
Bug: 2981433

Change-Id: I82984e5912fc7fcb88e747815d0fe33cb36605e7
2010-09-27 10:04:03 -07:00