All Projects → josephrubin → Rumble 4 Android

josephrubin / Rumble 4 Android

Licence: mit
Dead simple Android library for API independant Vibration functionality with fluent interface.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Rumble 4 Android

Jaque
Lets Java 8 Lambdas to be represented as objects in the form of expression trees at runtime
Stars: ✭ 152 (+484.62%)
Mutual labels:  fluent-interface
fluentcheck
Fluent assertions for Python
Stars: ✭ 79 (+203.85%)
Mutual labels:  fluent-interface
Acf Fluent
✒️ A fluent interface for the Advanced Custom Fields WordPress plugin
Stars: ✭ 264 (+915.38%)
Mutual labels:  fluent-interface
Filehound
Flexible and fluent interface for searching the file system
Stars: ✭ 190 (+630.77%)
Mutual labels:  fluent-interface
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (+84.62%)
Mutual labels:  fluent-interface
php-currency-api
Standardized wrapper for popular currency rate APIs. Currently supports FixerIO, CurrencyLayer, Open Exchange Rates and Exchange Rates API.
Stars: ✭ 17 (-34.62%)
Mutual labels:  fluent-interface
Fluentmediator
🔀 FluentMediator is an unobtrusive library that allows developers to build custom pipelines for Commands, Queries and Events.
Stars: ✭ 128 (+392.31%)
Mutual labels:  fluent-interface
Validation
The most awesome validation engine ever created for PHP
Stars: ✭ 5,484 (+20992.31%)
Mutual labels:  fluent-interface
Dexiom.EPPlusExporter
A very simple, yet incredibly powerfull library to generate Excel documents out of objects, arrays, lists, collections, etc.
Stars: ✭ 19 (-26.92%)
Mutual labels:  fluent-interface
csharp-http-client
Twilio SendGrid's C# HTTP Client for calling APIs
Stars: ✭ 25 (-3.85%)
Mutual labels:  fluent-interface
FluentInterfaceCreator
Tool to create fluent interface files
Stars: ✭ 58 (+123.08%)
Mutual labels:  fluent-interface
ugo
Simple and expressive toolbox written in Go
Stars: ✭ 27 (+3.85%)
Mutual labels:  fluent-interface
windows-ui-web
Build windows fluent UI apps or web apps using Html, CSS & JavaScript. Comes with rich native like components, icon sets. Used as fast prototyping tool for Windows environment platforms.
Stars: ✭ 98 (+276.92%)
Mutual labels:  fluent-interface
Fluent Reveal Effect
Fluent Reveal Effect JavaScript library for web
Stars: ✭ 164 (+530.77%)
Mutual labels:  fluent-interface
Thumbnailator
Thumbnailator - a thumbnail generation library for Java
Stars: ✭ 3,845 (+14688.46%)
Mutual labels:  fluent-interface
Mailbody
Create transactional email with a fluent interface (.net)
Stars: ✭ 151 (+480.77%)
Mutual labels:  fluent-interface
csvplus
csvplus extends the standard Go encoding/csv package with fluent interface, lazy stream operations, indices and joins.
Stars: ✭ 67 (+157.69%)
Mutual labels:  fluent-interface
Chainly
Make any .NET object a fluent interface regardless if you have the source code or not!
Stars: ✭ 19 (-26.92%)
Mutual labels:  fluent-interface
Pnp Js Core
Code moved to https://github.com/pnp/pnpjs. This repository is archived.
Stars: ✭ 382 (+1369.23%)
Mutual labels:  fluent-interface
php-underscore
PHP underscore inspired &/or cloned from _.js, with extra goodies like higher order messaging
Stars: ✭ 42 (+61.54%)
Mutual labels:  fluent-interface

Rumble-4-Android

r4a abstracts away the annoying Android Vibrator API which suffers from a number of issues:

  • Different versions of android have deprecated or added different functions and you are expected to know which ones to use depending on the device version.
  • You have to make a new object for every single vibration you want to run.
  • Patterns are tedious and not intuitive.

Instead...

Setup (easy!)

  1. Download Rumble.java and place it anywhere in the source directory of your project.
  2. Add the line <uses-permission android:name="android.permission.VIBRATE" /> inside the manifest tag of your project's AndroidManifest.xml.
  3. Call Rumble.init(applicationContext) and pass it your application's Context. For example, you can place the following code in your activity:

MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState)  {
    super.onCreate(savedInstanceState);
    Rumble.init(getApplicationContext());
}

Use (fluent!)

One-time device vibration java Rumble.once(500); // Vibrate for 500 milliseconds.

Patterns

Rumble.makePattern()  
    .beat(300)  
    .rest(250)  
    .beat(720)  
    .playPattern();

Repeating patterns

Rumble.makePattern()  
    .rest(200)
    .beat(30) 
    .beat(holdDuration) // Automatically adds to previous beat.
    .playPattern(4);      // Play 4 times in a row.

Save patterns for later

RumblePattern pattern = Rumble.makePattern()
    .beat(30).rest(150).beat(40).rest(40);
	
pattern.rest(80).beat(700); // Add to a pattern later.
pattern.playPattern();      // Play it whenever you like.

Lock patterns to prevent mutation

pattern.lock();
pattern.playPattern(3);     // Works just fine.
pattern.beat(500).rest(250) // Throws IllegalStateException.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].