ParkedOnlyOnClickListener
public
final
class
ParkedOnlyOnClickListener
extends Object
implements
OnClickListener
java.lang.Object | |
↳ | com.google.android.libraries.car.app.model.ParkedOnlyOnClickListener |
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 methods | |
---|---|
static
ParkedOnlyOnClickListener
|
create(OnClickListener listener)
Constructs a new instance of a |
void
|
onClick()
Notifies that a click happened. |
Inherited methods | |
---|---|
Public methods
create
public static ParkedOnlyOnClickListener create (OnClickListener listener)
Constructs a new instance of a ParkedOnlyOnClickListener
.
Parameters | |
---|---|
listener |
OnClickListener |
Returns | |
---|---|
ParkedOnlyOnClickListener |
Throws | |
---|---|
NullPointerException |
if listener is null .
|
onClick
public void onClick ()
Notifies that a click happened.