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

Android annotation based SharedPreferences wrapper with fluent interface.

This is a project designed to help controlling Android MediaPlayer class. It makes it easier to use MediaPlayer ListView and RecyclerView. Also it tracks the most visible item in scrolling list. When new item in the list become the most visible, this library gives and API to track it.

Android Timeline is a custom view created to showcase the images against the time photo was taken.

This custom view enables you to simply create a beautiful looking timeline by just including this custom view in your XML file.

An extension of the Floating Action Button to keep track of the user's progress.

Symbols allows to generate static strings constants for attribute names using annotation processor.

Library to automatically populate models, to be used in automatic tests or user made tests.

When performing automatic test we need to create models constantly. Moreover when using hand made test, we may need to populate an application with fake data. Fritter Factory has been developed to solve this problems.

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