1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-08-13 16:53:50 -04:00

Message: Direct access icon property instead of using getter

This commit is contained in:
Sebastian Kaspari 2010-04-01 01:07:30 +02:00
parent 1e9be66603
commit a056b56855

View File

@ -78,16 +78,6 @@ public class Message {
return icon;
}
/**
* Does this message have an icon?
*
* @return
*/
public boolean hasIcon()
{
return icon != -1;
}
/**
* Get the text of this message
*
@ -116,12 +106,12 @@ public class Message {
Settings settings = new Settings(context);
if (canvas == null) {
String prefix = hasIcon() && settings.showIcons() ? " " : "";
String prefix = icon != -1 && settings.showIcons() ? " " : "";
String timestamp = settings.showTimestamp() ? Message.generateTimestamp(this.timestamp, settings.use24hFormat()) : "";
canvas = new SpannableString(prefix + timestamp + text);
if (hasIcon() && settings.showIcons()) {
if (icon != -1 && settings.showIcons()) {
Drawable drawable = context.getResources().getDrawable(icon);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
canvas.setSpan(new ImageSpan(drawable, ImageSpan.ALIGN_BOTTOM), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);