Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
index c11c737b89826366e5068cee28ac683b9438d488..237d0d725ac7f7f11844b5187181f6d09f4ad660 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
@@ -17,6 +17,7 @@ import android.graphics.Color; |
import android.graphics.Rect; |
import android.graphics.drawable.ColorDrawable; |
import android.graphics.drawable.Drawable; |
+import android.graphics.drawable.LevelListDrawable; |
import android.net.Uri; |
import android.os.Build; |
import android.os.Bundle; |
@@ -51,6 +52,9 @@ import org.chromium.base.metrics.RecordUserAction; |
import org.chromium.chrome.R; |
import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; |
import org.chromium.chrome.browser.IntentHandler.TabOpenType; |
+import org.chromium.chrome.browser.ItemChooserDialog.ItemChooserLabels; |
+import org.chromium.chrome.browser.ItemChooserDialog.ItemChooserRow; |
+import org.chromium.chrome.browser.ItemChooserDialog.ItemSelectedCallback; |
import org.chromium.chrome.browser.appmenu.AppMenu; |
import org.chromium.chrome.browser.appmenu.AppMenuHandler; |
import org.chromium.chrome.browser.appmenu.AppMenuObserver; |
@@ -1546,6 +1550,8 @@ public abstract class ChromeActivity extends AsyncInitializationActivity |
} |
} |
+ ItemChooserDialog dialog; |
+ |
/** |
* Handles menu item selection and keyboard shortcuts. |
* |
@@ -1578,8 +1584,24 @@ public abstract class ChromeActivity extends AsyncInitializationActivity |
RecordUserAction.record("MobileTabClobbered"); |
} |
} else if (id == R.id.bookmark_this_page_id) { |
- addOrEditBookmark(currentTab); |
- RecordUserAction.record("MobileMenuAddToBookmarks"); |
+ final LevelListDrawable lld = new LevelListDrawable(); |
+ lld.addLevel(0, 0, ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.star_gray)); |
+ lld.addLevel(0, 1, ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.star_green)); |
+ |
+ final ItemChooserRow row1 = new ItemChooserRow("1", "row 1", lld); |
+ final ItemChooserRow row2 = new ItemChooserRow("2", "row 2", lld); |
+ dialog = new ItemChooserDialog(this, new ItemSelectedCallback() { |
+ @Override |
+ public void onItemSelected(String id) { |
+ // This should be very cheap, because actual drawables are shared by the same constant state. |
ortuno
2016/09/27 07:02:30
Just to confirm. We are updating the rows approxim
|
+ Drawable d = lld.getConstantState().newDrawable(); |
+ d.setLevel(1); |
ortuno
2016/09/27 07:02:30
I'm not sure if I got the code wrong but for some
|
+ ItemChooserRow row1_updated = new ItemChooserRow("1", "row 1-updated", d); |
+ dialog.addOrUpdateItem(row1_updated); |
+ } |
+ }, new ItemChooserLabels("title", "searching", "noneFound", "statusActive", "statusIdleNoneFound", "statusIdleSomeFound", "positiveButton")); |
+ dialog.addOrUpdateItem(row1); |
+ dialog.addOrUpdateItem(row2); |
} else if (id == R.id.offline_page_id) { |
DownloadUtils.downloadOfflinePage(this, currentTab); |
RecordUserAction.record("MobileMenuDownloadPage"); |