summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ProviderAPIResultReceiver.java
blob: e32f6ffd5840331f00f7f783123d9c185187239a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package se.leap.leapclient;

import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;

/**
 * Implements the ResultReceiver needed by Activities using ProviderAPI to receive the results of its operations. 
 * @author parmegv
 *
 */
public class ProviderAPIResultReceiver extends ResultReceiver {
	private Receiver mReceiver;
	
	public ProviderAPIResultReceiver(Handler handler) {
		super(handler);
		// TODO Auto-generated constructor stub
	}
	
	public void setReceiver(Receiver receiver) {
        mReceiver = receiver;
    }

	/**
	 * Interface to enable ProviderAPIResultReceiver to receive results from the ProviderAPI IntentService. 
	 * @author parmegv
	 *
	 */
    public interface Receiver {
        public void onReceiveResult(int resultCode, Bundle resultData);
    }

    @Override
    protected void onReceiveResult(int resultCode, Bundle resultData) {
        if (mReceiver != null) {
            mReceiver.onReceiveResult(resultCode, resultData);
        }
    }
    
}