firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.24k stars 568 forks source link

Android TV support for FIAM-display (proper focus for modal view) #195

Open stari4ek opened 5 years ago

stari4ek commented 5 years ago

What feature would you like to see?

Set focus to action button in FIAM display by default. Otherwise default focus goes to scrollview with text and clicking "enter" on D-Pad dismisses modal view instead of performing "Click" on action button.

How would you use it?

It provides better usability for Android TV system and standard Android if external keyboard is used

stari4ek commented 5 years ago

It can be easily fixed updating modal layouts:

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            tools:text="Wishlist"
            tools:textColor="#000000">

            <requestFocus/>
        </Button>
  android:focusable="true"
  android:focusableInTouchMode="true"
  <requestFocus/>

But it's really hard to apply this workaround when firebase-inappmessaging-display is used as external library. I've tried to override layout with tools:override but it does not work for me (most probably cause it should override layout from layout-land) And the only way is to build library locally

vkryachko commented 5 years ago

/assign @MeghaB

MeghaB commented 5 years ago

Hi @stari4ek - Thanks for the suggestion! In the meantime, the android sdk for FIAM-display is open sourced and so you can definitely apply the workaround to use yourself. Cheers!

stari4ek commented 5 years ago

Yeah. I've ended up with prebuilt aar with workaround applied.

stari4ek commented 5 years ago

Since there is no source code published for firebase-inappmessage-display starting from 17.0.3 (as date of writing, current version is 18.0.2) (#441) - and this issue can't be workarounded easily

stari4ek commented 5 years ago

looks like with 18.0.2 there is a bit different behavior. action button sometime gets focus sometime don't, but clicking with d-pad when it's not in the focus does not dismiss message, which is good. Checked with card/modal