Commit Graph

551 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
Makoto Onuki
86dc43d492 Merge "Improve logging in MailboxFinder." 2010-08-12 10:04:21 -07:00
Makoto Onuki
cab0021179 Improve logging in MailboxFinder.
There's something weird going on when you add an Exchange account
and we try to look up the inbox.  Add log for investigation.

- Log class name
- Log normal path (MAILBOX_FOUND) as well if debug is enabled.
(Other paths are always logged.  These paths shouldn't be used often,
so I think it's okay.)

Change-Id: Iff5a28a1240896f8e2b991b891cbc696e7901f06
2010-08-11 17:01:26 -07:00
Andrew Stadler
641ae45358 Fragmentize Exchange setup
Change-Id: Ib331d9a7f7be7acbfe355d6a03d9ae07af0cc627
2010-08-11 16:07:26 -07:00
Andrew Stadler
faaa115e1a Fragmentize outgoing settings (SMTP)
Also fix a small NPE in AccountSetupIncoming

Change-Id: I5728a10889a3f0f35d31962f4a13ccae4ec0393b
2010-08-10 17:45:57 -07:00
Andrew Stadler
1b156352f3 Fragmentize Incoming settings (IMAP/POP server)
Also, extract DuplicateAccountDialogFragment for reuse.

Change-Id: I042a158e264d949024347d477d6e9ec999c244d3
2010-08-10 14:28:20 -07:00
Makoto Onuki
d632426c0a Support opening a draft on XL.
- When a draft is selected, use MessageCompose rather than MessageView.

Change-Id: I5e005a7916d7089cfbe9ed15cf51c901c26dd595
2010-08-10 11:20:37 -07:00
Makoto Onuki
76681d906a Implement "account settings"/"add account"
- Implemented "account settings".
- Added "add account" menu.  It's not clear how to get to the screen at
  this point, so just added a menu item for this for testing.

Change-Id: I78cfa54f2533917cc742b6ec027c2a0624cf0c1a
2010-08-10 11:08:36 -07:00
Makoto Onuki
b98f219cf0 Open 2 pane after adding an account.
- After adding an account, and when a shortcut to an account is clicked,
  launch Welcome instead of MessageList.
- Then welcome launches the appropriate activity.
  (MessageList or MessageListXL)

- Welcome no longer launches AccountFolderList, which will be gone
  according to the current plan.

Always going through Welcome makes sure that the account backup/restore
and the reconciler will always get kicked.

Change-Id: Ia57027eba16e98c5d8854e8d3c1d8773bcfbf1e5
2010-08-10 09:50:52 -07:00
Makoto Onuki
e6fcf73917 Merge "Fix crash when resuming MessageListXL." 2010-08-10 09:36:01 -07:00
Andrew Stadler
a75bab5504 Fragmentize AccountSetupBasics
Change-Id: I99eb4cd4f8aa80d25a01d720244ccee599cba1d8
2010-08-09 22:44:41 -07:00
Makoto Onuki
f48fe98b2a Fix crash when resuming MessageListXL.
It's related to the use of Activity.manageQuery().
This may be a regression in the framework, but it's annoying enough and
causing a problem with testing, let's just not use managedQuery().

Bug 2901309.

Change-Id: I8ae5b6ffe17979a094d5a23d49f42e8de04ed4f0
2010-08-09 15:38:56 -07:00
Andrew Stadler
71cc035c55 Fragmentize AccountSettings
This is phase 1, which simply replaces the phone UX with a fragment-based
equivalent.  A subsequent CL will convert it to a large-format multi-pane
version.

Also fix a latent bug in the signatures of the Incoming & Outgoing
settings, both in the reflection code and in the proguard flags.

Change-Id: I86e857af8b9573c0d6070bb21053ce65bb7fe8a0
2010-08-09 10:36:50 -07:00
Makoto Onuki
533e0f5beb Add "change orientation" menu command.
Unfortunately software-keyboard is disabled on master for some reason,
so we can't use the R key hack any longer...

Change-Id: Ide73e11742e5de70fec45009eee20a1a74fcbfd1
2010-08-07 18:16:14 -07:00
Makoto Onuki
b0ca30d4d1 Add action buttons to actionbar on MessageListXL
- Now able to compose a new message.

Change-Id: I53cd7cc6fe850063946824748e11ccde89d7decf
2010-08-06 10:48:14 -07:00
Makoto Onuki
fd8a2e8afb Automatically open Inbox when account is selected.
Change-Id: I3dc43d804d39b925ee62bebbf85911cb258aafd7
2010-08-06 10:44:45 -07:00
Makoto Onuki
9531931c7e Don't auto-requery account list.
Prevent CursorLoader's auto-reuqery.  Instead, refresh the loader
when adding/removing accounts.

Change-Id: I63091c23f8c06c32dd42669fdfbd9e783ff9eccb
2010-08-06 10:38:34 -07:00
Makoto Onuki
94506fdaf6 Small fixes/clean-ups.
- Fixed account selector default account look-up
- Renamed MessageListFragment.onRestoreInstanceState
  to loadState.
  (Activity.onRestoreInstanceState is called after onStart,
  but this one is called in onCreate, so it wasn't a good
  idea to use the same name.)
- Changed mailbox cursur requery timeout to 3 seconds
- Added some TODOs.

Change-Id: Ia2242cd9f74936d24756b800eacd126958eed330
2010-08-06 10:11:36 -07:00
Makoto Onuki
191448b430 Make Welcome launch MessageListXL
Also added the "1 pane" activity to test the phone UI.

Change-Id: I1c86d2088a2298ada5028b7a266bd090b593593c
2010-08-05 13:58:20 -07:00
Makoto Onuki
630e31ef78 Introducing ThrottlingCursorLoader.
This is a {@link CursorLoader} variant that takes {@code timeoutSecond}
in the constructor.

When it detects changes in the underlying data, it'll wait until the timeout
before doing a requery.

We use this to throttle # of queries.  We don't want to issue a query every
time something changes in the DB while we're syncing.

Change-Id: I098366bce923c3242c42964bc166493610ee0f6f
2010-08-03 17:45:51 -07:00
Makoto Onuki
833fe73b99 Aadd special boxes to mailbox list.
Change-Id: I36616f53555346ca7fbb6f3426a0c3196d7bacbc
2010-08-03 17:06:04 -07:00
Makoto Onuki
7ef278202e Clean up MailboxListFragment.
- Remove AsyncTasks, and use CursorLoader to load data.
- Get message counts for the drafts/trash mailboxes directly from
  the db column.
- Remove obsolete code from MailboxesAdapter.

Change-Id: I93c72977c19b60581e1169ba9bd429912ba3e68f
2010-08-02 16:33:23 -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
ec15f2356e Extract the mailbox lookup logic into an independent class
This new class MailboxFinder is responsible for looking for a mailbox
by an account id and a mailbox type.

If a mailbox is not found on the first try, it'll tell Controller
to refresh the mailbox list, and try again later.

This will be used by MessageListXL.

Change-Id: I4adc3db025fb271c254aa2b58b3b753281dc7398
2010-07-28 16:36:34 -07:00
Makoto Onuki
d9907c7641 Merge "Adding account selector." 2010-07-28 14:12:37 -07:00
Makoto Onuki
ee216da74a Adding account selector.
Also
- Renamed MessageListXLFragmentManager.setStart to onStart.  (was typo)
- Fixed flag handling bug in MailboxListFragment
- Fixed the R key handling code.  (The first R key was always ignored,
  because the default requested orientation was neither landscape or
  portrait.)

Change-Id: I0e14ce9f4fc5be973f7c0091f88fd4551a4329fa
2010-07-28 13:41:57 -07:00
Makoto Onuki
bcf32320e2 Move isSecurityHold/clearAccountHoldFlags to Account
- Added unit tests
- I see the "open a cursor, move to the first row, read a column" pattern over
  and over.  Added a utility method for this.  (Let's try not to bloat the
  binary by copying code around!)
- Added helper classes for database related tests
- Removed code dup

Change-Id: I380959215cc1661b252158f0f6e35369b499cdf8
2010-07-28 11:12:38 -07:00
Makoto Onuki
0943a75ba8 Merge "Refactoring MessageListXL" 2010-07-27 15:47:01 -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
02fa70aa18 Refactoring MessageListXL
I always thought our Activities are way too fat, meaning we've put too many
things into activities without any structure.

The major problems with this are:
- They have too many fields, which are not final and not even orthogonal.
  This makes them very hard to understand/maintain.  Changing one tiny bit
  can always cause unanticipated side-effects.
- Very hard, or almost impossible to test.

I really think we should break them into independent and self-contained
subcomponents which can be tested separately.

Introducing MessageListXLStateManager, which manages the current account,
mailbox and message, and show/hide/update fragments accordingly
for MessageListXL.

With this class, MessageListXL will be able to switch accounts/mailboxes/
messages by just calling the methods such as selectAccount(), without
worrying about when to show/hide what fragment and how to initialize them.
(In other words, MessageListXLStateManager encapsulates the two-pane screen
transition.  It's not intended to be reused for the phone UI.)

I didn't make it a nested class in MessageListXL, because nested classes can't
have real private members (private member are accessible from outer classes and
even brother classes!!), and I wanted it to be really self-contained anyway.

Change-Id: I1c121e99e30f12cc118e1c35abc9b30f49939a4a
2010-07-27 15:10:54 -07:00
Makoto Onuki
f08b061ea8 Merge "Rotate screen when the R key is pressed." 2010-07-26 12:47:45 -07:00
Makoto Onuki
3894be2fe0 Merge "Adding lifecycle log to fragments." 2010-07-26 12:46:50 -07:00
Makoto Onuki
833eae6ac8 Adding lifecycle log to fragments.
Change-Id: If83486b50c924fdb99a422814ede66da710bfc2d
2010-07-26 11:33:06 -07:00