fast-event
fcannizzaro
14
Visit GitHub RepoEvent Buses

fast-event

Simple event creation

Build Status Android Arsenal

How to include

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
      ...
      maven { url "https://jitpack.io" }
    }
  }

Step 2. Add the dependency

dependencies {
    compile 'com.github.fcannizzaro:fast-event:1.0.0'
}

Static Methods

bind(Class clazz, [, Activity activity])

register event annotations.

emit(event, Object ... args)

emit event.

delete(event)

delete event.

Annotations

@Event(String: event)

define method to run.

@OnUi

run method on ui.

@Async

run method on a thread.

Usage

Activity / Service / Class

class Sample extends Activity {

    @OnUi
    @Event("my-event")
    private void onUpdate(String key, Integer counter) {
        // do something
    }

    @Async
    @Event("my-event-on-thread")
    private void onUpdate(String key) {
        // do something
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
        FastEvent.bind(this);
        ...
    }
    
}

Fragment

class Sample extends Fragment {

    // define events
    // ...
    
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        ...
        FastEvent.bind(this, getActivity());
        ...
    }
    
}

Emit

 FastEvent.emit("my-event", "fcannizzaro", 20);

License

MIT - Francesco Cannizzaro

Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT