mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-17 21:32:26 -05:00
Introduced setting to change the font size of the message preview in the message list.
Fixes issue 2788
This commit is contained in:
parent
605a0bdc93
commit
a1e059e871
@ -79,7 +79,7 @@
|
||||
android:layout_marginRight="0dip"
|
||||
android:singleLine="false"
|
||||
android:bufferType="spannable"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -124,7 +124,7 @@
|
||||
<string name="folder_context_menu_title">Folder options</string>
|
||||
|
||||
<string name="general_no_subject">(No subject)</string> <!-- Shown in place of the subject when a message has no subject. Showing this in parentheses is customary. -->
|
||||
|
||||
<string name="general_no_date">No date</string>
|
||||
<string name="general_no_sender">No sender</string>
|
||||
<string name="status_loading">Polling</string>
|
||||
<string name="status_loading_folder">(Poll <xliff:g id="folder">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string>
|
||||
@ -937,6 +937,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="font_size_message_list_subject">Subject</string>
|
||||
<string name="font_size_message_list_sender">Sender</string>
|
||||
<string name="font_size_message_list_date">Date</string>
|
||||
<string name="font_size_message_list_preview">Preview</string>
|
||||
|
||||
<string name="font_size_message_view">Messages</string>
|
||||
<string name="font_size_message_view_sender">Sender</string>
|
||||
|
@ -80,6 +80,14 @@
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_date" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_list_preview_font"
|
||||
android:title="@string/font_size_message_list_preview"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_preview" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
@ -134,7 +142,7 @@
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_date" />
|
||||
|
||||
<ListPreference
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_additional_headers_font"
|
||||
android:title="@string/font_size_message_view_additional_headers"
|
||||
|
@ -19,6 +19,7 @@ public class FontSizes
|
||||
private static final String MESSAGE_LIST_SUBJECT = "fontSizeMessageListSubject";
|
||||
private static final String MESSAGE_LIST_SENDER = "fontSizeMessageListSender";
|
||||
private static final String MESSAGE_LIST_DATE = "fontSizeMessageListDate";
|
||||
private static final String MESSAGE_LIST_PREVIEW = "fontSizeMessageListPreview";
|
||||
private static final String MESSAGE_VIEW_SENDER = "fontSizeMessageViewSender";
|
||||
private static final String MESSAGE_VIEW_TO = "fontSizeMessageViewTo";
|
||||
private static final String MESSAGE_VIEW_CC = "fontSizeMessageViewCC";
|
||||
@ -75,6 +76,11 @@ public class FontSizes
|
||||
*/
|
||||
private int messageListDate;
|
||||
|
||||
/**
|
||||
* Font size of message preview in the message list activity.
|
||||
*/
|
||||
private int messageListPreview;
|
||||
|
||||
/**
|
||||
* Font size of the message sender in the message view activity.
|
||||
*/
|
||||
@ -131,6 +137,7 @@ public class FontSizes
|
||||
messageListSubject = SMALL;
|
||||
messageListSender = SMALL;
|
||||
messageListDate = SMALL;
|
||||
messageListPreview = SMALL;
|
||||
|
||||
messageViewSender = SMALL;
|
||||
messageViewTo = FONT_12DIP;
|
||||
@ -157,6 +164,7 @@ public class FontSizes
|
||||
editor.putInt(MESSAGE_LIST_SUBJECT, messageListSubject);
|
||||
editor.putInt(MESSAGE_LIST_SENDER, messageListSender);
|
||||
editor.putInt(MESSAGE_LIST_DATE, messageListDate);
|
||||
editor.putInt(MESSAGE_LIST_PREVIEW, messageListPreview);
|
||||
|
||||
editor.putInt(MESSAGE_VIEW_SENDER, messageViewSender);
|
||||
editor.putInt(MESSAGE_VIEW_TO, messageViewTo);
|
||||
@ -184,6 +192,7 @@ public class FontSizes
|
||||
messageListSubject = prefs.getInt(MESSAGE_LIST_SUBJECT, messageListSubject);
|
||||
messageListSender = prefs.getInt(MESSAGE_LIST_SENDER, messageListSender);
|
||||
messageListDate = prefs.getInt(MESSAGE_LIST_DATE, messageListDate);
|
||||
messageListPreview = prefs.getInt(MESSAGE_LIST_PREVIEW, messageListPreview);
|
||||
|
||||
messageViewSender = prefs.getInt(MESSAGE_VIEW_SENDER, messageViewSender);
|
||||
messageViewTo = prefs.getInt(MESSAGE_VIEW_TO, messageViewTo);
|
||||
@ -265,6 +274,16 @@ public class FontSizes
|
||||
this.messageListDate = messageListDate;
|
||||
}
|
||||
|
||||
public int getMessageListPreview()
|
||||
{
|
||||
return messageListPreview;
|
||||
}
|
||||
|
||||
public void setMessageListPreview(int messageListPreview)
|
||||
{
|
||||
this.messageListPreview = messageListPreview;
|
||||
}
|
||||
|
||||
public int getMessageViewSender()
|
||||
{
|
||||
return messageViewSender;
|
||||
|
@ -13,14 +13,13 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.animation.Animation;
|
||||
@ -69,12 +68,9 @@ import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mail.Folder;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.store.LocalStore;
|
||||
import com.fsck.k9.mail.store.StorageManager;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
||||
import com.fsck.k9.view.ColorChip;
|
||||
|
||||
|
||||
/**
|
||||
@ -2665,7 +2661,7 @@ public class MessageList
|
||||
if (mTouchView)
|
||||
{
|
||||
holder.preview.setLines(mPreviewLines);
|
||||
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
|
||||
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListPreview());
|
||||
|
||||
}
|
||||
else
|
||||
@ -2686,22 +2682,30 @@ public class MessageList
|
||||
// hands us an invalid message
|
||||
|
||||
holder.chip.getBackground().setAlpha(0);
|
||||
holder.subject.setText("No subject");
|
||||
holder.subject.setText(getString(R.string.general_no_subject));
|
||||
holder.subject.setTypeface(null, Typeface.NORMAL);
|
||||
String noSender = getString(R.string.general_no_sender);
|
||||
if (holder.preview != null)
|
||||
{
|
||||
holder.preview.setText("No sender");
|
||||
holder.preview.setTypeface(null, Typeface.NORMAL);
|
||||
holder.preview.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
holder.preview.setText(noSender, TextView.BufferType.SPANNABLE);
|
||||
Spannable str = (Spannable) holder.preview.getText();
|
||||
|
||||
ColorStateList color = holder.subject.getTextColors();
|
||||
ColorStateList linkColor = holder.subject.getLinkTextColors();
|
||||
str.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, mFontSizes.getMessageListSender(), color, linkColor),
|
||||
0,
|
||||
noSender.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.from.setText("No sender");
|
||||
holder.from.setText(noSender);
|
||||
holder.from.setTypeface(null, Typeface.NORMAL);
|
||||
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
}
|
||||
|
||||
holder.date.setText("No date");
|
||||
holder.date.setText(getString(R.string.general_no_date));
|
||||
|
||||
//WARNING: Order of the next 2 lines matter
|
||||
holder.position = -1;
|
||||
@ -2777,21 +2781,19 @@ public class MessageList
|
||||
* from.
|
||||
*/
|
||||
|
||||
holder.preview.setText(new SpannableStringBuilder(recipientSigil(message)).append(message.sender).append(" ").append(message.message.getPreview()),
|
||||
TextView.BufferType.SPANNABLE);
|
||||
holder.preview.setText(new SpannableStringBuilder(recipientSigil(message))
|
||||
.append(message.sender).append(" ").append(message.message.getPreview()),
|
||||
TextView.BufferType.SPANNABLE);
|
||||
Spannable str = (Spannable)holder.preview.getText();
|
||||
|
||||
// Create our span sections, and assign a format to each.
|
||||
str.setSpan(new StyleSpan(senderTypeface),
|
||||
0,
|
||||
(message.sender.length()+1),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
);
|
||||
str.setSpan(new ForegroundColorSpan(Color.rgb(128,128,128)), // TODO: How do I can specify the android.R.attr.textColorTertiary
|
||||
(message.sender.length()+1),
|
||||
str.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
);
|
||||
// Create a span section for the sender, and assign the correct font size and weight.
|
||||
ColorStateList color = holder.subject.getTextColors();
|
||||
ColorStateList linkColor = holder.subject.getLinkTextColors();
|
||||
str.setSpan(new TextAppearanceSpan(null, senderTypeface, mFontSizes.getMessageListSender(), color, linkColor),
|
||||
0,
|
||||
message.sender.length() + 1,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ public class FontSizeSettings extends K9PreferenceActivity
|
||||
private static final String PREFERENCE_MESSAGE_LIST_SUBJECT_FONT = "message_list_subject_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_SENDER_FONT = "message_list_sender_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_DATE_FONT = "message_list_date_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_PREVIEW_FONT = "message_list_preview_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_SENDER_FONT = "message_view_sender_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_TO_FONT = "message_view_to_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_CC_FONT = "message_view_cc_font";
|
||||
@ -45,6 +46,7 @@ public class FontSizeSettings extends K9PreferenceActivity
|
||||
private ListPreference mMessageListSubject;
|
||||
private ListPreference mMessageListSender;
|
||||
private ListPreference mMessageListDate;
|
||||
private ListPreference mMessageListPreview;
|
||||
private ListPreference mMessageViewSender;
|
||||
private ListPreference mMessageViewTo;
|
||||
private ListPreference mMessageViewCC;
|
||||
@ -97,6 +99,9 @@ public class FontSizeSettings extends K9PreferenceActivity
|
||||
mMessageListDate = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_DATE_FONT,
|
||||
Integer.toString(fontSizes.getMessageListDate()));
|
||||
mMessageListPreview = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_PREVIEW_FONT,
|
||||
Integer.toString(fontSizes.getMessageListPreview()));
|
||||
|
||||
mMessageViewSender = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_SENDER_FONT,
|
||||
@ -141,6 +146,7 @@ public class FontSizeSettings extends K9PreferenceActivity
|
||||
fontSizes.setMessageListSubject(Integer.parseInt(mMessageListSubject.getValue()));
|
||||
fontSizes.setMessageListSender(Integer.parseInt(mMessageListSender.getValue()));
|
||||
fontSizes.setMessageListDate(Integer.parseInt(mMessageListDate.getValue()));
|
||||
fontSizes.setMessageListPreview(Integer.parseInt(mMessageListPreview.getValue()));
|
||||
|
||||
fontSizes.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue()));
|
||||
fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue()));
|
||||
|
Loading…
Reference in New Issue
Block a user