sample/src/desktopMain/kotlin/PrebuiltLicensesWindows.kt
author Da Risk <da_risk@geekorum.com>
Sun, 27 Apr 2025 16:19:28 -0400
changeset 57 5e249499bb3e
parent 50 baa92ecc2001
permissions -rw-r--r--
ui:material2: fix some lint errors
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     1
/*
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     2
 * AboutOss is an utility library to retrieve and display
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     3
 * opensource licenses in Android applications.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     4
 *
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     5
 * Copyright (C) 2023-2025 by Frederic-Charles Barthelery.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     6
 *
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     7
 * This file is part of AboutOss.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     8
 *
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     9
 * AboutOss is free software: you can redistribute it and/or modify
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    10
 * it under the terms of the GNU General Public License as published by
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    11
 * the Free Software Foundation, either version 3 of the License, or
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    12
 * (at your option) any later version.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    13
 *
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    14
 * AboutOss is distributed in the hope that it will be useful,
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    17
 * GNU General Public License for more details.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    18
 *
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    19
 * You should have received a copy of the GNU General Public License
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    20
 * along with AboutOss.  If not, see <http://www.gnu.org/licenses/>.
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    21
 */
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    22
package com.geekorum.aboutoss.sampleapp
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    23
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    24
import androidx.compose.runtime.Composable
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    25
import androidx.compose.ui.window.WindowState
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    26
import androidx.compose.ui.window.rememberWindowState
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    27
import androidx.lifecycle.viewmodel.compose.viewModel
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    28
import com.geekorum.aboutoss.ui.common.OpenSourceLicensesViewModel
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    29
import com.geekorum.aboutoss.ui.material.OpenSourceLicensesWindow as Material2OpenSourceLicensesWindow
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    30
import com.geekorum.aboutoss.ui.material3.OpenSourceLicensesWindow as Material3OpenSourceLicensesWindow
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    31
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    32
@Composable
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    33
fun PrebuiltLicencesMaterial2Window(
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    34
    onCloseRequest: () -> Unit,
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    35
    state: WindowState = rememberWindowState(),
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    36
) {
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    37
    val viewModel: OpenSourceLicensesViewModel = viewModel(initializer = {
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    38
        createPrebuildOpenSourceLicensesViewModel()
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    39
    })
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    40
    Material2OpenSourceLicensesWindow(onCloseRequest, state, viewModel)
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    41
}
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    42
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    43
@Composable
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    44
fun PrebuiltLicencesMaterial3Window(
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    45
    onCloseRequest: () -> Unit,
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    46
    state: WindowState = rememberWindowState(),
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    47
) {
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    48
    val viewModel: OpenSourceLicensesViewModel = viewModel(initializer = {
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    49
        createPrebuildOpenSourceLicensesViewModel()
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    50
    })
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    51
    Material3OpenSourceLicensesWindow(onCloseRequest, state, viewModel)
baa92ecc2001 sample: add PrebuiltLicensesWindows for desktop
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    52
}