Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: customtabs/src/android/support/customtabs/browseraction/BrowserActionItem.java

Issue 2787723002: [Android] Add public API for Browser Action in support library (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: customtabs/src/android/support/customtabs/browseraction/BrowserActionItem.java
diff --git a/customtabs/src/android/support/customtabs/browseraction/BrowserActionItem.java b/customtabs/src/android/support/customtabs/browseraction/BrowserActionItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d019e26e5d75399a4ae787f0b97861fcb5518b3
--- /dev/null
+++ b/customtabs/src/android/support/customtabs/browseraction/BrowserActionItem.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.support.customtabs.browseraction;
+
+import android.app.PendingIntent;
+import android.graphics.Bitmap;
+
+/**
+ * A wrapper class holding custom item for browser action menu.
+ * The Bitmap is optional for a BrowserActionItem.
+ */
+public class BrowserActionItem {
+ private String mTitle;
Yusuf 2017/04/03 18:00:49 final for title and action
ltian 2017/04/05 01:44:28 Done.
+ private PendingIntent mAction;
+ private Bitmap mIcon;
+
+ /**
+ * Constructor for BrowserActionItem with icon, string and action provided.
+ * @param icon The icon shown for a custom item.
+ * @param title The string shown for a custom item.
+ * @param action The PendingIntent executed when a custom item is selected
+ */
+ public BrowserActionItem(String title, PendingIntent action, Bitmap icon) {
Yusuf 2017/04/03 18:00:49 @Nonnull for the two that cant be null
ltian 2017/04/05 01:44:29 Done.
+ mTitle = title;
+ mAction = action;
+ mIcon = icon;
+ }
+
+ /**
+ * Constructor for BrowserActionItem with only string and action provided.
+ * @param title The icon shown for a custom item.
+ * @param action The string shown for a custom item.
+ */
+ public BrowserActionItem(String title, PendingIntent action) {
Yusuf 2017/04/03 18:00:49 @NonNull for both
ltian 2017/04/05 01:44:29 Done.
+ mTitle = title;
Yusuf 2017/04/03 18:00:49 call the above constructor with params set from he
ltian 2017/04/05 01:44:28 Done.
+ mAction = action;
+ }
+
+ public void setIcon(Bitmap icon) {
Yusuf 2017/04/03 18:00:48 javadocs here and on other getters.
ltian 2017/04/05 01:44:29 Done.
+ mIcon = icon;
+ }
+
+ public Bitmap getIcon() {
+ return mIcon;
+ }
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public PendingIntent getAction() {
+ return mAction;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698