Sofa

A library for Android TV that extends the Leanback library functionalities

License

License

Categories

Categories

Dex General Purpose Libraries Utility
GroupId

GroupId

com.github.dextorer
ArtifactId

ArtifactId

sofa
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

Sofa
A library for Android TV that extends the Leanback library functionalities
Project URL

Project URL

https://github.com/dextorer/Sofa
Source Code Management

Source Code Management

https://github.com/dextorer/Sofa

Download sofa

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.dextorer/sofa/ -->
<dependency>
    <groupId>com.github.dextorer</groupId>
    <artifactId>sofa</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.dextorer/sofa/
implementation 'com.github.dextorer:sofa:1.0.0'
// https://jarcasting.com/artifacts/com.github.dextorer/sofa/
implementation ("com.github.dextorer:sofa:1.0.0")
'com.github.dextorer:sofa:aar:1.0.0'
<dependency org="com.github.dextorer" name="sofa" rev="1.0.0">
  <artifact name="sofa" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.dextorer', module='sofa', version='1.0.0')
)
libraryDependencies += "com.github.dextorer" % "sofa" % "1.0.0"
[com.github.dextorer/sofa "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.android.support » recyclerview-v7 jar 22.2.0
com.android.support » leanback-v17 jar 22.2.0

Project Modules

There are no modules declared in this project.

Sofa

Android Arsenal ![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:

Sofa - Demo

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:

  1. Create a RowsFragment
  2. Create an ArrayObjectAdapter with a ListRowPresenter and fill it as you normally do
  3. Set the adapter to RowsFragment
  4. Create another ArrayObjectAdapter (no need for a Presenter)
  5. Add a new ListRow that contains the RowsFragment instance and the corresponding HeaderItem
  6. Set 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.

Download

Download the latest JAR

Download

or grab via Gradle

dependencies {
    compile 'com.github.dextorer:sofa:1.0.0'
}

Dependencies

Sofa depends on Leanback to work! Be sure to add the latest Leanback library version to your Gradle build file:

compile 'com.android.support:leanback-v17:22.2.0'

Caveats

Sofa is built using part of Leanback's source code, mainly the BrowseFragment and BrowseSupportFragment classes. The direct dependencies for those classes had to be imported as well, but are mostly untouched. Every other class is still part of Leanback.

Contribute

Feedback and contributions are extremely welcome. If you feel like something is missing, please submit a request or simply consider adding it yourself.

Follow me

Twitter Google+ LinkedIn

License

Copyright 2015, Sebastiano Gottardo.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
1.0.0