Skittles


Source link: https://github.com/aashrairavooru/Skittles

#Skittles

A simple,clean api for adding PushBullet style skittles to your app for more material design glory.This library uses the FloatingActionButton provided in the android design support library

##Guide ( Sample)

First some housekeeping code:

Use SkittleLayout as a root view in your layouts

<snow.skittles.SkittleLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/skittleLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:mainSkittleColor="@color/material_deep_teal_500" app:mainSkittleIcon="@drawable/ic_android_white_18dp" tools:context=".MainActivity">  <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="@dimen/appBarMaxHeight" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> ...  </snow.skittles.SkittleLayout>

Some further housekeeping...

Declare a SkittleBuilder,used to add skittles and pass the root SkittleLayout to it

SkittleLayout skittleLayout = (SkittleLayout) findViewById(R.id.skittleLayout);
 //Pass false as the second param if you don't want the menu to be closed on screen tap SkittleBuilder skittleBuilder = SkittleBuilder.newInstance((SkittleLayout) findViewById(R.id.skittleLayout), true);
 

Now for the fun part

Add skittles to your activity/fragment

skittleBuilder.addSkittle(Skittle.newInstance(ContextCompat.getColor(this, R.color.barratheon),

ContextCompat.getDrawable(this, R.drawable.barratheon_icon)));
 skittleBuilder.addSkittle(Skittle.newInstance(ContextCompat.getColor(this, R.color.lannister),

ContextCompat.getDrawable(this, R.drawable.lannister_icon)));

Add TextSkittle to your activity/fragment

 skittleBuilder.addSkittle(new TextSkittle.Builder("Hello", ContextCompat.getColor(this, R.color.stark),

 ContextCompat.getDrawable(this, R.drawable.stark_icon)).setTextBackground(

 ContextCompat.getColor(this, android.R.color.background_light)).build());
 

Flexible callback for clicks:

  • Add a click listener(SkittleBuilder.SkittleClickListener) to the SkittleBuilder object skittleBuilder.setSkittleListener(this);

  • This exposes two methods for Skittle and MainSkittle click events

void onSkittleClick(BaseSkittle skittle, int position);

void onMainSkittleClick();

BaseSkittle is an interface that every skittle implements

public void onSkittleClick(BaseSkittle skittle, int position) {

if(skittle instanceOf TextSkittle)
 ...
else if(skittle instanceOf Skittle)
 ... 
}

Here the position does not include the mainSkittle and starts from 0

You can now create your very own Skittle you just have to implement the BaseSkittle, check TextSkittle or Skittle for further reference

##Snackbar Support

When using snackbars ensure that you use SkittleContainer

Snackbar.make(skittleLayout.getSkittleContainer(), "Skittle Pressed", Snackbar.LENGTH_LONG) .show();

##Gradle

dependencies{
 compile 'com.rlj.library:skittles:4.1.1' 
}

See the Sample and JavaDoc for further guidance

##Upcoming

  • Better support for animations
  • Option for adding skittles by xml (inspired by Navigation View)

#Taste the rainbow ![Skittles](art/Taste the rainbow.jpg)

Resources

Why use Holdr?

  • Because you hate typing findViewById() all the time.
  • Because Butterknife requires non-zero boilerplate and doesn't work well in library projects.
  • Because view holders are cool, but a pain to write.

Gradle Retrolambda Plugin

This plugin will automatically build your java or android project with retrolambda, giving you lambda goodness on java 6 or 7. The minimum android gradle plugin is 0.8+.

Asynchronous operations in Android are very hard to get right due to the Activity lifecycle. AsyncTasks don't handle any of it making them difficult to use. Loaders handle many things for you, but have a clunky api and fall down anytime you want to do anything more complex than loading data immediately when the Activity or Fragment is shown.

This library builds upon rxjava to handle all these things for you with an easy-to-use api.

Unofficial Android REST Client for 9GAG.

ASNE library allows you to make simple integration with different social networks:

  • Twitter
  • LinkedIn
  • Facebook
  • Google Plus
  • Vkontakte
  • Odnoklassniki

LoadingEverywhere is an Android library that makes it easy to create and manage a loading mask over any view.

It supports android versions 2.3 (gingerbread) and above.

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