qisdk / com.aldebaran.qi.sdk / Qi / onUiThread

onUiThread

static fun <Arg : Any!, Ret : Any!> onUiThread(function: Function<Arg, Ret>!): Function<Arg, Ret>!

Wrap the Function so that its callbacks are executed on the UI thread.

Parameters

function - Function<Arg, Ret>!: the function to wrap

- the output future type

- the input future type

Return
Function<Arg, Ret>!: a Function executed on the UI thread

static fun <Arg : Any!> onUiThread(consumer: Consumer<Arg>!): Consumer<Arg>!

Wrap the Consumer so that its callbacks are executed on the UI thread.

Parameters

consumer - Consumer<Arg>!: the function to wrap

- the input future type

Return
Consumer<Arg>!: a Function executed on the UI thread

static fun onUiThread(listener: QiDisconnectionListener!): QiDisconnectionListener!

Wrap the QiDisconnectionListener so that its callbacks are executed on the UI thread.

Parameters

listener - QiDisconnectionListener!: the listener to wrap

Return
QiDisconnectionListener!: a QiDisconnectionListener executed on the UI thread

static fun <T : Any!> onUiThread(interf: Class<T>!, callback: Any!): T

Wrap the interface implementation so that its callbacks are executed on the UI thread.

Parameters

interf - Class<T>!: the interface to implement

callback - Any!: the callback to wrap

- the output type

Return
T: an instance of the interface that will call the callback on the UI thread