Kite

Kite is a framework aimed to ease android development.

View project onGitHub

Kite is a try to make some clarity in Android development, which is full of workarounds and not-easy-hacks.

Now it consists only from Wire - a helper for binding to Android Services

Coming soon:

  • Async methods wrappers
  • Remote - binding to remote services without Aidl
  • Command services - handy services that can do work in background
  • Graphite - extension to android storage
  • and, an assortment of tasty helpers

Wire:

Connecting to local services ( that are in same process as their clients) using binding mechanism, and by default will also fill dependencies in client.

public class MyService extends WiredService {
     @Provided
     WorkerInterface worker = new WorkerImpl();
}
public class MyClient { // it can be Activity, Fragment or any object
    // what you need, is Context
    @Wired 
    WorkerInterface serviceWorker; 

    // init
    wire = Wire.with(context).from(MyService.class).to(this);

    // onStart():
    wire.connect();
    // serviceWorker will be filled with WorkerImpl instance from service

    // onStop():
    wire.disconnect();
   // serviceWorker will be nullified 
}

Scopes:

By default, when you connect pointing service class, you get all provided instances with ALL scope. So if you want to adhere encapsulation, you can set scope provided instances:

// will be available only when intent.action == SOME_INTENT_ACTION
@Provided(scope = Scope.ACTION, action = SOME_INTENT_ACTION )
SomeInterface worker;

// will be available with any intent and with no intent
@Provided(scope = Scope.ALL )
SomeInterface worker;

// default, will be available only when no intent is set in connection
@Provided(scope = Scope.DEFAULT)
SomeInterface worker;