2008-11-01 17:32:06 -04:00
|
|
|
|
2010-05-19 14:17:06 -04:00
|
|
|
package com.fsck.k9.controller;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
import java.util.Comparator;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.mail.Message;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public class MessageDateComparator implements Comparator<Message>
|
|
|
|
{
|
|
|
|
public int compare(Message o1, Message o2)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (o1.getSentDate() == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return 1;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (o2.getSentDate() == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return -1;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
2008-11-01 17:32:06 -04:00
|
|
|
return o2.getSentDate().compareTo(o1.getSentDate());
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|