mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
redo our messagelist sigil code to not break sender colorization
This commit is contained in:
parent
724169e982
commit
6704279042
@ -978,6 +978,6 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
|
|
||||||
<string name="debug_logging_enabled">Debug logging to Android logging system enabled</string>
|
<string name="debug_logging_enabled">Debug logging to Android logging system enabled</string>
|
||||||
|
|
||||||
<string name="messagelist_sent_to_me_format">» <xliff:g id="sender">%s</xliff:g></string>
|
<string name="messagelist_sent_to_me_sigil">»</string>
|
||||||
<string name="messagelist_sent_cc_me_format">› <xliff:g id="sender">%s</xliff:g></string>
|
<string name="messagelist_sent_cc_me_sigil">›</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2709,26 +2709,25 @@ public class MessageList
|
|||||||
* from.
|
* from.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CharSequence sender = formatSender(message);
|
holder.preview.setText(new SpannableStringBuilder(recipientSigil(message)).append(message.sender).append(" ").append(message.preview),
|
||||||
holder.preview.setText(new SpannableStringBuilder(sender).append(" ").append(message.preview),
|
|
||||||
TextView.BufferType.SPANNABLE);
|
TextView.BufferType.SPANNABLE);
|
||||||
Spannable str = (Spannable)holder.preview.getText();
|
Spannable str = (Spannable)holder.preview.getText();
|
||||||
|
|
||||||
// Create our span sections, and assign a format to each.
|
// Create our span sections, and assign a format to each.
|
||||||
str.setSpan(new StyleSpan(Typeface.BOLD),
|
str.setSpan(new StyleSpan(Typeface.BOLD),
|
||||||
0,
|
0,
|
||||||
sender.length(),
|
(message.sender.length()+1),
|
||||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
);
|
);
|
||||||
str.setSpan(new ForegroundColorSpan(Color.rgb(128,128,128)), // TODO: How do I can specify the android.R.attr.textColorTertiary
|
str.setSpan(new ForegroundColorSpan(Color.rgb(128,128,128)), // TODO: How do I can specify the android.R.attr.textColorTertiary
|
||||||
sender.length(),
|
(message.sender.length()+1),
|
||||||
str.length(),
|
str.length(),
|
||||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
holder.from.setText(formatSender(message));
|
holder.from.setText(new SpannableStringBuilder(recipientSigil(message)).append( message.sender));
|
||||||
|
|
||||||
holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
||||||
}
|
}
|
||||||
@ -2742,19 +2741,19 @@ public class MessageList
|
|||||||
holder.position = position;
|
holder.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CharSequence formatSender (MessageInfoHolder message)
|
private String recipientSigil (MessageInfoHolder message)
|
||||||
{
|
{
|
||||||
if (message.toMe)
|
if (message.toMe)
|
||||||
{
|
{
|
||||||
return String.format(getString(R.string.messagelist_sent_to_me_format), message.sender);
|
return getString(R.string.messagelist_sent_to_me_sigil);
|
||||||
}
|
}
|
||||||
else if (message.ccMe)
|
else if (message.ccMe)
|
||||||
{
|
{
|
||||||
return String.format(getString(R.string.messagelist_sent_cc_me_format), message.sender);
|
return getString(R.string.messagelist_sent_cc_me_sigil);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return message.sender;
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user