This implements the AOSP Email solution for incorporating
a Webview inside a ScrollView, while still being able to
scroll diagonally.
This replaces the functionality of TitleBarWebView (which
is now removed).
The problem:
Configure the account (just an example -- problems can occur in other
configurations as well):
Message Format: HTML
Reply quoting style: Prefix
Quote message when replying: yes
Reply after quoted text: yes
Reply to a message that has a large quantity (20+) of \r\n scattered in
the body of its HTML version (not an unusual scenario).
Add a reply. Save the message as a draft. Go back & open the draft
again. A fatal IndexOutOfBoundsException occurs.
The cause:
When the draft was saved, the X-K9mail-Identity header was computed and
added to the message, then the text of the message was processed with
MimeUtility.fixDraftTextBody, replacing all occurrences of \r\n with \n in
the quoted message before being saved in LocalStore, thus invalidating the
X-K9mail-Identity header.
The fix:
Remove MimeUtility.fixDraftTextBody and implement
MessageCompose$EolConvertingEditText instead. Any message text placed in
an EolConvertingEditText widget is assured to have \n line endings. Any
message text extracted from an EolConvertingEditText widget is assured to
have \r\n line endings. The X-K9mail-Identity header will always be
computed correctly.
Issues thought to be related: 4782, 5010, 5634, 5725
As noted in some of the referenced issues, errors didn't always result in
a fatal exception, but instead with mixed up text.
Ref: commit f9a35aeaee
Update LocalStore code to handle the newly introduced temporary files
for attachments
Conflicts:
res/values/strings.xml
src/com/fsck/k9/activity/MessageCompose.java
Android allows other apps to access protected content of an app without requesting the
necessary permission when the app returns an Intent with FLAG_GRANT_READ_URI_PERMISSION.
This regularly happens as a result of ACTION_GET_CONTENT, i.e. what we use to pick content
to be attached to a message. Accessing that content only works while the receiving activity
is running. Afterwards accessing the content throws a SecurityException because of the
missing permission.
This commit changes K-9 Mail's behavior to copy the content to a temporary file in K-9's
cache directory while the activity is still running.
Fixes issue 4847, 5821
This also fixes bugs related to the fact that K-9 Mail didn't save a copy of attached content
in the message database.
Fixes issue 1187, 3330, 4930
- wrap chip around the whole header, including the subject
and the expanded additional headers area.
- mindor padding adjustments to make whitepsace around the
contact badge a bit more homogeneous.
Previously, they dominated both the message header as well as the
message list by their sheer size, at least on xhdpi (Nexus 4), although
they're certainly not the most important information in there.
- Android does not support ellipsize in combination with maxlines
for TextViews. This caused getEllipsisCount() in MessageTitleView
to always fail, and the full subject was never shown in the regular
headers area when needed.
To work around that, check for ourselves whether the text is
longer than 2, and ellipsize manually.
- Clicking the star button on a message caused the subject line to
re-appear, even if it fits in the action bar title without being
cut off. This was caused by MessageHeader.populate(), which always
set the subject to visible.
As a workaround: Only set subject to visible in case populate()
actually shows a new message.
- delete res/layout/actionbar_message_view.xml, its already present
in the actionbar_custom.xml
- The attachments view still had the wrong background color in case
of different global and message themes.
- The attachments view used the activity LayoutInflater, but it needs
to use the one of the fragment.
- The background drawable for the attachments used transparency, and
thus was completely invisible in the black theme. Fix it by adding
another one for the black theme.