Mindorks Cct Save

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

Project README

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)
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

Open Source Agenda is not affiliated with "Mindorks Cct" Project. README Source: anandwana001/mindorks-cct
Stars
27
Open Issues
0
Last Commit
5 years ago

Open Source Agenda Badge

Open Source Agenda Rating