Skip to content
A sample application demoing chrome custom tabs in kotlin in androidx 🎨
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
images
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

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

You can’t perform that action at this time.