ParkedOnlyOnClickListener


@CarProtocol
class ParkedOnlyOnClickListener : OnClickListener


An OnClickListener that wraps another one and executes its onClick method only when the car is parked.

When the car is not parked, the handler won't be executed and the host will display a message to the user indicating that the action can only be used while parked.

Actions that direct the users to their phones must only execute while parked. This class should be used for wrapping any click listeners that invoke such actions.

Example:

builder.setOnClickListener(ParkedOnlyOnClickListener.create(
    () -> myClickAction()));

Summary

Public functions

java-static ParkedOnlyOnClickListener

Constructs a new instance of a ParkedOnlyOnClickListener.

Unit

Triggers the onClick method in the listener wrapped by this object.

Public functions

create

Added in 1.0.0
java-static fun create(listener: OnClickListener): ParkedOnlyOnClickListener

Constructs a new instance of a ParkedOnlyOnClickListener.

Note that the listener relates to UI events and will be executed on the main thread using getMainLooper.

Throws
java.lang.NullPointerException

if listener is null

onClick

Added in 1.7.0-beta03
fun onClick(): Unit

Triggers the onClick method in the listener wrapped by this object.