docs/ui-material.md
changeset 84 f1e51fe391c2
child 97 20ba708adda9
equal deleted inserted replaced
83:33ee5f3d6466 84:f1e51fe391c2
       
     1 Ui-Material
       
     2 ===========
       
     3 
       
     4 Setup
       
     5 =====
       
     6 
       
     7 Add the dependency to your project
       
     8 
       
     9 ```kotlin title="build.gradle.kts"
       
    10 dependencies {
       
    11     implementation("com.geekorum.aboutoss:ui-material:<latest-version>")
       
    12 }
       
    13 ```
       
    14 
       
    15 Usage
       
    16 =====
       
    17 
       
    18 The [OpenSourceDependenciesNavHost](api/ui/material2/com.geekorum.aboutoss.ui.material/-open-source-dependencies-nav-host.html)
       
    19 composable allows to display the licenses. 
       
    20 It takes an [OpenSourceLicensesViewModel](api/ui/common/com.geekorum.aboutoss.ui.common/-open-source-licenses-view-model/index.html)
       
    21 that you can create with the [LicenseInfoRepository](license-sources.md) of your choice.
       
    22 
       
    23 ```kotlin
       
    24 val licenseInfoRepository = LicenseeLicenseInfoRepository()
       
    25 val viewModel = viewModel<OpenSourceLicensesViewModel>(factory = OpenSourceLicensesViewModel.Factory(licenseInfoRepository))
       
    26 OpenSourceDependenciesNavHost(
       
    27     openSourceLicensesViewModel = viewModel,
       
    28     navigateUp = {
       
    29         // close screen
       
    30     }
       
    31 )
       
    32 ```
       
    33 
       
    34 Android
       
    35 =======
       
    36 
       
    37 The [OpenSourceLicensesActivity](api/ui/material2/com.geekorum.aboutoss.ui.material/-open-source-licenses-activity/index.html) is configured to work with the [OSS Licenses Gradle Plugin](https://github.com/google/play-services-plugins/tree/main/oss-licenses-plugin)
       
    38 You can launch the activity like this:
       
    39 
       
    40 ```kotlin
       
    41 val intent = Intent(this, OpenSourceLicensesActivity::class.java)
       
    42 startActivity(intent)
       
    43 ```
       
    44 
       
    45 
       
    46 Desktop
       
    47 =======
       
    48 
       
    49 On Desktop the [OpenSourceLicensesWindow](api/ui/material2/com.geekorum.aboutoss.ui.material/-open-source-licenses-window.html) is configured to work with [licensee](https://github.com/cashapp/licensee).
       
    50 You can use it like this:
       
    51 
       
    52 ```kotlin
       
    53 OpenSourceLicensesWindow(onCloseRequest = {
       
    54     // close window
       
    55 })
       
    56 ```
       
    57