Skip to content

hikage-extension-betterandroid

Maven CentralMaven metadata URLAndroid Min SDK

This is a Hikage extension dependency for BetterAndroid UI component-related features.

Configure Dependency

You can add this module to your project using the following method.

We recommend that you first refer to hikage-bom to use BOM for unified version management.

Add dependency in your project's gradle/libs.versions.toml.

toml
[versions]
hikage-extension-betterandroid = "<version>"

[libraries]
hikage-extension-betterandroid = { module = "com.highcapable.hikage:hikage-extension-betterandroid", version.ref = "hikage-extension-betterandroid" }

Configure dependency in your project's build.gradle.kts.

kotlin
implementation(libs.hikage.extension.betterandroid)

Please change <version> to the version displayed at the top of this document.

Traditional Method

Configure dependency in your project's build.gradle.kts.

kotlin
implementation("com.highcapable.hikage:hikage-extension-betterandroid:<version>")

Please change <version> to the version displayed at the top of this document.

Function Introduction

You can view the KDoc click here.

Adapter Extension

Hikage provides layout extension function for BetterAndroid's Adapter, you can use the Hikage layout directly on the original extension method of the adapter.

It uses the ViewHolderDelegate provided by BetterAndroid to create extension methods.

Here is a simple example based on RecyclerView.

The following example

kotlin
// Assume this is the dataset you need to bind to.
val listData = ArrayList<MyEntity>()
// Create and bind to a custom RecyclerView.Adapter.
val adapter = recyclerView.bindAdapter<MyEntity> {
    onBindData { listData }
    onBindItemView(
        Hikagable = {
            TextView(id = "text_view") {
                text = "Hello, World!"
                textSize = 16f
            }
        }
    ) { hikage, entity, position ->
        hikage.get<TextView>("text_view").text = entity.name
    }
}

Released under the Apache-2.0 License