Bug 1311555 - Use filled bookmark star in ActivityStream context menu r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 18 Jan 2017 12:20:50 +0100
changeset 464077 27fa7cb0734153507bfd1989150923cc1164e3c9
parent 464076 3763d671be952a514b5e466b29b58d6761269709
child 542843 898ef54c581497b798a9d1fa3faf8dc607053c05
push id42258
push userahunt@mozilla.com
push dateFri, 20 Jan 2017 08:40:32 +0000
reviewerssebastian
bugs1311555
milestone53.0a1
Bug 1311555 - Use filled bookmark star in ActivityStream context menu r?sebastian Unfortunately tinting the bookmark star is highly complicated due to the tinting that NavigationView performs (i.e. we'd likely have to disable NavigationView tinting, and do manual tinting on every icon - alternatively we could hack the tint-list to use blue for "checked" items, and set the bookmark item as checked). Since it's unclear if we even want the star to be blue, we'll leave it grey (but filled) for now. MozReview-Commit-ID: DekRZJayKIz
mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/ActivityStreamContextMenu.java
mobile/android/base/resources/drawable/as_bookmark_filled.xml
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/ActivityStreamContextMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/ActivityStreamContextMenu.java
@@ -75,16 +75,17 @@ public abstract class ActivityStreamCont
      * <p/>
      * Your implementation must be ready to return items from getItemByID() before postInit() is
      * called, i.e. you should probably inflate your menu items before this call.
      */
     /* package-local */ void postInit() {
         final MenuItem bookmarkItem = getItemByID(R.id.bookmark);
         if (Boolean.TRUE.equals(item.isBookmarked())) {
             bookmarkItem.setTitle(R.string.bookmark_remove);
+            bookmarkItem.setIcon(R.drawable.as_bookmark_filled);
         }
 
         final MenuItem pinItem = getItemByID(R.id.pin);
         if (Boolean.TRUE.equals(item.isPinned())) {
             pinItem.setTitle(R.string.contextmenu_top_sites_unpin);
         }
 
         // Disable "dismiss" for topsites until we have decided on its behaviour for topsites
@@ -104,16 +105,17 @@ public abstract class ActivityStreamCont
                 protected Boolean doInBackground() {
                     return BrowserDB.from(context).isBookmark(context.getContentResolver(), item.getUrl());
                 }
 
                 @Override
                 protected void onPostExecute(Boolean hasBookmark) {
                     if (hasBookmark) {
                         bookmarkItem.setTitle(R.string.bookmark_remove);
+                        bookmarkItem.setIcon(R.drawable.as_bookmark_filled);
                     }
 
                     item.updateBookmarked(hasBookmark);
                     bookmarkItem.setEnabled(true);
                 }
             }).execute();
         }
 
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable/as_bookmark_filled.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M12.01,1C11.508,1.068 11.087,1.415 10.925,1.895L8.178,7.562L2.301,8.552C0.956,8.771 0.622,9.738 1.557,10.7L5.717,15.186L4.748,21.497C4.601,22.445 4.99,22.997 5.673,22.997C5.985,22.985 6.291,22.899 6.564,22.748L12.021,19.817L17.542,22.748C17.816,22.9 18.121,22.985 18.434,22.997C19.117,22.997 19.504,22.442 19.36,21.497L18.394,15.186L22.505,10.705C23.441,9.739 23.105,8.771 21.761,8.552L15.972,7.562L13.1,1.9C12.939,1.416 12.516,1.067 12.01,1L12.01,1Z"/>
+</vector>