Android Open Source - Kite Sample Service






From Project

Back to project page Kite.

License

The source code is released under:

Apache License

If you think the Android project Kite listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.kite.sample;
/*  w w  w  . jav  a2s.co m*/

import org.kite.annotations.Provided;
import org.kite.async.AsyncType;
import org.kite.wire.WiredService;

import java.util.concurrent.Executors;

/**
 * TODO
 *
 * @author Nikolay Soroka
 */
public class SampleService extends WiredService {

    public static final String ACTION_BIND_SUBSTRACTOR = "substractor";
    public SampleService() {
        super(Executors.newSingleThreadExecutor(), "SampleService");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        calculator = new Calculator();
    }

    @Provided
    public CalcInterface getCalculator() {
        return this.calculator;
    }

    @Provided(scope = Provided.Scope.ACTION, action = ACTION_BIND_SUBSTRACTOR,async = AsyncType.METHODS)
    public Substractor substractor = new Substractor() {
        @Override
        public int sub(int a, int b) {
            return a - b;
        }

        @Override
        public Integer asyncAdd(int a, int b) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return a + b;
        }
    };


    private CalcInterface calculator;
}




Java Source Code List

org.kite.annotations.AsyncMethod.java
org.kite.annotations.AsyncResult.java
org.kite.annotations.Provided.java
org.kite.annotations.Wired.java
org.kite.async.AsyncHandler.java
org.kite.async.AsyncType.java
org.kite.async.MethodResult.java
org.kite.async.ResultQueue.java
org.kite.sample.CalcFragment.java
org.kite.sample.CalcInterface.java
org.kite.sample.Calculator.java
org.kite.sample.MainActivity.java
org.kite.sample.SampleService.java
org.kite.sample.Substractor.java
org.kite.services.CommandService.java
org.kite.services.MainThreadExecutor.java
org.kite.wire.ClientFacade.java
org.kite.wire.InterfaceFinder.java
org.kite.wire.ServiceFacade.java
org.kite.wire.WireBinder.java
org.kite.wire.WireCallback.java
org.kite.wire.Wire.java
org.kite.wire.WiredService.java
org.kite.wire.package-info.java