docs/ui-material3.md
changeset 84 f1e51fe391c2
equal deleted inserted replaced
83:33ee5f3d6466 84:f1e51fe391c2
       
     1 Ui-Material3
       
     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-material3:<latest-version>")
       
    12 }
       
    13 ```
       
    14 
       
    15 Usage
       
    16 =====
       
    17 
       
    18 The [OpenSourceDependenciesNavHost](api/ui/material3/com.geekorum.aboutoss.ui.material3/-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 The [AdaptiveOpenSourceDependenciesScreen](api/ui/material3/com.geekorum.aboutoss.ui.material3/-adaptive-open-source-dependencies-screen.html)
       
    35 composable display the licenses in an adaptive screen. The User interface will adapt based on the available space.
       
    36 
       
    37 ```kotlin
       
    38 val licenseInfoRepository = LicenseeLicenseInfoRepository()
       
    39 val viewModel = viewModel<OpenSourceLicensesViewModel>(factory = OpenSourceLicensesViewModel.Factory(licenseInfoRepository))
       
    40 AdaptiveOpenSourceDependenciesScreen(
       
    41     openSourceLicensesViewModel = viewModel,
       
    42     navigateUp = {
       
    43         // close screen
       
    44     }
       
    45 )
       
    46 ```
       
    47 
       
    48 
       
    49 Android
       
    50 =======
       
    51 
       
    52 The [OpenSourceLicensesActivity](api/ui/material3/com.geekorum.aboutoss.ui.material3/-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)
       
    53 You can launch the activity like this:
       
    54 
       
    55 ```kotlin
       
    56 val intent = Intent(this, OpenSourceLicensesActivity::class.java)
       
    57 startActivity(intent)
       
    58 ```
       
    59 
       
    60 
       
    61 Desktop
       
    62 =======
       
    63 
       
    64 On Desktop the [OpenSourceLicensesWindow](api/ui/material3/com.geekorum.aboutoss.ui.material3/-open-source-licenses-window.html) is configured to work with [licensee](https://github.com/cashapp/licensee).
       
    65 You can use it like this:
       
    66 
       
    67 ```kotlin
       
    68 OpenSourceLicensesWindow(onCloseRequest = {
       
    69     // close window
       
    70 })
       
    71 ```
       
    72