* 'Issue_4503_auto-fit_messages_option' of https://github.com/zjw/k-9:
Revert "Don't show a disabled preference if there is nothing a user can do to enable it."
Fix indentation
Correct preference version number.
Issue 4503: Auto-fit messages option
Don't show a disabled preference if there is nothing a user can do to enable it.
Reported for Kaiten:
java.lang.IllegalStateException: Can not perform this action after
onSaveInstanceState
...
at android.support.v4.app.DialogFragment.dismiss
Previously the activity theme was used to display the auto-complete
suggestions. This lead to unreadable text when the activity theme was
different from the "composer theme".
This was disabled in faa666394c
because it isn't possible to extract the name of the android
contact in the 'ORDER BY...' clause when querying the database.
Instead it simply sorts by the email address.
This may cause the same contact to appear multiple times in
the list, if they have multiple email addresses assigned.
But in most cases this is good enough and surely better than
not having the option to sort by sender at all.
Desktop mail clients such as Thunderbird also simply use the
sender email information when sorting the column.
This also adds a SenderComparator for usage in the MergeCursor.
Seemingly the intents in the task back stack got confused when the
pending intent was updated in those versions (the Accounts intent was
delivered to MessageList). Avoid that by not updating the current
intent, but dropping the old one.
Fixes issue #4955.
Previously messages in the local Trash folder were marked as deleted,
then deleted from the server. During the next sync the placeholders for
deleted messages are removed from the database.
Obviously this doesn't work for POP3 accounts because the Trash folder
can't be synchronized with the server. So, for POP3, we now immediately
clear out all messages in that folder.
The server search itself does work. But the results are not displayed
to the user because only the message headers of found messages are
downloaded and the subsequent search in the local database won't return
those messages.
This requires another database schema change. With this change messages
at the root of a thread reference themselves in the 'threads' table,
i.e. 'root' contains the value of 'id' for these messages. It makes
selecting all messages in a thread much simpler.
Dynamically generate the CSS style for <pre> elements
for inclusion in the HTML <head> element when messages
are displayed.
This permits a user to change their font-family preference
for plain text messages and see the results immediately.
Obviously any old locally-stored messages that had their
font-family stored with them will continue to display using
that font-family, irrespective of the user's current
preference setting.
The MIME type for the supplied text was always text/html,
so there is no need to pass that as a parameter.
Furthermore, we are relying on it being text/html because
we are wrapping it with HTML code.
Likewise, change/simplify/rename AccessibleWebView.loadDataWithBaseURL().
Previously, <html>, <head>, & <body> tags were
attached to messages before they were stored locally.
But now that the <head> element also needs to include
a <meta> element (for proper MessageWebView display),
it seems unecesary to store all these tags with each
message.
Now the tags are no longer stored with the messages. Instead,
MessageWebView applies the tags before displaying the message.
This also eliminates the need to upgrade an older
message database where all the old messages would have
otherwise needed to be wrapped with the new tags.
Now that MessageWebView has 'setUseWideViewPort(true)',
the wide view port is excessively wide. It turns out
Android is using a fixed width of 980 px, so that even
plain text messages (which are already wrapped to fit
the screen) have a large empty area beside them when
scrolled to the left.
Injecting a meta tag in the html header fixes the
problem.
Database updates can be surprisingly slow. This lead to slow updates of
the user interface which in turn made working with K-9 Mail not as fun
as it should be. This commit hopefully changes that.
This happened for example in a starred-message-only view when
un-starting the last message. This led to isFirst() and isLast()
causing a NullPointerException when trying to update the
previous / next buttons.
- 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
This fixes the following scenario:
- Get a mail notification
- Click on notification -> message view appears
- Press home
- Get a new notification
- Click on notification -> last instead of new message is displayed
This way also the From: selection, To:, Cc, and Bcc: are themed correctly.
It looks more homogeneous and is consistent with the looks of the MessageView.
by default.
The message view theme isn't something the user is likely to change on a
regular basis, so we don't need to clutter the message view menu with
this setting. The menu item can still be enabled for those who want it.
The ContextThemeWrapper added in a74d57cb71
used getActivity().getApplicationContext() to get the base context.
This is wrong, because an Application context won't work for starting
activities from the WebView.
Instead, use the context that is given to us in the constructor as base
context. This is the one that would also be used if no ContextThemeWrapper
was present at all.
- 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.
When MessageListFragment is on the back stack and the device is rotated
the instance state will be restored but no new view will be created. If
the device is rotated again onSaveInstanceState() is called and we have
to take care not to assume that the views have been created.
Remove the fadeout to make things look a little less weird
Make the animations slide in from the edge. (See the aforementioned comment about jankyness)
TODO: don't remove the message view until _after_ the animation runs. Before HC, that requires rather a lot more code (writing a whole animationadapter) than it should.
TODO: get the messageview to stop jumping to hide the header area as it's displayed.
- Since the split-view change, MessageView is only a fragment, so we
can't call setTheme() anymore so easily.
Instead, use a ContextThemeWrapper and use that to inflate the
layout. This way the message header and attachment view
are styled correctly.
- The HTC WebView fix in SingleMessageView was returning the wrong
background color, when message view theme and global theme differ,
because it always used the global theme to retrieve it.
Fix: Specifically put the light/dark values in the themes.xml,
and get them using getContext().getTheme().resolveAttribute().
getContext() will use the ContextThemeWrapper from above, so
even if the global and message view themes differ, it aleays
returns the correct one.
The getThemeBackgroundColor() method added to the K9ActivityMagic
interface in 309eeb72ac is now not
needed anymore, and was removed.
Some people prefer them over swiping / volume keys.
They could probably be made optional so they can be hidden.
Also: delete the now unused message_view_fragment.xml and message_view_option.xml.
Calling configureMenu() inside updateMenu() doesn't update the
buttons properly. Instead, call invalidateOptionsMenu(). This forces
the menu to be re-created, and onPreareOptionsMenu() to be called.
From there, configureMenu() is called automatically.
The commit that introduced those notifications also introduced a rather
... interesting design pattern: The CertificateValidationException
notified the user of its pure existance - it's no longer a 'message'
only, but defines policy. As this is more than unusual, replace this
pattern by the MessagingController treating
CertificateValidationException specially when accessing remote folders.
Also make clear which account failed when constructing the notification.
The previous code worked fine on Android 4.2. But the lifecycle on older
Android versions (tested with 2.2) seems to be slightly different. This
should fix the problem.
- show thread as starred if at least one message in it is starred
- use arrival date of last message as thread arrival date
- use sum of message attachment counts in thread as thread attachment
count
- show thread as answered/forwarded if all messages in thread were
answered/forwarded
* zjw/folder_search:
Provide message search capability from the folder list.
Eliminate unused code.
Switch to using the action bar for folder searches.
Use a more appropriate title when diplaying folder search results.
Switch to using the action bar for folder searches.
Provide new action bar "find folder" icons
Create action buttons to search for folders.
Readjust settings version number based on current master
Control wrapping of folder names programmatically only
Permit the folder list item to expand vertically.
Create new preference option for wrapping folder names in folder list view.
Issue 1911: Permit folder names to wrap on multiple lines in folder list view so users can see the entire name.
* zjw/progress_indicators:
Provide a progress indicator while loading remote search results.
Remove the progress bar from the message list footer.
Provide progress indicator for searches.
Conflicts:
src/com/fsck/k9/activity/MessageList.java
Through shortcuts, widgets, etc. users can start the app using another
activity than Accounts. We still want to display the database upgrade
screen in such cases.
Eliminate the old-style search dialog box. A similar change
was previously made when searching from the folder list. This
change is applicable when searching while choosing a
folder (e.g. a destination folder for a copy operation).
Searches can be slow, so users need an indicator. The indicator is
also used when opening a message list or when refreshing it, or when
loading more messages.
This also removes some unused code.
With this fix, a CertPathValidatorException or CertificateException will
create a "Certificate error: Check your server settings" notification
in the status bar. When the user clicks on the notification, they are
taken to the appropriate server settings screen where they can review their
settings and can accept a different server certificate.
This removes the default settings (ellipsized, single line) from the layout
xml file and implements them programmatically. This fixes the problem where:
You are viewing a folder list while wrapping is currently on, then you go into settings
and turn wrapping off, after which you are back at the folder list, but the
list is still wrapped.
Test case:
- Have two accounts A and B
- Get a mail on A
- Get a mail on B
- Click on the notification for A
Result:
You end up seeing the message from B instead of A
The reason for that is that we need to register separate PendingIntents
for each account.
Both items are commonly used even by the average user (and likely both
are used more commonly than 'clear local messages'), so it makes
sense to provide them in the context menu as well as the action bar.
- If a message contained in the inbox list is deleted or read while
there are messages in the overflow list, restore the newest message
from the overflow list so there are always 5 messages in the inbox
list in that case.
- Use explicit methods instead of method overriding.
LocalMessage already has a content preview in it; reuse that.
Remove unneeded MimeMessage#getPreview() method now that we don't need
to generate a preview anymore.