Bug 1258430 - Push bookmarked item into readercache when entering readermode draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 24 Feb 2016 09:47:44 -0800
changeset 343516 1523fe3f463976d9140d9b6c0e816d90be811cfc
parent 343515 cc8e298bf08dfb426b37709cd73d53c57a6655ea
child 343517 3d4b36020ddd201ce4f7fd0fa583e8a3e295ee3f
push id13649
push userahunt@mozilla.com
push dateTue, 22 Mar 2016 21:54:45 +0000
bugs1258430
milestone48.0a1
Bug 1258430 - Push bookmarked item into readercache when entering readermode If the user has already bookmarked a page and then enters readermode, we can presume that they would like to read this page in readermode in future. (Note that if you exit readermode again, we will remove the page from the readercache, i.e. the bookmark returns to its normal state.) MozReview-Commit-ID: GZ8Gkvs9Ygt
mobile/android/base/java/org/mozilla/gecko/Tab.java
--- a/mobile/android/base/java/org/mozilla/gecko/Tab.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tab.java
@@ -748,16 +748,21 @@ public class Tab {
             public void run() {
                 // tab.getURL() may return null
                 if (!TextUtils.equals(oldURL, getURL()))
                     return;
 
                 ThumbnailHelper.getInstance().getAndProcessThumbnailFor(tab);
             }
         }, 500);
+
+        // Ensure we store bookmarked pages in the readercache if we open them into readermode
+        if (success && isBookmark() && AboutPages.isAboutReader(oldURL)) {
+            ReadingListHelper.cacheReaderItem(ReaderModeUtils.stripAboutReaderUrl(oldURL), mAppContext);
+        }
     }
 
     void handleContentLoaded() {
         setLoadProgressIfLoading(LOAD_PROGRESS_LOADED);
     }
 
     protected void saveThumbnailToDB(final BrowserDB db) {
         final BitmapDrawable thumbnail = mThumbnail;