Commit Graph

523 Commits

Author SHA1 Message Date
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
Makoto Onuki 0f6e1c9e49 Rotate screen when the R key is pressed.
Workaround for auto-orientation not working on the device (bug 2865868).

Change-Id: Ie1e7c802c0c816338aea1f56f6e86991df241f3b
2010-07-26 11:16:02 -07:00
Makoto Onuki a51097c1b8 Fix STOPSHIP: Show account name as subtitle.
Change-Id: Ie617ade795526c349f7a401115e6e04831096587
2010-07-22 17:22:42 -07:00
Makoto Onuki 9ddd1e7fa4 Small changes to list fragments.
- Added parameter check to openXxx methods.
- Clear the list before (re-)load the data, to make ListFragment show the
  "Loading..." animation.
- Moved a few lines around in MailboxListFragment.

Change-Id: I48d9759e118976bf9f8cce10069e2b9b5c253342
2010-07-22 15:46:00 -07:00
Makoto Onuki 65f6baf155 Merge "MessageListFragment: fix bug 2863240." 2010-07-22 15:41:58 -07:00
Makoto Onuki 15c6a98ea9 MessageListFragment: fix bug 2863240.
Also removed unused imports.

Bug 2863240

Change-Id: I0f7e9094c7afa8af0bf02745b1244fd2ddfae44c
2010-07-22 14:18:02 -07:00
Makoto Onuki 8167070158 Refactoring MailboxListFragment
- Broke down bindActivityInfo into setCallback and openMailboxes()
- openMailboxes() can be called multiple times against the same instance.
  (We won't have to re-create the left pane on XL screen)
- Added EmptyCallback to avoid null checks
- Renamed a callback method

Change-Id: I3848a6f6da7f1782dcc9566967f8618ed79a878e
2010-07-22 11:22:37 -07:00
Makoto Onuki 3918b0dbfc Merge "Renaming message_view_header.xml to message_view_fragment.xml" 2010-07-22 10:33:12 -07:00
Marc Blank e6cc662abc Use AccountManager for POP/IMAP; refactor setup classes
There are two major, interrelated parts to this CL:

1) Clean up the activities to reduce the use of Intents to pass
   information between activities; instead, we use a common
   SetupData structure that automatically saved/restored as necessary
   during the setup flow.  A fair amount of code and inconsistent
   use of Bundle extras has been eliminated in the process.

   * Create SetupData structure, setters/getters, and initialization
     methods to simplify the preservation of state during setup flow
   * Remove all state/flow extras from Intents; Intents now only
     specify the Activity to be started, which should greatly simplify
     the transition to Fragments.
   * Remove all state/flow fields from Activities
   * Modify existing setup activity unit tests and confirm tests pass

2) Create AccountManager accounts for POP/IMAP email accounts to
   provide consistency in user experience.  Also, internal flows are
   now identical as between account types.

   * Move account reconciliation from SyncManager to MailService, so
     that reconciliation is consistent between email and exchange
     accounts; move unit tests as appropriate
   * Add a "Sync Email" setting for POP/IMAP/EAS
   * Change MailService to respect the "Sync Email" setting in
     Settings -> Accounts & sync
   * Create PopImapSyncAdapterService to handle manual POP/IMAP sync as
     requested by SyncManager; add EmailSyncAdapterService to perform
     the same function for EAS
   * Use new PopImapAuthenticatorService to add AccountManager accounts
     for POP/IMAP accounts; setup appropriate stanzas in AndroidManifest
     and add related xml files
   * Update AccountSettings to use SetupData

Miscellaneous other changes:

   * Only allow valid port numbers in incoming/outgoing setup

Bug: 1712475

Change-Id: Ibdac52fb2c5578b86bf3992ddb1acd10f162391a
2010-07-21 19:01:41 -07:00
Makoto Onuki 411314990d Renaming message_view_header.xml to message_view_fragment.xml
Change-Id: Id0ccc13bfd8dfa63b450d46989938295ba8e78e0
2010-07-21 17:23:39 -07:00
Makoto Onuki d6a2978857 First cut of two pane activity.
How to launch:
- Kick "Email 2 Pane" in the app drawer.

Major known issues:
- When you launches "Email 2 Pane", it starts directly; the logic in Welcom
  won't be executed.
- There's no UI to add accounts.  Use the old UI.
- There's no way to select non-default accounts.
- The on-screen buttons except for older/newer don't work.
- No contex menus work.

Change-Id: I38374acafafbae62e46f84294a7677e54686cfc2
2010-07-21 16:30:52 -07:00
Makoto Onuki bab0d45904 Merge "Fragmentize MessageView." 2010-07-21 14:21:06 -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 37e21ab968 Don't call setListAdapter until adapter is ready.
ListFragment shows the "Loading..." animation for us until setListAdapter is
first called.  In order to make use of it, setListAdapter should be called
only when the underlying data is ready.

Change-Id: Iac903b1f10ad7ed4be04446ddb2d2172e84bfe16
2010-07-19 17:17:14 -07:00
Marc Blank ed833ee7ae Merge "Make sure signature is added to reply/forward" 2010-07-14 14:48:53 -07:00
Makoto Onuki d73d8e4839 Use ListFragment.setListAdapter, not ListView.setAdapter.
Otherwise ListFragment wouldn't notice an adapter is set.

Bug 2841063

Change-Id: Iddb40125020ee2b72ed72b93643582929dc7f7eb
2010-07-14 14:37:09 -07:00
Marc Blank ec29471c73 Make sure signature is added to reply/forward
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case

Bug: 2734321
Change-Id: I6be8383fe5f217a4bda8e669cb69f439bc8e96b6
2010-07-14 12:43:37 -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 7daacf83a4 Switch to ListFragment, and use its default layout.
Change-Id: If8dead170a3662cbde87e6ead244363b11db01f6
2010-07-09 13:22:53 -07:00
Dianne Hackborn 7e071d6956 Fix the build -- follow API change.
Change-Id: I7a177a3bbd5b374cfdc2dd708cc8b1acd8c19a92
2010-07-08 16:05:11 -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
Makoto Onuki 42e3f10a95 Use "*#*#36245#*#*" to activate the debug screen.
Dial *#*#36245#*#* on the dialer to activate the debug screen.
"36245" = "email"

It's useful when
- There's no keyboard.
- There's no account set up yet.
  (You can do it by entering the special username/password on new account
  screen, but that's a bit of a pain.)

It's also easier to tell to people.

Also, removed "sensitive logging", which should never be used.

Change-Id: Id692f8b216f2d85abe1880c452d2067f170dac83
2010-07-01 16:15:07 -07:00
Andrew Stadler d5b2da3716 Add ActionBar to MailboxList
Note: This does not appear in UX wireframes, this activity is going
away eventually, but it's a good testbed for ActionBar to be tried out.

Open issues:
1.  Waiting for progress indicator support, using unattractive hack
2.  Subtitle doesn't seem to work so putting account name in title
    (which is the wrong font size for phone portrait mode).

Change-Id: Iee3cac7d4f30ea210bd8f3838b69ed12cd498375
2010-06-29 16:49:47 -07:00
Andrew Stadler 0d6ce631a1 ActionBar for AccountFolderList
Displays actionbar properly, and the two buttons work.

Submitting with one open issue:
1.  The indeterminate progress indicator is not directly supported in the
    ActionBar.  We're waiting for a UI call or framework support.  Until
    then there is a placeholder using an incorrect icon to show progress.

Change-Id: Iaf1546931376cc5b540820cd0fc020ebd176dabf
2010-06-28 16:00:25 -07:00
Marc Blank d6d874f8c6 Streamline security setup flow
* The setup flow is changed such that the user is asked to activate
  device administration before leaving the setup flow, rather than
  having to wait for the notification to appear, etc.
* Accounts requiring security are created in a security hold state
  to prevent initial sync until device administration is active

Change-Id: I7e33cf98466370ae27414b99018f7aee71e9e237
2010-06-25 09:32:11 -07:00
Makoto Onuki 5160a660c4 Merge "MessageList: Introducing "selection mode"." 2010-06-23 16:29:44 -07:00