GriverOptionMenuPanelExtension
IAPMiniProgram SDK provides the ability for Super App to customize more menu panels. Follow this topic to realize this ability by implementing the specific interface of IAPMiniProgram SDK.
Procedures
To customize more menu panels, follow these steps:
Step 1. Implement the GriverOptionMenuPanelExtension interface
Implement the GriverOptionMenuPanelExtension interface and write code in the required methods according to your business logic.
Code sample as follows:
class CustomOptionMenuPanelExtensionImpl : GriverOptionMenuPanelExtension {
override fun showOptionMenuPanel(page: Page, menuItems: List<GriverMenuItem>) {
//code to show your custom option menu panel
}
}
Step 2: Register the CustomOptionMenuPanelExtensionImpl class
Refer to the following sample code and call the registerExtension interface to register the CustomOptionMenuPanelExtensionImpl class after initializing the SDK.
Then you can view the following screenshot for default user experience.
IAPConnect.init(application, initConfig, object : InitCallback() {
fun onSuccess() {
//ยทยทยท
Griver.registerExtension(
GriverExtensionManifest(
GriverOptionMenuPanelExtension::class.java,
CustomOptionMenuPanelExtensionImpl()
)
)
}
})
Structures
GriverOptionMenuPanelExtension interface
The definition of the GriverOptionMenuPanelExtension interface is shown in the following codes:
interface GriverOptionMenuPanelExtension : GriverExtension {
fun showOptionMenuPanel(page: Page?, menuItems: List<GriverMenuItem>)
}
Methods
Based on the definition above, this interface provides the following methods:
Method | Description |
showOptionMenuPanel | Shows more menu panels. This method is called when the SDK needs to display more menu panels. |
showOptionMenuPanel method
Parameter | Data type | Required | Description |
page | Page | No | Indicates the page instance of the mini program. |
menuItems | List<GriverMenuItem?> | No | Indicates the menu items that need to be displayed in the more menu panels. |
Appendices
User experience
The following screenshot shows a default menu panel.