Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.43 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.43 KB

compose-wallet-button

Maven Central

An Android library that provides a Jetpack Compose wrapper on top of the Google Wallet button assets.

Installation

The library is hosted on Maven central and can be used by ensuring the following lines exist in each gradle file:

build.gradle:

repositories {
    mavenCentral()
}

app/build.gradle:

dependencies {
    implementation "com.google.wallet.button:compose-wallet-button:<version>"
}

Usage

// other imports omitted for brevity
// see full example in the "app" directory

import com.google.wallet.button.ButtonType
import com.google.wallet.button.WalletButton

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val onClick = { println("Button clicked") }

        setContent {
            // Default
            WalletButton(onClick = onClick)

            // Customized look
            WalletButton(onClick = onClick, modifier = Modifier.width(350.dp))

            // Condensed version
            WalletButton(onClick = onClick, type = ButtonType.AddCondensed)
        }
    }
}