0

so I'm new to Kotlin. Been working in it for a few weeks. I am currently trying to figure out how to remove the blue banner header thingy. When I try to remove the banner using headersState = BrowseSupportFragment.HEADERS_DISABLED it makes the whole page go blank.

This is what it looks like with the HEADERS_ENABLED

private fun setupUIElements() {
    //title = getString(R.string.browse_title)
    // over title
    headersState = BrowseSupportFragment.HEADERS_ENABLED
    isHeadersTransitionOnBackEnabled = true

    // set fastLane (or headers) background color
    brandColor = ContextCompat.getColor(activity!!, R.color.fastlane_background)
    // set search icon color
    searchAffordanceColor = ContextCompat.getColor(activity!!, R.color.search_opaque)
}

Screen Shot with Header Enabled

This is what it looks like when I set headersState = BrowseSupportFragment.HEADERS_DISABLED

Screen shot with Header Disabled

Basically I'm trying to get it to show all the video's with out the blue thing on the left.

I think this function might have something to do with the issue, but I'm not 100% sure.

    private fun loadRows() {
    val list = MovieList.list
    
    val rowsAdapter = ArrayObjectAdapter(ListRowPresenter())
    val cardPresenter = CardPresenter()

    for (i in 0 until NUM_ROWS) {
        if (i != 0) {
            Collections.shuffle(list)
        }
        val listRowAdapter = ArrayObjectAdapter(cardPresenter)
        for (j in 0 until NUM_COLS) {
            listRowAdapter.add(list[j % 5])
        }
        val header = HeaderItem(i.toLong(), MovieList.MOVIE_CATEGORY[i])
        val row_list = ListRow(header, listRowAdapter)

        rowsAdapter.add(row_list)
    }

    adapter = rowsAdapter
}
gitBritt
  • 3
  • 5
  • Which sample are you using for reference, Leanback or LeanbackShowcase? and did you convert the project to Kotlin? – Neil Turner Sep 08 '22 at 16:25
  • It's Leanback. The Project is in Kotlin. – gitBritt Sep 09 '22 at 21:05
  • Assuming we're talking about [the same repo](https://github.com/android/tv-samples), I'd recommend using the ReferenceAppKotlin as it's the most recent and up to date. Other projects are older and don't work properly or have bugs - like the Leanback project. I can write up an answer with more info? – Neil Turner Sep 12 '22 at 11:15

0 Answers0