Make MMS more asynchronous and consistent with new SMS types.

1) We now delay MMS notifications until a payload is received,
   or there's an error downloading the payload.  This makes
   group messages more consistent.

2) All "text" parts of an MMS are combined into a second text
   record, which is stored in the MMS row directly rather than
   as a distinct part.  This allows for immediate text loading,
   which means there's no chance a ConversationItem will resize.

   To do this, we need to include MMS in the big DB migration
   that's already staged for this application update.  It's also
   an "application-level" migration, because we need the MasterSecret
   to do it.

3) On conversation display, all image-based parts now have their
   thumbnails loaded asynchronously.  This allows for smooth-scrolling.
   The thumbnails are also scaled more accurately.
This commit is contained in:
Moxie Marlinspike
2013-04-26 11:23:43 -07:00
parent dd0aecc811
commit 7c47ea5cec
29 changed files with 747 additions and 288 deletions

View File

@@ -22,6 +22,7 @@ import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.CursorAdapter;
import org.thoughtcrime.securesms.crypto.MasterSecret;
@@ -42,7 +43,7 @@ import java.util.LinkedHashMap;
* @author Moxie Marlinspike
*
*/
public class ConversationAdapter extends CursorAdapter {
public class ConversationAdapter extends CursorAdapter implements AbsListView.RecyclerListener {
private static final int MAX_CACHE_SIZE = 40;
@@ -129,6 +130,11 @@ public class ConversationAdapter extends CursorAdapter {
this.getCursor().close();
}
@Override
public void onMovedToScrapHeap(View view) {
((ConversationItem)view).unbind();
}
private LinkedHashMap<String,MessageRecord> initializeCache() {
return new LinkedHashMap<String,MessageRecord>() {
@Override