Merge "Remove all bad ideas from SelectedConversations" into jb-ub-mail
diff --git a/res/raw/template_conversation_upper.html b/res/raw/template_conversation_upper.html
index b4abb38..1beb249 100644
--- a/res/raw/template_conversation_upper.html
+++ b/res/raw/template_conversation_upper.html
@@ -13,5 +13,4 @@
   </style>
 </head>
 <body style="margin: 0;">
-<!-- TODO: promote this to a spacer so its overlay can scroll like the other adapter views -->
 <div id="conversation-header" style="height: %spx;"></div>
diff --git a/src/com/android/mail/photo/loaders/PhotoPagerLoader.java b/src/com/android/mail/photo/loaders/PhotoPagerLoader.java
index 9906ab7..c965e0d 100644
--- a/src/com/android/mail/photo/loaders/PhotoPagerLoader.java
+++ b/src/com/android/mail/photo/loaders/PhotoPagerLoader.java
@@ -21,7 +21,7 @@
 import android.database.Cursor;
 import android.net.Uri;
 
-import com.android.mail.photo.provider.PhotoContract.PhotoQuery;
+import com.android.mail.photo.provider.PhotoContract;
 
 /**
  * Loader for a set of photo IDs.
@@ -36,9 +36,10 @@
     public Cursor esLoadInBackground() {
         Cursor returnCursor = null;
 
-        final Uri loaderUri = getLoaderUri();
+        final Uri loaderUri = getLoaderUri().buildUpon().appendQueryParameter(
+                PhotoContract.ContentTypeParameters.CONTENT_TYPE, "image/").build();
         setUri(loaderUri);
-        setProjection(PhotoQuery.PROJECTION);
+        setProjection(PhotoContract.PhotoQuery.PROJECTION);
         returnCursor = super.esLoadInBackground();
 
         return returnCursor;
diff --git a/src/com/android/mail/photo/provider/PhotoContract.java b/src/com/android/mail/photo/provider/PhotoContract.java
index 19f834f..0953589 100644
--- a/src/com/android/mail/photo/provider/PhotoContract.java
+++ b/src/com/android/mail/photo/provider/PhotoContract.java
@@ -18,11 +18,10 @@
 package com.android.mail.photo.provider;
 
 import android.net.Uri;
-import android.provider.BaseColumns;
 
 public final class PhotoContract {
     /** Columns for the view {@link #PHOTO_VIEW} */
-    public static interface PhotoViewColumns extends BaseColumns {
+    public static interface PhotoViewColumns {
         /**
          * This column is a {@link Uri} that can be queried
          * for this individual image (resulting cursor has one single row for this image).
@@ -52,4 +51,14 @@
         public final static int INDEX_CONTENT_URI = 1;
         public final static int INDEX_CONTENT_TYPE = 2;
     }
+
+    public static final class ContentTypeParameters {
+        /**
+         * Parameter used to specify which type of content to return.
+         * Allows multiple types to be specified.
+         */
+        public static final String CONTENT_TYPE = "contentType";
+
+        private ContentTypeParameters() {}
+    }
 }
diff --git a/src/com/android/mail/ui/ConversationViewFragment.java b/src/com/android/mail/ui/ConversationViewFragment.java
index 3260463..b3436f1 100644
--- a/src/com/android/mail/ui/ConversationViewFragment.java
+++ b/src/com/android/mail/ui/ConversationViewFragment.java
@@ -144,6 +144,8 @@
     public static final String ARG_CONVERSATION = "conversation";
     private static final String ARG_FOLDER = "folder";
 
+    private static final boolean DEBUG_DUMP_CONVERSATION_HTML = false;
+
     /**
      * Constructor needs to be public to handle orientation changes and activity lifecycle events.
      */
@@ -403,8 +405,28 @@
     }
 
     private void renderConversation(MessageCursor messageCursor) {
-        mWebView.loadDataWithBaseURL(mBaseUri, renderMessageBodies(messageCursor), "text/html",
-                "utf-8", null);
+        final String convHtml = renderMessageBodies(messageCursor);
+
+        if (DEBUG_DUMP_CONVERSATION_HTML) {
+            java.io.FileWriter fw = null;
+            try {
+                fw = new java.io.FileWriter("/sdcard/conv" + mConversation.id
+                        + ".html");
+                fw.write(convHtml);
+            } catch (java.io.IOException e) {
+                e.printStackTrace();
+            } finally {
+                if (fw != null) {
+                    try {
+                        fw.close();
+                    } catch (java.io.IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+
+        mWebView.loadDataWithBaseURL(mBaseUri, convHtml, "text/html", "utf-8", null);
         mCursor = messageCursor;
     }