GoogleChrome / android-browser-helper

The Android Browser Helper library helps developers use Custom Tabs and Trusted Web Activities on top of the AndroidX browser support library.
Apache License 2.0
688 stars 286 forks source link

[BUG] Custom Tab doesn't appear in a bottom sheet #441

Closed JuancaG05 closed 11 months ago

JuancaG05 commented 11 months ago

Describe the bug The Custom tab is not appearing in a bottom sheet although an initial activity height is specified in the CustomTabsIntent.Builder through the setInitialActivityHeightPx() method. It does appear in a bottom sheet but ONLY when the builder is constructed with a CustomTabsSession. I don't know if this is expected or not, but it says nothing about it in the docs as far as I could find.

To Reproduce Steps to reproduce the behavior:

  1. Create a CustomTabsIntent.Builder with no params (not associated to a session, using [this](https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent.Builder#Builder()) constructor).
  2. Use the setInitialActivityHeightPx() method over the builder just created.
  3. Create the corresponding CustomTabsIntent and launch a URL in the Custom tab via the launchUrl() method.
  4. See that the Custom tabs keeps filling all the screen and not inside a bottom sheet with the specified height in step 2.

Expected behavior The Custom tab should appear in a bottom sheet with the specified height in step 2.

Did this ever used to work It's the first time I use this, and I see this working with CustomTabsSession in this same repo, but not without it.

Screenshots No need screenshots here.

Code Snippets

val customTabsBuilder = CustomTabsIntent.Builder().setInitialActivityHeightPx(500, CustomTabsIntent.ACTIVITY_HEIGHT_ADJUSTABLE)
val customTabsIntent = customTabsBuilder.build()
customTabsIntent.launchUrl(context, "www.example.com")

Smartphone (please complete the following information):

sebastianbenz commented 11 months ago

This is working as intended. The docs https://developer.chrome.com/docs/android/custom-tabs/guide-partial-custom-tabs/?cmdf=custom+tabs+partial+custom+tab also mention that you either need to pass a session or use startActivityForResult.

Message ID: @.***>