TinyTask


Source link: https://github.com/inaka/TinyTask

TinyTask

A tiny Android library to create async background tasks. Highly inspired by NanoTasks, but with a funnier API :)

Abstract

Android's AsyncTasks are highly criticized for being bad, unreliable, outdated, etc. Are they perfect? No. Do we have better alternatives? Sure, but sometimes all we want is a quick and simple way to run something in the background.

What is it, really?

Just a tiny wrapper around an AsyncTask, with a funny looking API.

How to download and Install

Add the following to your build.gradle file:

repositories {
  maven {

url "https://jitpack.io"  
}
 
}
  dependencies {
  // ...
compile 'com.github.inaka:tinytask:v1'
// ... 
}

Code Example

The API methods should be self-explanatory :)

TinyTask.perform(new Something<String>() {

 @Override

 public String whichDoes() {

  return doWork();
 // you write this method..

 
}

 
}
).whenDone(new DoThis<String>() {

 @Override

 public void ifOK(String result) {

  Log.i(TAG, result);

 
}

  @Override

 public void ifNotOK(Exception e) {

  Log.i(TAG, e.toString());

 
}

}
).go();

Contact Us

For questions or general comments regarding the use of this library, please use our public hipchat room.

If you find any bugs or have a problem while using this library, please open an issue in this repo (or a pull request :)).

And you can check all of our open-source projects at inaka.github.io

Thanks to

NanoTasks for inspiration

Resources

An Android wrapper for the Rome2Rio API.

A port of Plaid's ReflowText that allows easily transitioning between sibling TextViews - no matter their size or style.

Kotlin delegates for Android Shared Preferences.

Add a cart icon with animated item counter to the Toolbar. You can increment the counter based on the number of unique items the user has in the shopping cart.

Another floating action button menu with expand/collapse behavior.

Menu resource example

The menu is structure from top to bottom, for example, the first one is the main button and the others will be the first option, second option and etc. The first item don't need to have a text because only the options have labels.

ViewPager with tabs without the usage of fragments (simpler lifecycle).

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