<commit_before>Enroscar Async
==============

Makes it easy to put your asynchronous operations behind
[Android's Loader](https://developer.android.com/reference/android/content/Loader.html).

Main abstraction here is
[`Async`](providers/src/main/java/com/stanfy/enroscar/async/Async.java)
which represents some asynchronous operation.

Start with describing your operations
-------------------------------------

Let's start with describing an async operation that loads some user name
by user's ID and provides a greeting string.

```java
@Load Async<String> loadGreeting(long userId) {
  return Tools.async(new Callable<String>() {
    public String call() {
      String name = fetchUserName(userId);
      return "Hello " + name;
    }
  });
}
```

In this example we create a simple `Callable` and pass it to `Tools.async` method that
constructs an `Async` implementation running our `Callable` in Android's `AsyncTask`.

// TODO<commit_msg>short readme for Async<commit_after>Enroscar Async
==============

Makes it easy to put your asynchronous operations behind
[Android's Loader](https://developer.android.com/reference/android/content/Loader.html).

Main abstraction here is
[`Async`](providers/src/main/java/com/stanfy/enroscar/async/Async.java)
which represents some asynchronous operation.

How it is used
--------------

Describe an asynchronous operation.

```java
class Foo {
  @Load Async<String> loadGreeting(long userId) {
    return Tools.async(new Callable<String>() {
      public String call() {
        String name = fetchUserName(userId);
        return "Hello " + name;
      }
    });
  }
}
```

In this example we create a simple `Callable` and pass it to `Tools.async` method that
constructs an `Async` implementation running our `Callable` in Android's `AsyncTask`.

An annotations processor generates an operator class `FooOperator` that can be used to 
start/cancel your operations or subscribe to their execution results. Use it!

```java
// this an object that provides operations
Foo foo = new Foo();

// prepare the operator
FooOperator operator = FooOperator.build()
    .withinActivity(activity)
    .operations(foo)
    .get();

// subscribing
operator.when().loadGreetingIsFinished()
    .doOnResult(new Action<String>() {
      @Override
      public void act(final String greeting) {
        Log.i("Async", "Greeting loaded: " + greeting);
      }
    });

// starting
operator.loadGreeting();

// cancelling
operator.cancelLoadGreeting();    
```

See more (including RxJava integration) at our Recipes page.

Download
--------
Gradle

```groovy
compile 
```
{'fraction_non_alphanumeric': 0.13412759415833975, 'fraction_numerical': 0.0, 'mean_word_length': 3.681654676258993, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2680775', 'n_tokens_mistral': 752, 'n_tokens_neox': 713, 'n_words': 243}