Skip to main content

SuperSLiM section graph

In the last post I discussed I was working on the public API for SuperSLiM. This work really concerns the role of RecyclerView.Adapter in the API, that is, if SuperSLiM requires you to create and maintain a section graph, then do you also need to implement an adapter?

First, why is it important to explicitly create a section graph? In past versions, SuperSLiM generated a section graph from the adapter. This worked well enough at first, and it was nice that the API was basically the same as a normal layout manager. As it turned out, simply using the adapter and bundling all the side-channel data into layout parameters resulted in a lot of extra work being done to generate the section data. This was most noticeable when views that weren't even to be displayed would be bound multiple times. While caching fixed many of these problems, ultimately this played havoc with image caching and loading, and often resulted in unpredictable performance issues. To solve these problems I decided to make the section graph explicit.

So now there are two representations of your data, the section graph for SuperSLiM, and the adapter for RecyclerView. However, since the section graph is a known data model, we can simplify this and hide the adapter in the details. The result is something that looks something like this, where your application is talking to the section graph, and it manages everything for you, like the adapter used to.

Comments

Popular posts from this blog

SuperSLiM 'should've been a weekly' update