<commit_before>h1. SEBA

Seba is a simple event bus for android. It doesn't use reflection.

This library is at the very initial phase where all the requirements are not clear yet.
It is likely to be affected by changes and issues.

You may want to have a look at similar but more recognized libraries implementing the event bus model : "otto":https://github.com/square/otto and "eventBus":https://github.com/greenrobot/EventBus.git

If you still like to use it, here is a quick guide. You can always contact me if you want to know more.

h2. How to use it

Typical scenario for this library is the case where from an intent service you need to notify an activity or a fragment.

h3. EventBus instance

Instantiate and share an event bus between event consumers and producers. A good place can be the Application class.

<pre><code>
public class MyApplication extends Application {

	private EventBus eventBus;
		
	public void onCreate() {
		eventBus = new EventBus();
	}
		
	public static final EventBus getEventBus() {
		return eventBus;
	}
}
</code></pre>

h3. Generator of events.

A generator can be an IntentService. In this case you just need to get a reference from the application class and then send the event.

<pre><code>
public class MyIntentService extends IntentService {

	public EventBus eventBus;
		
	public void onCreate() {
		eventBus = Application.getEventBus();
		eventBus.send(new CustomEvent(){});
	}
		
}
</code></pre>

CustomEvent need to implement the marker interface Event.

<pre><code>
public class CustomEvent implements Event {

}
</code></pre>

h3. Consumer of events.

A possible consumer of events is an Activity. The activity need to register and unregister an EventHandler.

<pre><code>
private MainThreadEventHandler eventHandler;

public void onResume() {
	eventHandler = new EventHandler.OnMainThread(new Handler()) {
		@Override
		public void handleAnsyc(Event event) {
			//using this type of handler you can do UI changes
		}
	};
	Application.getEventBus().registerHandler(eventHandler, CustomEvent.class);
}

public void onPause() {
	Application.getEventBus().unregisterHandler(eventHandler, CustomEvent.class);
}
</code></pre>

h2. Get the jar

h3. Maven

With maven is simple as the project is available on sonatype

<pre><code><dependency>
  <groupId>com.luigiagosti</groupId>
  <artifactId>seba</artifactId>
  <version>1.0</version>
</dependency></code></pre>

h3. Download latest

You can download the "latest version":http://search.maven.org/remotecontent?filepath=com/luigiagosti/seba/1.0/seba-1.0.jar to your libs folder.

h2. License

Apache License, Version 2.0

<commit_msg>add a few more points on the readme<commit_after>h1. SEBA

Seba is a simple event bus for android. It doesn't use reflection.

You may want to have a look at similar but more recognized libraries implementing the event bus model : "otto":https://github.com/square/otto and "eventBus":https://github.com/greenrobot/EventBus.git

If you still like to use this library, here is a quick guide. You can always contact me if you want to know more.

h2. How to use it

Typical scenario for this library is the case where from an intent service you need to notify an activity or a fragment.

h3. EventBus instance

Instantiate and share an event bus between event consumers and producers. A good place can be the Application class.

<pre><code>
public class MyApplication extends Application {

	private EventBus eventBus;
		
	public void onCreate() {
		eventBus = new EventBus();
	}
		
	public static final EventBus getEventBus() {
		return eventBus;
	}
}
</code></pre>

h3. Generator of events.

A generator can be an IntentService. In this case you just need to get a reference from the application class and then send the event.

<pre><code>
public class MyIntentService extends IntentService {

	public EventBus eventBus;
		
	public void onCreate() {
		eventBus = Application.getEventBus();
		eventBus.send(new CustomEvent(){});
	}
		
}
</code></pre>

CustomEvent need to implement the marker interface Event.

<pre><code>
public class CustomEvent implements Event {

}
</code></pre>

h3. Consumer of events.

A possible consumer of events is an Activity. The activity need to register and unregister an EventHandler.

<pre><code>
private MainThreadEventHandler eventHandler;

public void onResume() {
	eventHandler = new EventHandler.OnMainThread(new Handler()) {
		@Override
		public void handleAnsyc(Event event) {
			//using this type of handler you can do UI changes
		}
	};
	Application.getEventBus().registerHandler(eventHandler, CustomEvent.class);
}

public void onPause() {
	Application.getEventBus().unregisterHandler(eventHandler, CustomEvent.class);
}
</code></pre>

h2. Get the jar

h3. Maven

With maven is simple as the project is available on sonatype

<pre><code><dependency>
  <groupId>com.luigiagosti</groupId>
  <artifactId>seba</artifactId>
  <version>1.0</version>
</dependency></code></pre>

h3. Download latest

You can download the "latest version":http://goo.gl/Hy139 to your libs folder.

h2. Where it is used

At the moment the library is used on the "image search app":http://goo.gl/Z0VKt. Small application to search for images using different apis.
I haven't see any issue that the app has 300k downloads.

It will nice if you are informing me if you are using the library in your project.


h2. License

Apache License, Version 2.0


{'fraction_non_alphanumeric': 0.08364243323442136, 'fraction_numerical': 0.007047477744807121, 'mean_word_length': 4.2666015625, 'pattern_counts': {'":': 7, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3044986', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1542, 'n_words': 662}