Remove ad code.

Moved to UnifiedGmail. Also refactored
HtmlConversationTemplates to use HtmlMessage,
a new interface instead of the Message class.

Change-Id: Ie14694b37800ed9eb9fc692d434508f66660d55b
diff --git a/src/com/android/mail/ui/ConversationViewFragment.java b/src/com/android/mail/ui/ConversationViewFragment.java
index 26b789f..e0a45d6 100644
--- a/src/com/android/mail/ui/ConversationViewFragment.java
+++ b/src/com/android/mail/ui/ConversationViewFragment.java
@@ -301,7 +301,7 @@
             }
         });
 
-        if (mConversation.conversationBaseUri != null &&
+        if (mConversation != null && mConversation.conversationBaseUri != null &&
                 !Utils.isEmpty(mAccount.accoutCookieQueryUri)) {
             // Set the cookie for this base url
             new SetCookieTask(getContext(), mConversation.conversationBaseUri,
@@ -510,8 +510,8 @@
             timerMark("CVF.showConversation");
         } else {
             final boolean disableOffscreenLoading = DISABLE_OFFSCREEN_LOADING
-                    || (mConversation.isRemote
-                            || mConversation.getNumMessages() > mMaxAutoLoadMessages);
+                    || (mConversation != null && (mConversation.isRemote
+                            || mConversation.getNumMessages() > mMaxAutoLoadMessages));
 
             // When not visible, we should not immediately load if either this conversation is
             // too heavyweight, or if the main/initial conversation is busy loading.
@@ -543,13 +543,21 @@
 
     private void startConversationLoad() {
         mWebView.setVisibility(View.VISIBLE);
-        getLoaderManager().initLoader(MESSAGE_LOADER, Bundle.EMPTY, getMessageLoaderCallbacks());
+        loadContent();
         // TODO(mindyp): don't show loading status for a previously rendered
         // conversation. Ielieve this is better done by making sure don't show loading status
         // until XX ms have passed without loading completed.
         mProgressController.showLoadingStatus(isUserVisible());
     }
 
+    /**
+     * Can be overridden in case a subclass needs to load something other than
+     * the messages of a conversation.
+     */
+    protected void loadContent() {
+        getLoaderManager().initLoader(MESSAGE_LOADER, Bundle.EMPTY, getMessageLoaderCallbacks());
+    }
+
     private void revealConversation() {
         timerMark("revealing conversation");
         mProgressController.dismissLoadingStatus(mOnProgressDismiss);
@@ -1312,6 +1320,10 @@
             timerMark("message cursor load finished");
         }
 
+        renderContent(newCursor);
+    }
+
+    protected void renderContent(MessageCursor messageCursor) {
         // if layout hasn't happened, delay render
         // This is needed in addition to the showConversation() delay to speed
         // up rotation and restoration.
@@ -1319,7 +1331,7 @@
             mNeedRender = true;
             mConversationContainer.addOnLayoutChangeListener(this);
         } else {
-            renderConversation(newCursor);
+            renderConversation(messageCursor);
         }
     }