question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Section headers are not visible

See original GitHub issue

I’ve tried to implement sticky section headers using the first use case provided in the documentation at https://github.com/davideas/FlexibleAdapter/wiki/5.x-|-Headers-and-Sections. I’m adding only AppointmentItems to the list and calling updateDataSet(list). In the fragment I’m calling adapter.setDisplayHeadersAtStartUp(true).

As far sa I can tell, I think everything seems ok. However, headers are not showing up, only the items. Am I missing something?

class MyAdapter: FlexibleAdapter<AbstractFlexibleItem<FlexibleViewHolder>>(ArrayList())
{
    inner class AppointmentItem(
        private var sectionItem: SectionItem?,
        var appointment: AppointmentViewModel) : AbstractFlexibleItem<AppointmentViewHolder>(),
                                                 ISectionable<AppointmentViewHolder, SectionItem>
{
override fun getHeader(): SectionItem?
        {
            return sectionItem
        }
        
        override fun setHeader(header: SectionItem?)
        {
            this.sectionItem = header
        }

override fun equals(other: Any?): Boolean
        {
            return other is AppointmentItem && other === this
        }
        
        override fun hashCode(): Int
        {
            var result = sectionItem?.hashCode() ?: 0
            result = 31 * result + appointment.hashCode()
            return result
        }
}
  inner class SectionItem(
        var startDate: Date?,
        var endDate: Date?) :
        AbstractExpandableHeaderItem<SectionViewHolder, AppointmentItem>()
{
 override fun equals(other: Any?): Boolean
        {
            return other is SectionItem && other === this
        }
        
        override fun hashCode(): Int
        {
            var result = startDate?.hashCode() ?: 0
            result = 31 * result + (endDate?.hashCode() ?: 0)
            return result
        }
}
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
tcqqcommented, Sep 20, 2018

@bogdanzurac This is an example that supports displaying sticky titles, you can take a look. https://github.com/tcqq/FlexibleAdapterStickyHeaderExample

1reaction
bogdanzuraccommented, Sep 22, 2018

Then I suppose we should use the 2nd solution in our use case, which indeed works perfectly. Thanks for clearing things up!

Read more comments on GitHub >

github_iconTop Results From Across the Web

UITableView Section Header not showing - Stack Overflow
Try this out for UITableView Section Header. Programatically create headerview func tableView(tableView: UITableView, viewForHeaderInSection ...
Read more >
Section headers not visible in Card Form - Jotform
Hello! The reason for this behavior is that when there are multiple section headers one after the other, only one will show, as...
Read more >
Collapsible Section Headers Not Displaying Correctly
My collapsible headers appear correctly on the desktop of a modern page. However the headers do not show up on the app on...
Read more >
Section Header Names Didn't display in View Page?
I view the page " header Section names not display in the view page" but I am editing the page the header section...
Read more >
r/todoist - Anybody has the same bug? Section headers not ...
Section headers not showing correctly in darkmode. Important: I'm part of the beta program. Does anybody else has the same problem?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found