usabilla-u4a-android-sdk icon indicating copy to clipboard operation
usabilla-u4a-android-sdk copied to clipboard

Unable to remove blank top bar

Open cjwhitsitt opened this issue 2 years ago • 5 comments

My desired design requires me to use my own custom toolbar instance and navigation buttons. I set

usabilla.setDefaultNavigationButtonsVisibility(false)

which took care of the bottom bar, but there's still a top bar which is completely blank. In layout inspector, I see that this is all part of the fragment handed to my code from

void formLoadSuccess(FormClient formclient) {
    Fragment fragment = formClient.getFragment(); // This contains a View instance for the top bar
}

There doesn't seem to be a way to remove this top bar without manually removing it from the hierarchy, which I would like to avoid as it makes assumptions about how the internals of the SDK work and can cause incompatibilities with future updates.

Screenshot of layout inspector. The FrameLayout that's selected is mine, where I'm inserting the fragment from the code above. Screen Shot 2022-08-11 at 5 04 23 PM

cjwhitsitt avatar Aug 11 '22 22:08 cjwhitsitt

Hi @cjwhitsitt , Thanks for reaching out. I suspect that this is happening for devices which has Android 28 and above and has a notch or a cutout (such as cutout we can set via developer options.) I believe you can fix this issue with the help of this option :

<style name="ActivityTheme">
  <item name="android:windowLayoutInDisplayCutoutMode">
    shortEdges <!-- default, shortEdges, or never -->
  </item>
</style>

I'd suggest you to take a look at this part of our public documentation. This will take you to the official documentation I hope this will be a solution for the problem. If not, please comment your findings and questions so that we can investigate this further. Best Regards.

demirsoya avatar Aug 16 '22 11:08 demirsoya

@demirsoya I did see those notes in the documentation, but I didn't think they'd apply here since the parent fragment I'm inserting the FormView into isn't underneath any cutouts. I'll try and report back.

cjwhitsitt avatar Aug 16 '22 19:08 cjwhitsitt

@demirsoya adding that value to the style used in my app doesn't solve the issue. If I understand the documentation correctly, the default behavior is to display under the notch when in portrait, which is the same effect as shortEdges in portrait. shortEdges only adds the ability to display into the cutout area when in landscape. The issue is happening to my app in portrait and I was not previously applying any explicit value for windowLayoutInDisplayCutoutMode.

Since the fragment that the FormView instance is being inserted into doesn't extend under the cutout area anyway, I'm not sure what I can do on my end to gracefully account for this. At the moment, the only thing I can figure out as a workaround is to make assumptions about the height of the view and set a manual negative y value for the parent fragment.

cjwhitsitt avatar Aug 16 '22 21:08 cjwhitsitt

@demirsoya any other thoughts on this or ideas how to work around it? I've tried a couple other ways and can't find a good solution.

cjwhitsitt avatar Aug 29 '22 16:08 cjwhitsitt

In case anyone seeing this is curious what the different values do, I made a minimal reproducible example: https://github.com/cjwhitsitt/UsabillaHeaderSample

cjwhitsitt avatar Nov 02 '22 23:11 cjwhitsitt