Back to project page roodroid.
The source code is released under:
Copyright (c) 2011, Jonathan Perichon & Lucas Gerbeaux Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"...
If you think the Android project roodroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package fr.utbm.roodroid; // ww w.ja va 2s. c o m import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Conversation * A conversation represents incoming and outgoing messages with the same recipient. * Implements Comparable to sort two conversations according to their last message (by date). * * @author Jonathan Perichon <jonathan.perichon@gmail.com> * @author Lucas Gerbeaux <lucas.gerbeaux@gmail.com> * */ public class Conversation implements Comparable<Conversation>, Serializable { private static final long serialVersionUID = -5711653949793208241L; private String contactPhoneNumber; private String contactName; private List<Message> messages; public Conversation(String contactPhoneNumber, String contactName, Message firstMessage) { this.contactPhoneNumber = contactPhoneNumber; this.contactName = contactName; this.messages = new ArrayList<Message>(1); this.messages.add(firstMessage); } public Conversation(String contactPhoneNumber, String contactName, List<Message> messages) { this.contactPhoneNumber = contactPhoneNumber; this.contactName = contactName; this.messages = new ArrayList<Message>(messages); } public String getContactPhoneNumber() { return contactPhoneNumber; } public String getContactName() { return contactName; } public List<Message> getMessages() { return messages; } @Override public int compareTo(Conversation another) { return another.messages.get(another.messages.size() - 1).compareTo(messages.get(messages.size() - 1)); } }