Bug 1234331 - Push bookmarked item into readercache when entering readermode r?margaret draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 24 Feb 2016 09:47:44 -0800
changeset 341358 44301cf7c3279058ee383c92c004ce1cf8d285d2
parent 341357 e96e5aacbde1367fdea2bcf789d778ab53820b3e
child 341359 ebb929ebc82b5b21e2e16dbc811ed8191c150c2f
push id13200
push userahunt@mozilla.com
push dateWed, 16 Mar 2016 22:30:18 +0000
reviewersmargaret
bugs1234331
milestone48.0a1
Bug 1234331 - Push bookmarked item into readercache when entering readermode r?margaret 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
@@ -746,16 +746,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;