Bug 1240728 - Remove add to reading list from the share overlay r?mcomella draft
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 08 Mar 2016 09:34:28 -0800
changeset 338179 1fa01671a36bc09b64f1ec2c807926ad73991ad9
parent 338178 14db4d2b17221f1e450964692ac6c5ecc3bdefe5
child 338180 5e69c9ec811defbd8dc07f4393f0fc3a8816db10
push id12452
push userahunt@mozilla.com
push dateTue, 08 Mar 2016 18:11:45 +0000
reviewersmcomella
bugs1240728, 1234319
milestone47.0a1
Bug 1240728 - Remove add to reading list from the share overlay r?mcomella String resources are shared with the main app menu, and will therefore be remove in Bug 1234319 which aims to remove those items. MozReview-Commit-ID: 1NUBskBC10l
mobile/android/base/java/org/mozilla/gecko/overlays/ui/ShareDialog.java
mobile/android/base/resources/drawable-hdpi/overlay_readinglist_already_icon.png
mobile/android/base/resources/drawable-hdpi/overlay_readinglist_icon.png
mobile/android/base/resources/drawable-xhdpi/overlay_readinglist_already_icon.png
mobile/android/base/resources/drawable-xhdpi/overlay_readinglist_icon.png
mobile/android/base/resources/drawable-xxhdpi/overlay_readinglist_already_icon.png
mobile/android/base/resources/drawable-xxhdpi/overlay_readinglist_icon.png
mobile/android/base/resources/drawable/overlay_share_reading_list_button.xml
mobile/android/base/resources/layout/overlay_share_dialog.xml
--- a/mobile/android/base/java/org/mozilla/gecko/overlays/ui/ShareDialog.java
+++ b/mobile/android/base/java/org/mozilla/gecko/overlays/ui/ShareDialog.java
@@ -60,21 +60,20 @@ public class ShareDialog extends Locales
             AppConstants.ANDROID_PACKAGE_NAME + ".intent.extra.DEVICES_ONLY";
 
     /** The maximum number of devices we'll show in the dialog when in State.DEFAULT. **/
     private static final int MAXIMUM_INLINE_DEVICES = 2;
 
     private State state;
 
     private SendTabList sendTabList;
-    private OverlayDialogButton readingListButton;
     private OverlayDialogButton bookmarkButton;
 
-    // The reading list drawable set from XML - we need this to reset state.
-    private Drawable readingListButtonDrawable;
+    // The bookmark button drawable set from XML - we need this to reset state.
+    private Drawable bookmarkButtonDrawable;
 
     private String url;
     private String title;
 
     // The override intent specified by SendTab (if any). See SendTab.java.
     private Intent sendTabOverrideIntent;
 
     // Flag set during animation to prevent animation multiple-start.
@@ -124,17 +123,17 @@ public class ShareDialog extends Locales
             sendTabList.switchState(SendTabList.State.LIST);
 
             // The first item in the list has a unique style. If there are no items
             // in the list, the next button appears to be the first item in the list.
             //
             // Note: a more thorough implementation would add this
             // (and other non-ListView buttons) into a custom ListView.
             if (remoteClientRecords == null || remoteClientRecords.length == 0) {
-                readingListButton.setBackgroundResource(
+                bookmarkButton.setBackgroundResource(
                         R.drawable.overlay_share_button_background_first);
             }
             return;
         }
 
         // Just show a button to launch the list of devices to choose from.
         sendTabList.switchState(SendTabList.State.SHOW_DEVICES);
     }
@@ -176,52 +175,42 @@ public class ShareDialog extends Locales
         sendTabList = (SendTabList) findViewById(R.id.overlay_send_tab_btn);
 
         // Register ourselves as both the listener and the context for the Adapter.
         final SendTabDeviceListArrayAdapter adapter = new SendTabDeviceListArrayAdapter(this, this);
         sendTabList.setAdapter(adapter);
         sendTabList.setSendTabTargetSelectedListener(this);
 
         bookmarkButton = (OverlayDialogButton) findViewById(R.id.overlay_share_bookmark_btn);
-        readingListButton = (OverlayDialogButton) findViewById(R.id.overlay_share_reading_list_btn);
 
-        readingListButtonDrawable = readingListButton.getBackground();
+        bookmarkButtonDrawable = bookmarkButton.getBackground();
 
         // Bookmark button
         bookmarkButton = (OverlayDialogButton) findViewById(R.id.overlay_share_bookmark_btn);
         bookmarkButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 addBookmark();
             }
         });
-
-        // Reading List button
-        readingListButton = (OverlayDialogButton) findViewById(R.id.overlay_share_reading_list_btn);
-        readingListButton.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                addToReadingList();
-            }
-        });
     }
 
     @Override
     protected void onResume() {
         super.onResume();
 
         final Intent intent = getIntent();
 
         state = intent.getBooleanExtra(INTENT_EXTRA_DEVICES_ONLY, false) ?
                 State.DEVICES_ONLY : State.DEFAULT;
 
         // If the Activity is being reused, we need to reset the state. Ideally, we create a
         // new instance for each call, but Android L breaks this (bug 1137928).
         sendTabList.switchState(SendTabList.State.LOADING);
-        readingListButton.setBackgroundDrawable(readingListButtonDrawable);
+        bookmarkButton.setBackgroundDrawable(bookmarkButtonDrawable);
 
         // The URL is usually hiding somewhere in the extra text. Extract it.
         final String extraText = ContextUtils.getStringExtra(intent, Intent.EXTRA_TEXT);
         if (TextUtils.isEmpty(extraText)) {
             abortDueToNoURL();
             return;
         }
 
@@ -266,25 +255,23 @@ public class ShareDialog extends Locales
         subtitleView.setSingleLine(true);
         subtitleView.setMarqueeRepeatLimit(5);
         subtitleView.setSelected(true);
 
         final View titleView = findViewById(R.id.title);
 
         if (state == State.DEVICES_ONLY) {
             bookmarkButton.setVisibility(View.GONE);
-            readingListButton.setVisibility(View.GONE);
 
             titleView.setOnClickListener(null);
             subtitleView.setOnClickListener(null);
             return;
         }
 
         bookmarkButton.setVisibility(View.VISIBLE);
-        readingListButton.setVisibility(View.VISIBLE);
 
         // Configure buttons.
         final View.OnClickListener launchBrowser = new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 ShareDialog.this.launchBrowser();
             }
         };
@@ -307,32 +294,29 @@ public class ShareDialog extends Locales
     /**
      * Sets the state of the bookmark/reading list buttons: they are disabled if the given URL is
      * already in the corresponding list.
      */
     private void setButtonState(final String pageURL, final LocalBrowserDB browserDB) {
         new UIAsyncTask.WithoutParams<Void>(ThreadUtils.getBackgroundHandler()) {
             // Flags to hold the result
             boolean isBookmark;
-            boolean isReadingListItem;
 
             @Override
             protected Void doInBackground() {
                 final ContentResolver contentResolver = getApplicationContext().getContentResolver();
 
                 isBookmark = browserDB.isBookmark(contentResolver, pageURL);
-                isReadingListItem = browserDB.getReadingListAccessor().isReadingListItem(contentResolver, pageURL);
 
                 return null;
             }
 
             @Override
             protected void onPostExecute(Void aVoid) {
                 findViewById(R.id.overlay_share_bookmark_btn).setEnabled(!isBookmark);
-                findViewById(R.id.overlay_share_reading_list_btn).setEnabled(!isReadingListItem);
             }
         }.execute();
     }
 
     /**
      * Helper method to get an overlay service intent populated with the data held in this dialog.
      */
     private Intent getServiceIntent(ShareMethod.Type method) {
@@ -394,23 +378,16 @@ public class ShareDialog extends Locales
         serviceIntent.putExtra(OverlayConstants.EXTRA_PARAMETERS, extraParameters);
 
         startService(serviceIntent);
         animateOut(true);
 
         Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.SHARE_OVERLAY, "sendtab");
     }
 
-    public void addToReadingList() {
-        startService(getServiceIntent(ShareMethod.Type.ADD_TO_READING_LIST));
-        animateOut(true);
-
-        Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "reading_list");
-    }
-
     public void addBookmark() {
         startService(getServiceIntent(ShareMethod.Type.ADD_BOOKMARK));
         animateOut(true);
 
         Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "bookmark");
     }
 
     public void launchBrowser() {
deleted file mode 100644
index e40cd0c09ac3adb08f8d5f3b27f75b5342582b4d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 90402468bfe34e16eb245d6d0f55d3f921bc32cc..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 778fdf39b3467cbea0609ea35bc39e77697b3fab..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 8b57ad9fb0a4247c7b4553c9c84b8396963cc772..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 6c1700090def8e4f105b49eda4bf9df2df8ecefb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index f3228599d381fc946bfabf6ea827bb8b7be79049..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mobile/android/base/resources/drawable/overlay_share_reading_list_button.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:state_enabled="false"
-        android:drawable="@drawable/overlay_readinglist_already_icon"/>
-    <item
-        android:drawable="@drawable/overlay_readinglist_icon"/>
-</selector>
--- a/mobile/android/base/resources/layout/overlay_share_dialog.xml
+++ b/mobile/android/base/resources/layout/overlay_share_dialog.xml
@@ -47,27 +47,16 @@
         <!-- "Send to Firefox Sync" -->
         <org.mozilla.gecko.overlays.ui.SendTabList
             android:id="@+id/overlay_send_tab_btn"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
             android:divider="@null"/>
 
-        <!-- "Add to reading list" -->
-        <org.mozilla.gecko.overlays.ui.OverlayDialogButton
-            style="@style/ShareOverlayRow"
-            android:id="@+id/overlay_share_reading_list_btn"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:enabled="false"
-            gecko:drawable="@drawable/overlay_share_reading_list_button"
-            gecko:enabledText="@string/overlay_share_reading_list_btn_label"
-            gecko:disabledText="@string/overlay_share_reading_list_btn_label_already"/>
-
         <!-- "Add bookmark" -->
         <org.mozilla.gecko.overlays.ui.OverlayDialogButton
             style="@style/ShareOverlayRow"
             android:id="@+id/overlay_share_bookmark_btn"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:enabled="false"
             gecko:drawable="@drawable/overlay_share_bookmark_button"