Listen for the title click event

If you want to show some interesting things (e.g. Easter eggs) when clicking the title quickly, you need to listen for the title click event. Griver sends out the titleClick event when you click the title view. You just need to implement the GriverTitleBarEvent to listen for the titleClick event.

Procedures

To listen for the mini program title click events, complete the following steps:

Step 1: Implement the GriverTitleBarEvent interface

Implement the GriverTitleBarEvent interface and write code in the required methods according to your business logic. See the following example for how to implement this interface.

copy
class DemoGriverTitleBarEvent : GriverTitleBarEvent {
    override fun onTitleClick() {
    }

    override fun onInitialized() {
    }

    override fun onFinalized() {
    }
}

Step 2: Register the DemoGriverTitleBarEvent class

Refer to the following sample code to call the registerEventHandler API to register the close click event after initializing the SDK:

copy
Griver.registerEventHandler(
    GriverEventManifest(
        DemoGriverTitleBarEvent::class.java.name,
        Arrays.asList(GriverTitleBarEvent::class.java.name), Page::class.java
    )
)

Structures

GriverTitleBarEvent interface

The definition of the GriverTitleBarEvent interface is shown in the following code:

copy
interface GriverTitleBarEvent : GriverEvent {

    fun onTitleClick()
}

Based on the definition, this interface provides the following methods:

Method Name

Description

onTitleClick

This method is called when title is clicked.