mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Delay formatting of dates in messagelist until we actually need them
-- it turns out they're very expensive.
This commit is contained in:
parent
4e53ee12b6
commit
28c9dfdcce
@ -1,4 +1,5 @@
|
||||
package com.fsck.k9.activity;
|
||||
import com.fsck.k9.helper.MessageHelper;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fsck.k9.mail.Message;
|
||||
@ -51,4 +52,10 @@ public class MessageInfoHolder
|
||||
return uid.hashCode();
|
||||
}
|
||||
|
||||
public String getDate(MessageHelper messageHelper) {
|
||||
if (date == null) {
|
||||
date = messageHelper.formatDate(message.getSentDate());
|
||||
}
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
@ -2718,7 +2718,7 @@ public class MessageList
|
||||
holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
||||
}
|
||||
|
||||
holder.date.setText(message.date);
|
||||
holder.date.setText(message.getDate(mMessageHelper));
|
||||
holder.subject.setCompoundDrawablesWithIntrinsicBounds(
|
||||
message.answered ? mAnsweredIcon : null, // left
|
||||
null, // top
|
||||
|
@ -66,15 +66,6 @@ public class MessageHelper
|
||||
|
||||
target.folder = folder;
|
||||
|
||||
if (Utility.isDateToday(date))
|
||||
{
|
||||
target.date = mTodayDateFormat.format(date);
|
||||
}
|
||||
else
|
||||
{
|
||||
target.date = mDateFormat.format(date);
|
||||
}
|
||||
|
||||
target.hasAttachments = message.getAttachmentCount() > 0;
|
||||
|
||||
target.read = message.isSet(Flag.SEEN);
|
||||
@ -122,4 +113,14 @@ public class MessageHelper
|
||||
Log.w(K9.LOG_TAG, "Unable to load message info", me);
|
||||
}
|
||||
}
|
||||
public String formatDate(Date date) {
|
||||
if (Utility.isDateToday(date))
|
||||
{
|
||||
return mTodayDateFormat.format(date);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDateFormat.format(date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user