GithubHelp home page GithubHelp logo

winziyuan / sofa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dextorer/sofa

0.0 1.0 0.0 126 KB

A library for Android TV that extends the Leanback library functionalities

License: Other

Java 100.00%

sofa's Introduction

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.

sofa's People

Contributors

dextorer avatar brastolfo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.