Bug 1234335 - Remove shortcut to add an item to your reading list from long tapping on reader view icon. r=ahunt draft
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 18 Jan 2016 18:37:30 -0500
changeset 323676 808175c9606ba2921df33065164a5820ee8bbcbc
parent 323675 9300568c634b2f76eb5893b3630e1efe76c7f49d
child 513256 46335cde9f6b75cba0d7293b9f2c0589334d90ec
push id9767
push usermleibovic@mozilla.com
push dateWed, 20 Jan 2016 22:11:59 +0000
reviewersahunt
bugs1234335
milestone46.0a1
Bug 1234335 - Remove shortcut to add an item to your reading list from long tapping on reader view icon. r=ahunt
mobile/android/base/java/org/mozilla/gecko/home/ReadingListPanel.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/strings.xml.in
mobile/android/chrome/content/Reader.js
--- a/mobile/android/base/java/org/mozilla/gecko/home/ReadingListPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/ReadingListPanel.java
@@ -160,43 +160,16 @@ public class ReadingListPanel extends Ho
             mEmptyView = emptyViewStub.inflate();
 
             final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
             emptyText.setText(R.string.home_reading_list_empty);
 
             final ImageView emptyImage = (ImageView) mEmptyView.findViewById(R.id.home_empty_image);
             emptyImage.setImageResource(R.drawable.icon_reading_list_empty);
 
-            final TextView emptyHint = (TextView) mEmptyView.findViewById(R.id.home_empty_hint);
-            if (HardwareUtils.isLowMemoryPlatform()) {
-                emptyHint.setVisibility(View.GONE);
-            } else {
-                String readingListHint = getString(R.string.home_reading_list_hint);
-                String readingListDesc = getString(R.string.home_reading_list_hint_accessible);
-                emptyHint.setText(readingListHint);
-                emptyHint.setContentDescription(readingListDesc);
-
-                // Use an ImageSpan to include the reader icon in the "Tip".
-                int imageSpanIndex = readingListHint.indexOf(MATCH_STRING);
-                if (imageSpanIndex != -1) {
-                    final ImageSpan readingListIcon = new ImageSpan(getActivity(), R.drawable.reader_cropped, ImageSpan.ALIGN_BOTTOM);
-                    final SpannableStringBuilder hintBuilder = new SpannableStringBuilder(readingListHint);
-
-                    // Add additional spacing.
-                    hintBuilder.insert(imageSpanIndex + MATCH_STRING.length(), " ");
-                    hintBuilder.insert(imageSpanIndex, " ");
-
-                    // Add icon.
-                    hintBuilder.setSpan(readingListIcon, imageSpanIndex + 1, imageSpanIndex + MATCH_STRING.length() + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-
-                    emptyHint.setText(hintBuilder, TextView.BufferType.SPANNABLE);
-                }
-                emptyHint.setVisibility(View.VISIBLE);
-            }
-
             mList.setEmptyView(mEmptyView);
         }
     }
 
     /**
      * Cursor loader for the list of reading list items.
      */
     private static class ReadingListLoader extends SimpleCursorLoader {
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -532,24 +532,16 @@ size. -->
 <!ENTITY home_last_tabs_empty "Your recent tabs show up here.">
 <!ENTITY home_open_all "Open all">
 <!ENTITY home_most_recent_empty "Websites you visited most recently show up here.">
 <!ENTITY home_selected_empty "Websites you visited in the selected timeframe show up here.">
 <!-- Localization note (home_most_recent_emptyhint2): "Psst" is a sound that might be used to attract someone's attention unobtrusively, and intended to hint at Private Browsing to the user.
      The placeholders &formatS1; and &formatS2; are used to mark the location of text underlining. -->
 <!ENTITY home_most_recent_emptyhint2 "Psst: using a &formatS1;New Private Tab&formatS2; won\'t save your history.">
 <!ENTITY home_reading_list_empty "Articles you save for later show up here.">
-<!-- Localization note (home_reading_list_hint3): The "TIP" string is synonymous to "hint", "clue", etc. This string is displayed
-     as an advisory message on how to add content to the reading list when the reading list empty.
-     The placeholder &formatI; will be replaced by a small image of the icon described, and can be moved to wherever
-     it is applicable. -->
-<!ENTITY home_reading_list_hint3 "Tip: Save articles to your reading list by long pressing the &formatI; icon when it appears in the URL bar.">
-<!-- Localization note (home_reading_list_hint_accessible2): This string is used
-     as alternate text for accessibility. It is not visible in the UI. -->
-<!ENTITY home_reading_list_hint_accessible2 "Tip: Save articles to your reading list by long pressing the reader mode button when it appears in the URL bar.">
 
 <!-- Localization note (home_default_empty): This string is used as the default text when there
      is no data to show in an about:home panel that was created by an add-on. -->
 <!ENTITY home_default_empty "No content could be found for this panel.">
 
 <!-- Localization note (home_move_up_to_filter): The variable is replaced by the name of the
      previous location in the navigation, such as the previous folder -->
 <!ENTITY home_move_up_to_filter "Up to &formatS;">
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -436,18 +436,16 @@
   <string name="home_closed_tabs_title">&home_closed_tabs_title;</string>
   <string name="home_last_tabs_title">&home_last_tabs_title;</string>
   <string name="home_last_tabs_empty">&home_last_tabs_empty;</string>
   <string name="home_open_all">&home_open_all;</string>
   <string name="home_most_recent_empty">&home_most_recent_empty;</string>
   <string name="home_selected_empty">&home_selected_empty;</string>
   <string name="home_most_recent_emptyhint">&home_most_recent_emptyhint2;</string>
   <string name="home_reading_list_empty">&home_reading_list_empty;</string>
-  <string name="home_reading_list_hint">&home_reading_list_hint3;</string>
-  <string name="home_reading_list_hint_accessible">&home_reading_list_hint_accessible2;</string>
   <string name="home_default_empty">&home_default_empty;</string>
   <string name="home_move_up_to_filter">&home_move_up_to_filter;</string>
   <string name="home_remote_tabs_title">&home_remote_tabs_title;</string>
   <string name="home_remote_tabs_empty">&home_remote_tabs_empty;</string>
   <string name="home_remote_tabs_unable_to_connect">&home_remote_tabs_unable_to_connect;</string>
   <string name="home_remote_tabs_need_to_sign_in">&home_remote_tabs_need_to_sign_in;</string>
   <string name="home_remote_tabs_need_to_finish_migrating">&home_remote_tabs_need_to_finish_migrating;</string>
   <string name="home_remote_tabs_trouble_verifying">&home_remote_tabs_trouble_verifying;</string>
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -27,18 +27,17 @@ var Reader = {
     return this._buttonHistogram = Services.telemetry.getHistogramById("FENNEC_READER_VIEW_BUTTON");
   },
 
   // Values for "FENNEC_READER_VIEW_BUTTON" histogram.
   _buttonHistogramValues: {
     HIDDEN: 0,
     SHOWN: 1,
     TAP_ENTER: 2,
-    TAP_EXIT: 3,
-    LONG_TAP: 4
+    TAP_EXIT: 3
   },
 
   /**
    * BackPressListener (listeners / ReaderView Ids).
    */
   _backPressListeners: [],
   _backPressViewIds: [],
 
@@ -219,22 +218,16 @@ var Reader = {
           browser.loadURI(originalURL);
         }
         Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_EXIT);
       } else {
         browser.messageManager.sendAsyncMessage("Reader:ParseDocument", { url: url });
         Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_ENTER);
       }
     },
-
-    readerModeActiveCallback: function(tabID) {
-      Reader._addTabToReadingList(tabID).catch(e => Cu.reportError("Error adding tab to reading list: " + e));
-      UITelemetry.addEvent("save.1", "pageaction", null, "reading_list");
-      Reader._buttonHistogram.add(Reader._buttonHistogramValues.LONG_TAP);
-    },
   },
 
   updatePageAction: function(tab) {
     if (!tab.getActive()) {
       return;
     }
 
     if (this.pageAction.id) {
@@ -242,17 +235,16 @@ var Reader = {
       delete this.pageAction.id;
     }
 
     let showPageAction = (icon, title) => {
       this.pageAction.id = PageActions.add({
         icon: icon,
         title: title,
         clickCallback: () => this.pageAction.readerModeCallback(browser),
-        longClickCallback: () => this.pageAction.readerModeActiveCallback(tab.id),
         important: true
       });
     };
 
     let browser = tab.browser;
     if (browser.currentURI.spec.startsWith("about:reader")) {
       showPageAction("drawable://reader_active", Strings.reader.GetStringFromName("readerView.close"));
       // Only start a reader session if the viewer is in the foreground. We do
@@ -307,44 +299,16 @@ var Reader = {
   _downloadAndCacheArticle: Task.async(function* (url) {
     let article = yield ReaderMode.downloadAndParseDocument(url);
     if (article != null) {
       yield ReaderMode.storeArticleInCache(article);
     }
     return article;
   }),
 
-  _addTabToReadingList: Task.async(function* (tabID) {
-    let tab = BrowserApp.getTabForId(tabID);
-    if (!tab) {
-      throw new Error("Can't add tab to reading list because no tab found for ID: " + tabID);
-    }
-
-    let url = tab.browser.currentURI.spec;
-    let article = yield this._getArticle(url).catch(e => {
-      Cu.reportError("Error getting article for tab: " + e);
-      return null;
-    });
-    if (!article) {
-      // If there was a problem getting the article, just store the
-      // URL and title from the tab.
-      article = {
-        url: url,
-        title: tab.browser.contentDocument.title,
-        length: 0,
-        excerpt: "",
-        status: this.STATUS_FETCH_FAILED_UNSUPPORTED_FORMAT,
-      };
-    } else {
-      article.status = this.STATUS_FETCHED_ARTICLE;
-    }
-
-    this._addArticleToReadingList(article);
-  }),
-
   _addArticleToReadingList: function(article) {
     Messaging.sendRequestForResult({
       type: "Reader:AddToList",
       url: truncate(article.url, MAX_URI_LENGTH),
       title: truncate(article.title, MAX_TITLE_LENGTH),
       length: article.length,
       excerpt: article.excerpt,
       status: article.status,