public final class CustomTabsIntent
extends Object
java.lang.Object | |
↳ | android.support.customtabs.CustomTabsIntent |
Class holding the Intent
and start bundle for a Custom Tabs Activity.
Note: The constants below are public for the browser implementation's benefit. You are strongly encouraged to use CustomTabsIntent.Builder
.
Nested classes |
|
---|---|
class |
CustomTabsIntent.Builder Builder class for |
Constants |
|
---|---|
String |
EXTRA_ACTION_BUTTON_BUNDLE Bundle used for adding a custom action button to the custom tab toolbar. |
String |
EXTRA_CLOSE_BUTTON_ICON Extra bitmap that specifies the icon of the back button on the toolbar. |
String |
EXTRA_DEFAULT_SHARE_MENU_ITEM Boolean extra that specifies whether a default share button will be shown in the menu. |
String |
EXTRA_ENABLE_URLBAR_HIDING Boolean extra that enables the url bar to hide as the user scrolls down the page |
String |
EXTRA_EXIT_ANIMATION_BUNDLE Bundle constructed out of |
String |
EXTRA_MENU_ITEMS Use an |
String |
EXTRA_REMOTEVIEWS Extra that specifies the |
String |
EXTRA_REMOTEVIEWS_CLICKED_ID Extra that specifies which |
String |
EXTRA_REMOTEVIEWS_PENDINGINTENT Extra that specifies the |
String |
EXTRA_REMOTEVIEWS_VIEW_IDS Extra that specifies an array of |
String |
EXTRA_SECONDARY_TOOLBAR_COLOR Extra that changes the background color for the secondary toolbar. |
String |
EXTRA_SESSION Extra used to match the session. |
String |
EXTRA_TINT_ACTION_BUTTON Extra boolean that specifies whether the custom action button should be tinted. |
String |
EXTRA_TITLE_VISIBILITY_STATE Extra (int) that specifies state for showing the page title. |
String |
EXTRA_TOOLBAR_COLOR Extra that changes the background color for the toolbar. |
String |
EXTRA_TOOLBAR_ITEMS List
|
String |
KEY_DESCRIPTION Key that specifies the content description for the custom action button. |
String |
KEY_ICON Key that specifies the |
String |
KEY_ID Key that specifies the unique ID for an action button. |
String |
KEY_MENU_ITEM_TITLE Key for specifying the title of a menu item. |
String |
KEY_PENDING_INTENT Key that specifies the PendingIntent to launch when the action button or menu item was clicked. |
int |
NO_TITLE Don't show any title. |
int |
SHOW_PAGE_TITLE Shows the page title and the domain. |
int |
TOOLBAR_ACTION_BUTTON_ID The ID allocated to the custom action button that is shown on the toolbar. |
Fields |
|
---|---|
public final Intent |
intent An |
public final Bundle |
startAnimationBundle A |
Public methods |
|
---|---|
static int |
getMaxToolbarItems() |
void |
launchUrl(Activity context, Uri url) Convenience method to launch a Custom Tabs Activity. |
Inherited methods |
|
---|---|
![]() java.lang.Object
|
String EXTRA_ACTION_BUTTON_BUNDLE
Bundle used for adding a custom action button to the custom tab toolbar. The client should provide a description, an icon Bitmap
and a PendingIntent
for the button. All three keys must be present.
Constant Value: "android.support.customtabs.extra.ACTION_BUTTON_BUNDLE"
String EXTRA_CLOSE_BUTTON_ICON
Extra bitmap that specifies the icon of the back button on the toolbar. If the client chooses not to customize it, a default close button will be used.
Constant Value: "android.support.customtabs.extra.CLOSE_BUTTON_ICON"
String EXTRA_DEFAULT_SHARE_MENU_ITEM
Boolean extra that specifies whether a default share button will be shown in the menu.
Constant Value: "android.support.customtabs.extra.SHARE_MENU_ITEM"
String EXTRA_ENABLE_URLBAR_HIDING
Boolean extra that enables the url bar to hide as the user scrolls down the page
Constant Value: "android.support.customtabs.extra.ENABLE_URLBAR_HIDING"
String EXTRA_EXIT_ANIMATION_BUNDLE
Bundle constructed out of ActivityOptionsCompat
that will be running when the Activity
that holds the custom tab gets finished. A similar ActivityOptions for creation should be constructed and given to the startActivity() call that launches the custom tab.
Constant Value: "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE"
String EXTRA_MENU_ITEMS
Use an ArrayList<Bundle>
for specifying menu related params. There should be a separate Bundle
for each custom menu item.
Constant Value: "android.support.customtabs.extra.MENU_ITEMS"
String EXTRA_REMOTEVIEWS
Extra that specifies the RemoteViews
showing on the secondary toolbar. If this extra is set, the other secondary toolbar configurations will be overriden. The height of the RemoteViews
should not exceed 56dp.
Constant Value: "android.support.customtabs.extra.EXTRA_REMOTEVIEWS"
String EXTRA_REMOTEVIEWS_CLICKED_ID
Extra that specifies which View
has been clicked. This extra will be put to the PendingIntent
sent from Custom Tabs when a view in the RemoteViews
is clicked
Constant Value: "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_CLICKED_ID"
String EXTRA_REMOTEVIEWS_PENDINGINTENT
Extra that specifies the PendingIntent
to be sent when the user clicks on the View
s that is listed by EXTRA_REMOTEVIEWS_VIEW_IDS
.
Note when this PendingIntent
is triggered, it will have the current url as data field, also the id of the clicked View
, specified by EXTRA_REMOTEVIEWS_CLICKED_ID
.
Constant Value: "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_PENDINGINTENT"
String EXTRA_REMOTEVIEWS_VIEW_IDS
Extra that specifies an array of View
ids. When these View
s are clicked, a PendingIntent
will be sent, carrying the current url of the custom tab as data.
Note that Custom Tabs will override the default onClick behavior of the listed View
s. If you do not care about the current url, you can safely ignore this extra and use setOnClickPendingIntent(int, PendingIntent)
instead.
Constant Value: "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_VIEW_IDS"
String EXTRA_SECONDARY_TOOLBAR_COLOR
Extra that changes the background color for the secondary toolbar. The value should be an int that specifies a Color
, not a resource id.
Constant Value: "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR"
String EXTRA_SESSION
Extra used to match the session. This has to be included in the intent to open in a custom tab. This is the same IBinder that gets passed to ICustomTabsService#newSession. Null if there is no need to match any service side sessions with the intent.
Constant Value: "android.support.customtabs.extra.SESSION"
String EXTRA_TINT_ACTION_BUTTON
Extra boolean that specifies whether the custom action button should be tinted. Default is false and the action button will not be tinted.
Constant Value: "android.support.customtabs.extra.TINT_ACTION_BUTTON"
String EXTRA_TITLE_VISIBILITY_STATE
Extra (int) that specifies state for showing the page title. Default is NO_TITLE
.
Constant Value: "android.support.customtabs.extra.TITLE_VISIBILITY"
String EXTRA_TOOLBAR_COLOR
Extra that changes the background color for the toolbar. colorRes is an int that specifies a Color
, not a resource id.
Constant Value: "android.support.customtabs.extra.TOOLBAR_COLOR"
String EXTRA_TOOLBAR_ITEMS
List
Bitmap
for each item. They may also provide a
PendingIntent
if the item is a button.
Constant Value: "android.support.customtabs.extra.TOOLBAR_ITEMS"
String KEY_DESCRIPTION
Key that specifies the content description for the custom action button.
Constant Value: "android.support.customtabs.customaction.DESCRIPTION"
String KEY_ICON
Key that specifies the Bitmap
to be used as the image source for the action button. The icon should't be more than 24dp in height (No padding needed. The button itself will be 48dp in height) and have a width/height ratio of less than 2.
Constant Value: "android.support.customtabs.customaction.ICON"
String KEY_ID
Key that specifies the unique ID for an action button. To make a button to show on the toolbar, use TOOLBAR_ACTION_BUTTON_ID
as its ID.
Constant Value: "android.support.customtabs.customaction.ID"
String KEY_MENU_ITEM_TITLE
Key for specifying the title of a menu item.
Constant Value: "android.support.customtabs.customaction.MENU_ITEM_TITLE"
String KEY_PENDING_INTENT
Key that specifies the PendingIntent to launch when the action button or menu item was clicked. The custom tab will be calling send()
on clicks after adding the url as data. The client app can call getDataString()
to get the url.
Constant Value: "android.support.customtabs.customaction.PENDING_INTENT"
int NO_TITLE
Don't show any title. Shows only the domain.
Constant Value: 0 (0x00000000)
int SHOW_PAGE_TITLE
Shows the page title and the domain.
Constant Value: 1 (0x00000001)
int TOOLBAR_ACTION_BUTTON_ID
The ID allocated to the custom action button that is shown on the toolbar.
Constant Value: 0 (0x00000000)
Bundle startAnimationBundle
A Bundle
containing the start animation for the Custom Tabs Activity.
int getMaxToolbarItems ()
Returns | |
---|---|
int |
The maximum number of allowed toolbar items for addToolbarItem(int, Bitmap, String, PendingIntent) and EXTRA_TOOLBAR_ITEMS . |