cardsui-for-android


Source link: https://github.com/Androguide/cardsui-for-android

CardsUI

An open source library offering the popular Google Now & Google Play cards views, additionnal features, view recycling and an optional Model-View-Controller structure.

Google Play Cards

This new type of card based on the new Google play design are highly customizable.

The parameters include :

  • Title text (String)
  • Description text (String)
  • Title color (String)
  • Stripe color (String)
  • Menu overflow (Boolean)
  • Touch feedback on click (Boolean)

Here is an example :

mCardView.addCard(new MyPlayCard(

"Different Colors for Title & Stripe",

 "You can set any color for the title and any other color for the left stripe",

 "#f2a400", "#9d36d0", true, false));
 

Additionnal Features

In addition to the Google Play cards, I made a few changes to the original library by Nadav Fima.

Those changes include :

  • Setting regular cards's description text programmatically

Called like this :

mCardView.addCard(new MyCard("title string", "description string");
 
  • Setting stack titles's color programmatically_

Called like this :

CardStack stack = new CardStack();
 stack.setTitle("Card Title");
 stack.setColor("#33b5e5");
 mCardView.addStack(stack);
 
  • Attaching arbitrary data to cards

The data property of AbstractCard allows the programmer to attach arbitrary data to any Card or even a stack of cards, since CardStack extends AbstractCard. This attached data can be set and retrived in the following fashion:

Integer myData = 42; card.setData(myData);
 //... Integer theData = (Integer) card.getData();
 // theData == 42
  • Setting custom card backgrounds

If you want to provide a custom Drawable for the Card's background, then use the setBackgroundResource() method:

card.setBackgroundResource(R.drawable.custom_card_bg);

Model-View-Controller implementation

The CardModel is essentially a copy of AbstractCard, except that it is concrete, Serializable, and specifies a target type that should be used when put through CardFactory.createCard(CardModel). CardFactory defines a single, static function, createCard(CardModel), which uses the Reflection API to inflate a CardModel into a descendant of AbstractCard as specified by model.cardClass. You can check-out an example at FLamparski's FLamparski/areabase, namely in the SummaryFragment class.

Example:

CardModel model = new CardModel("This is the card's description", "This is the card's title", BasicCard.class);
 BasicCard card = (BasicCard) CardFactory.createCard(model);
 // This cast is safe mCardUI.addCard(card);

Special thanks to https://github.com/FLamparski for the MVC implementation and data attachement/background modification commits.

CardsUI Generator

I'm working on a supplementary example app for the CardsUI library. This app includes a little daemon to generate cards and set their parameters with a nice animated gui. Ultimately, the aim of this app will be to generate a zip file containing the code & resources needed for the cards "activity" the user generated in the app. Considering that the cards layouts need to be on the app side, and not on the library side, this could be useful.

Resources

LayoutCast is a little tool to help with that, it will cast every changes in your Java source code or resources (including library project) to your phone within 5 sec, and does not restart the hold application.

Unable to execute dex: method ID not in [0, 0xffff]: 65536)

When you get this message, normally it is not because your project itself has too much methods, but you are importing some big .jar libraries.

So the easy solution is to pack your .jar libraries in libs/ folder into a secondary .dex file and load that file before your application starts.

SafeLooper catches unexpected exceptions in Android applications to avoid showing force close dialog.

Cat photos app for Material Design Animation training.

A layout that hide the header when the body is scrolled down and reveal it when the header is scrolled up.

AppIntroAnimation is a set of code snippets to make cool intro screen for your app with special Image Translation and Transformation animation effects. It is very easy to use and customize without adding third party library integrations.

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