Sofa

Additional

Language
Java
Version
N/A
Created
Jul 9, 2015
Updated
Sep 28, 2016 (Retired)
Owner
Sebastiano Gottardo (dextorer)
Contributors
Sebastiano Gottardo (dextorer)
brastolfo
2
Activity
Badge
Generate
Download
Source code

Advertisement

Sofa

![MethodsCount](https://img.shields.io/badge/Methods count-core: 817 | deps: 15173-e91e63.svg)

A library for Android TV that extends the Leanback library capabilities by offering a set of more powerful features.

Features

The Leanback library is astonishing in many different aspects, and Google has done an insanely good job at easing the developer's task of creating an awesome TV app. But Leanback comes with some limitations, and at some point, those limitations are just too big to be ignored.

These are some of the features that you get by using Sofa:

  • Support for multiple rows per each category
  • Support for custom fragments and manual focus handling
  • Backwards compatible to standard implementation
  • .. the same goes for BrowseSupportFragment!

Check the video below to see Sofa in action:

How to use

Simply migrate from android.support.v17.app.BrowseFragment to com.sgottard.sofa.BrowseFragment. That's it!

The best place to start is the demo project, more specifically the DemoActivity class.

To showcase a small example of one of the core features offered by Sofa, this is all it takes to

load multiple rows for each header, something that has been asked for countless times over the past year:Create a RowsFragmentCreate an ArrayObjectAdapter with a ListRowPresenter and fill it as you normally doSet the adapter to RowsFragmentCreate another ArrayObjectAdapter (no need for a Presenter)Add a new ListRow that contains the RowsFragment instance and the corresponding HeaderItemSet the adapter to BrowseFragment

Pretty simple, uh? All the classes should be familiar to anyone that has used Leanback before, and so should be the use of those components.

I started populating the project's Wiki, in order to better explain what differences stand between the

BrowseFragment component offered by Sofa and its original counterpart, and how to make the best out of Sofa.