LeanbackCards


Source link: https://github.com/hitherejoe/LeanbackCards

LeanbackCards

Leanback cards is a Widget library for use with Android TV applications. It provides an extended set of customisable content cards to enhance your User Interfaces.

To begin with, you''ll need to add the dependency to your project as below:

compile 'com.hitherejoe.leanback:leanbackcards:0.1.0'

Think of this as a playground to try out the cards quickly and easily - so feel free to take the code and use it for the components you need!

The cards currently include:

Live Card

A live card allows you to show a looping video when the card view becomes focused, allowing your browsing experience to feel more dynamic. You can add a live card in several ways:

  • By creating a new instance and setting it's properties programatically:
LiveCardView liveCardView = new LiveCardView(Context context);
liveCardView.setVideoViewSize(width, height) liveCardView.setVideoUrl(videoUrl);
 liveCardView.startVideo();
 liveCardView.stopVideo();
 liveCardView.setCardBackgroundColor(R.color.primary);
 liveCardView.setTitleText(getString(R.string.title));
 liveCardView.setTextColor(R.color.white);
  • By creating a new instance and passing in a style:
LiveCardView liveCardView = new LiveCardView(Context context, AttributeSet attrs);
<style name="LiveCardStyle">
  <item name="live_background_color">@color/primary</item>
  <item name="live_text_color">@color/white</item> </style>

Loading Card

A loading card allows you to show a simple progress bar to make the user aware that content is being loaded. You can add a loading card in several ways:

  • By creating a new instance and setting it's properties programatically:
LoadingCardView loadingCardView = new LoadingCardView(Context context)

It's background color can be set using:

loadingCardView.setCardBackgroundColor(R.color.primary)

and you can check it is loading and set it's loading state like so:

loadingCardView.setLoading(true);
 loadingCardView.setCardBackgroundColor(R.color.primary);
 loadingCardView.setProgressColor(R.color.white);
 boolean isLoading = loadingCardView.isLoading();
  • By creating a new instance and passing in a style:
LoadingCardView loadingCardView = new LoadingCardView(Context context, AttributeSet attrs)
<style name="LoadingCardStyle">
  <item name="loading_background_color">@color/primary</item>
  <item name="loading_progress_color">@color/white</item> </style>

Tag Card

A tag card allows you to show an icon/text pair. You can add a tag card in several ways:

  • By creating a new instance and setting it's properties programatically:
TagCardView tagCardView = new TagCardView(Context context)
tagCardView.setCardBackgroundColor(R.color.primary) tagCardView.setCardText(R.color.primary) tagCardView.setCardTextColor(R.color.primary) tagCardView.setCardIcon(R.drawable.ic_tag)
  • By creating a new instance and passing in a style:
TagCardView tagCardView = new TagCardView(Context context, AttributeSet attrs)
<style name="TagCardStyle">
  <item name="tag_card_background_color">@color/primary</item>
  <item name="tag_text_color">@color/white</item>
  <item name="tag_icon">@drawable/ic_tag</item> </style>

Icon Card

An icon card allows you to display a title/detail pair with an icon for visual representation. You can add an icon card in several ways:

  • By creating a new instance and setting it's properties programatically:
IconCardView iconCardView = new IconCardView(Context context)
iconCardView.setCardBackgroundColor(R.color.primary);
 iconCardView.setDetailBackgroundColor(R.color.primary_dark);
 iconCardView.setTitleText(getString(R.string.your_string));
 iconCardView.setDetailText(getString(R.string.your_string));
 iconCardView.setTitleTextColor(R.color.white);
 iconCardView.setDetailTextColor(R.color.white);
 iconCardView.setIcon(R.drawable.ic_icon);
  • By creating a new instance and passing in a style:
IconCardView iconCardView = new IconCardView(Context context, AttributeSet attrs)
<style name="IconCardStyle">
  <item name="icon_card_background_color">@color/primary</item>
  <item name="icon_detail_background_color">@color/primary_dark</item>
  <item name="icon_title_text_color">@color/white</item>
  <item name="icon_detail_text_color">@color/white</item>
  <item name="icon_header_icon">@drawable/ic_icon</item> </style>

Resources

A library to format dates as described in Material Design guidelines.

The idea is simple, use java expressions in layout params like layout_left="view1.right+10dp". It is helpful when LinearLayout and RelativeLayout is not enough for you.

This is an Android specific distribution of the latest versions of SQLite. It contains the latest SQLite version and the Android specific database APIs derived from AOSP packaged as an AAR library distributed on jcenter.

A changelog library for Android.

A simplelibrary to shorten long numbers.

For example:

  • 10.000 -> 10.0K
  • 10.000.000 -> 10.0M

A cool search view animation library.

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