-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSplitEventTask.java
More file actions
58 lines (55 loc) · 2.07 KB
/
SplitEventTask.java
File metadata and controls
58 lines (55 loc) · 2.07 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package io.split.android.client.events;
import io.split.android.client.SplitClient;
/**
* Base class for handling Split SDK events.
* <p>
* Extend this class and override the methods you need to handle specific SDK events.
* <p>
* <b>Threading:</b>
* <ul>
* <li>{@code onPostExecution} methods are called on a background thread (faster, executed immediately)</li>
* <li>{@code onPostExecutionView} methods are called on the main/UI thread (queued on main looper)</li>
* </ul>
* <p>
* For events with metadata (like SDK_UPDATE or SDK_READY_FROM_CACHE), use
* {@link SplitEventListener} instead for type-safe metadata access.
* <p>
* Example usage:
* <pre>{@code
* client.on(SplitEvent.SDK_READY, new SplitEventTask() {
* @Override
* public void onPostExecution(SplitClient client) {
* // SDK is ready, start using Split
* }
* });
* }</pre>
*/
public class SplitEventTask {
/**
* Called when an event occurs, executed on a background thread.
* <p>
* Override this method to handle events on a background thread.
* This method is executed immediately and is faster than {@link #onPostExecutionView(SplitClient)}.
*
* @param client the Split client instance
* @throws SplitEventTaskMethodNotImplementedException if not overridden (default behavior)
*/
public void onPostExecution(SplitClient client) {
throw new SplitEventTaskMethodNotImplementedException();
}
/**
* Called when an event occurs, executed on the main/UI thread.
* <p>
* Override this method to handle events on the main thread.
* Use this when you need to update UI components.
* <p>
* Note: This method is queued on the main looper, so execution may be delayed
* compared to {@link #onPostExecution(SplitClient)}.
*
* @param client the Split client instance
* @throws SplitEventTaskMethodNotImplementedException if not overridden (default behavior)
*/
public void onPostExecutionView(SplitClient client) {
throw new SplitEventTaskMethodNotImplementedException();
}
}