Sofa


Source link: https://github.com/dextorer/Sofa

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:

  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

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

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. 

Resources

Sometimes when working with REST APIs in Android apps there is a need to return some mock data. Maybe for demo purposes, or real endpoint is just not ready yet. Endpoint2mock aims to help with that by integrating with Retrofit and allowing you to easily redirect some (but not all!) of your requests to your mock server.

A light weight library for exporting and importing sqlite database in android.

Resizer is a lightweight and easy-to-use Android library for image scaling. It allows you to resize an image file to a smaller or bigger one while keeping the aspect ratio.

Droid-vizu aims to provide cool visualization effects for any Android audio project. Maintainable modular design allows users to easily swap Renderer class to get corresponding effects.

A customize multiple state layout for Android.

A new Material Design text field that comes in a box, based on Google Material Design guidelines.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes