1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -05:00

MessageList: add setting to allow 0 preview lines

This commit is contained in:
m0viefreak 2013-01-28 04:40:04 +01:00
parent bfdee8161c
commit dae3b776ff
2 changed files with 15 additions and 11 deletions

View File

@ -630,6 +630,7 @@
</string-array>
<string-array name="settings_preview_lines_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
@ -639,6 +640,7 @@
</string-array>
<string-array name="settings_preview_lines_entries">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>

View File

@ -1654,7 +1654,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
holder.preview.setLines(mPreviewLines);
// 1 preview line is needed even if it is set to 0, because subject is part of the same text view
holder.preview.setLines(Math.max(mPreviewLines,1));
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
holder.threadCount = (TextView) view.findViewById(R.id.thread_count);
holder.threadCountWrapper = (View) view.findViewById(R.id.thread_count_wrapper);
@ -1692,11 +1693,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
Date sentDate = new Date(cursor.getLong(DATE_COLUMN));
String displayDate = mMessageHelper.formatDate(sentDate);
String preview = cursor.getString(PREVIEW_COLUMN);
if (preview == null) {
preview = "";
}
int threadCount = (mThreadedList) ? cursor.getInt(THREAD_COUNT_COLUMN) : 0;
String subject = cursor.getString(SUBJECT_COLUMN);
@ -1763,11 +1759,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
String sigil = recipientSigil(toMe, ccMe);
holder.preview.setText(
new SpannableStringBuilder(sigil)
.append(beforePreviewText)
.append(" ")
.append(preview), TextView.BufferType.SPANNABLE);
SpannableStringBuilder messageStringBuilder = new SpannableStringBuilder(sigil)
.append(beforePreviewText);
if (mPreviewLines > 0) {
String preview = cursor.getString(PREVIEW_COLUMN);
if (preview != null) {
messageStringBuilder.append(" ").append(preview);
}
}
holder.preview.setText(messageStringBuilder, TextView.BufferType.SPANNABLE);
Spannable str = (Spannable)holder.preview.getText();