Skip to content

A sample application demoing chrome custom tabs in kotlin in androidx 🎨

Notifications You must be signed in to change notification settings

anandwana001/mindorks-cct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chrome Custom Tabs MindOrks

mindorks-cct is a sample application showing use of Chrome Custom Tabs with new androidx library.

Add Dependency

dependencies {
  implementation 'androidx.browser:browser:1.0.0'
}
val builder = CustomTabsIntent.Builder()

modify toolbar color

builder.setToolbarColor(ContextCompat.getColor(this@MainActivity, R.color.colorPrimary))

add share button to overflow men

builder.addDefaultShareMenuItem()

add menu item to oveflow

builder.addMenuItem("MENU_ITEM_NAME", pendingIntent)

show website title

builder.setShowTitle(true)

modify back button icon

builder.setCloseButtonIcon(bitmap)

menu item icon

builder.setActionButton(bitmap, "Android", pendingIntent, true)

animation for enter and exit of tab

builder.setStartAnimations(this, android.R.anim.fade_in, android.R.anim.fade_out)
builder.setExitAnimations(this, android.R.anim.fade_in, android.R.anim.fade_out)

By default, if we don't set any animations then the Custom Tab will enter from the Bottom to the Top and exit from the Top to the Bottom.

Sample Gif

Attributions

Amit Shekhar - Topic Suggestion

About

A sample application demoing chrome custom tabs in kotlin in androidx 🎨

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages