Remove memory leak from referencing MessageView context from the
Intent that is created to go back to MessageList. MessageView is no
longer hardcoded to go back to MessageList, it instead uses an Intent
given at creation to get back to the originating Activity.
Try our best to restore the MessageList in its previous state when
"Manage BACK button" option is enabled:
Since MessageList lives in its own task, we look for the previous
active task and check whether its top activity matches it. If it does,
we just finish MessageView and Android will automatically restore the
previous task. If it doesn't, we launch the originating Intent (and
MessageList state will be lost).
If option is off, we get the regular Android behavior: got back to the
previous screen, whenever it's the MessageList or another application
if the user long-pressed HOME.
The consequence of this is the need for a new permission in order to
check the previous active task: android.permission.GET_TASKS
Switched MessageList from singleTask to singleInstance launchMode
http://stackoverflow.com/questions/2417468/android-bug-in-launchmode-singletask-activity-stack-not-preserved
This makes launched activities to initiate a new task, they have to
handle the BACK key if user has the option enabled. On the other hand,
K-9 still keeps a single instance of MessageList (as opposed to using
the default launch mode which would allow multiple instances -
potential increased memory usage).
See Issue 2467
Includes:
- compiler warnings (more warnings than the default Java settings)
- variable prefixes
- formatter rules
Compiler warnings is stricter regarding bad practices (even for things
like auto-boxing).
Chances are that those formatter settings match almost no existing
files as I just adjusted my settings to match Android coding standard.
reloading
As part of automatic activity reloading following a configuration
change, Android invokes Activity#onPrepareDialog() even for dismissed
dialogs. Consequently, one can't make the assumption that this method
is only invoked by explicit calls to Activity#showDialog() from our
code.
The actual problem here was the mActiveMessages member being null
at such times.
Message operations should be more consistent now, regardless of how
the messages are selected (long click, checkbox+Menu, future group selection).
This is a backport of the modifications made on the issue258 branch,
without the threading specific features (no new feature introduced).
This reverts commit 0c2e06133c.
The patch would cause an extra SMTP connection on _any_ meesage with
attachments. Marcus is headed away on holiday and asked me to revert it
for him (after I asked him to revert it) - With luck, we'll talk through
a design to work around this issue on the list
Conflicts:
src/com/fsck/k9/mail/transport/SmtpTransport.java