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

Side by Side Diff: customtabs/src/android/support/customtabs/browseractions/BrowserActionItem.java

Issue 2787723002: [Android] Add public API for Browser Action in support library (Closed)
Patch Set: Update based on Yusuf's new comments. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.support.customtabs.browseractions;
18
19 import android.app.PendingIntent;
20 import android.graphics.Bitmap;
21 import android.support.annotation.NonNull;
22
23 /**
24 * A wrapper class holding custom item of Browser Actions menu.
25 * The Bitmap is optional for a BrowserActionItem.
26 */
27 public class BrowserActionItem {
28 private final String mTitle;
29 private final PendingIntent mAction;
30 private Bitmap mIcon;
31
32 /**
33 * Constructor for BrowserActionItem with icon, string and action provided.
34 * @param icon The icon shown for a custom item.
35 * @param title The string shown for a custom item.
36 * @param action The PendingIntent executed when a custom item is selected
37 */
38 public BrowserActionItem(@NonNull String title, @NonNull PendingIntent actio n, Bitmap icon) {
39 mTitle = title;
40 mAction = action;
41 mIcon = icon;
42 }
43
44 /**
45 * Constructor for BrowserActionItem with only string and action provided.
46 * @param title The icon shown for a custom item.
47 * @param action The string shown for a custom item.
48 */
49 public BrowserActionItem(@NonNull String title, @NonNull PendingIntent actio n) {
50 this(title, action, null);
51 }
52
53 /**
54 * Sets the icon of a custom item.
55 * @param icon The icon for a custom item.
56 */
57 public void setIcon(Bitmap icon) {
58 mIcon = icon;
59 }
60
61 /**
62 * Gets the icon of of a custom item.
Yusuf 2017/04/18 17:44:16 /** * @return the icon of of a custom item. */
ltian 2017/04/18 22:30:31 Done.
63 * @return the icon of of a custom item..
64 */
65 public Bitmap getIcon() {
66 return mIcon;
67 }
68
69 /**
70 * Gets the title of a custom item.
71 * @return the title of a custom item..
Yusuf 2017/04/18 17:44:16 here as well
ltian 2017/04/18 22:30:31 Done.
72 */
73 public String getTitle() {
74 return mTitle;
75 }
76
77 /**
78 * Gets the {@link PendingIntent} action of a custom item.
79 * @return the action of a custom item.
Yusuf 2017/04/18 17:44:16 ditto
ltian 2017/04/18 22:30:31 Done.
80 */
81 public PendingIntent getAction() {
82 return mAction;
83 }
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698