diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2884a09..f0de4284f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,8 @@ jobs: ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} run: | ./gradlew aboutlibraries-core:publishAllPublicationsToMavenCentralRepository --no-daemon -Plibrary_core_only --no-configure-on-demand --no-parallel - ./gradlew aboutlibraries-compose:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_only --no-configure-on-demand --no-parallel + ./gradlew aboutlibraries-compose-m2:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_only --no-configure-on-demand --no-parallel + ./gradlew aboutlibraries-compose-m3:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_m3_only --no-configure-on-demand --no-parallel - name: Publish the windows artifact if: matrix.os == 'windows-latest' diff --git a/README.md b/README.md index f5afb419a..f16cd6054 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ ## Latest releases 🛠 -- (Next Gen) Kotlin && Multiplatform && Plugin | [v10.10.0-rc02](https://github.com/mikepenz/AboutLibraries/tree/v10.10.0-rc02) +- (Next Gen) Kotlin && Multiplatform && Plugin | [v10.10.0](https://github.com/mikepenz/AboutLibraries/tree/v10.10.0) - Kotlin && Gradle Plugin | [v8.9.4](https://github.com/mikepenz/AboutLibraries/tree/v8.9.4) ## Gradle Plugin @@ -214,6 +214,9 @@ for (lib in libraries) { ```gradle implementation "com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}" + +// Alternative Material3 based module +implementation "com.mikepenz:aboutlibraries-compose-m3:${latestAboutLibsRelease}" ``` ### Usage diff --git a/aboutlibraries-compose/.gitignore b/aboutlibraries-compose-m2/.gitignore similarity index 100% rename from aboutlibraries-compose/.gitignore rename to aboutlibraries-compose-m2/.gitignore diff --git a/aboutlibraries-compose/build.gradle.kts b/aboutlibraries-compose-m2/build.gradle.kts similarity index 100% rename from aboutlibraries-compose/build.gradle.kts rename to aboutlibraries-compose-m2/build.gradle.kts diff --git a/aboutlibraries-compose/gradle.properties b/aboutlibraries-compose-m2/gradle.properties similarity index 100% rename from aboutlibraries-compose/gradle.properties rename to aboutlibraries-compose-m2/gradle.properties diff --git a/aboutlibraries-compose/src/androidMain/AndroidManifest.xml b/aboutlibraries-compose-m2/src/androidMain/AndroidManifest.xml similarity index 100% rename from aboutlibraries-compose/src/androidMain/AndroidManifest.xml rename to aboutlibraries-compose-m2/src/androidMain/AndroidManifest.xml diff --git a/aboutlibraries-compose/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/AndroidLibraries.kt b/aboutlibraries-compose-m2/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/AndroidLibraries.kt similarity index 100% rename from aboutlibraries-compose/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/AndroidLibraries.kt rename to aboutlibraries-compose-m2/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/AndroidLibraries.kt diff --git a/aboutlibraries-compose/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/data/FakeData.kt b/aboutlibraries-compose-m2/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/data/FakeData.kt similarity index 100% rename from aboutlibraries-compose/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/data/FakeData.kt rename to aboutlibraries-compose-m2/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/data/FakeData.kt diff --git a/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/Libraries.kt b/aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/Libraries.kt similarity index 100% rename from aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/Libraries.kt rename to aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/Libraries.kt diff --git a/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt b/aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt similarity index 100% rename from aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt rename to aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt diff --git a/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/util/Extensions.kt b/aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/util/Extensions.kt similarity index 100% rename from aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/util/Extensions.kt rename to aboutlibraries-compose-m2/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/util/Extensions.kt diff --git a/aboutlibraries-compose-m3/.gitignore b/aboutlibraries-compose-m3/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/aboutlibraries-compose-m3/.gitignore @@ -0,0 +1 @@ +/build diff --git a/aboutlibraries-compose-m3/build.gradle.kts b/aboutlibraries-compose-m3/build.gradle.kts new file mode 100644 index 000000000..10daed8eb --- /dev/null +++ b/aboutlibraries-compose-m3/build.gradle.kts @@ -0,0 +1,142 @@ +@file:OptIn(ExperimentalWasmDsl::class) + +import com.vanniktech.maven.publish.SonatypeHost +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + +plugins { + kotlin("multiplatform") + id("com.android.library") + id("org.jetbrains.compose") + id("org.jetbrains.dokka") + id("com.vanniktech.maven.publish") +} + +android { + compileSdk = libs.versions.compileSdk.get().toInt() + namespace = "com.mikepenz.aboutlibraries.ui.compose.m3" + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + tasks.withType { + kotlinOptions.jvmTarget = "11" + + kotlinOptions { + if (project.findProperty("composeCompilerReports") == "true") { + freeCompilerArgs += listOf( + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler" + ) + } + if (project.findProperty("composeCompilerMetrics") == "true") { + freeCompilerArgs += listOf( + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler" + ) + } + } + } + + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + } + + lint { + abortOnError = false + } +} + + +compose { + //kotlinCompilerPlugin.set("androidx.compose.compiler:compiler") + //kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=${libs.versions.kotlinCore.get()}") +} + +kotlin { + applyDefaultHierarchyTemplate() + + jvm() + + androidTarget { + publishLibraryVariants("release") + } + + js(IR) { + browser() + } + + iosX64() + iosArm64() + iosSimulatorArm64() + macosX64() + macosArm64() + wasmJs { + nodejs() + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.ui) + implementation(compose.foundation) + implementation(compose.material3) + implementation(libs.kotlinx.collections) + } + } + val commonTest by getting + } +} + +dependencies { + commonMainApi(project(":aboutlibraries-core")) + + debugImplementation(compose.uiTooling) + "androidMainImplementation"(compose.preview) + + "androidMainImplementation"(libs.androidx.core.ktx) +} + +configurations.configureEach { + // We forcefully exclude AppCompat + MDC from any transitive dependencies. This is a Compose module, so there's no need for these + // https://github.com/chrisbanes/tivi/blob/5e7586465337d326a1f1e40e0b412ecd2779bb5c/build.gradle#L72 + exclude(group = "androidx.appcompat") + exclude(group = "com.google.android.material", module = "material") + exclude(group = "com.google.android.material", module = "material3") +} + +tasks.dokkaHtml.configure { + dokkaSourceSets { + configureEach { + noAndroidSdkLink.set(false) + } + } +} + + + +if (project.hasProperty("pushall") || project.hasProperty("library_compose_m3_only")) { + mavenPublishing { + publishToMavenCentral(SonatypeHost.S01) + signAllPublications() + } +} \ No newline at end of file diff --git a/aboutlibraries-compose-m3/gradle.properties b/aboutlibraries-compose-m3/gradle.properties new file mode 100755 index 000000000..1b8df7387 --- /dev/null +++ b/aboutlibraries-compose-m3/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=AboutLibraries Library +POM_DESCRIPTION=AboutLibraries automatically detects all dependencies of a project and collects their information including the license. Optionally visualising it via the provided ui components. +POM_ARTIFACT_ID=aboutlibraries-compose-m3 diff --git a/aboutlibraries-compose-m3/src/androidMain/AndroidManifest.xml b/aboutlibraries-compose-m3/src/androidMain/AndroidManifest.xml new file mode 100644 index 000000000..8072ee00d --- /dev/null +++ b/aboutlibraries-compose-m3/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/AndroidLibraries.kt b/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/AndroidLibraries.kt new file mode 100644 index 000000000..4f8010a83 --- /dev/null +++ b/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/AndroidLibraries.kt @@ -0,0 +1,128 @@ +package com.mikepenz.aboutlibraries.ui.compose.m3 + +import android.content.Context +import android.widget.TextView +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.runtime.produceState +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView +import androidx.core.text.HtmlCompat +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.ui.compose.m3.data.fakeData +import com.mikepenz.aboutlibraries.ui.compose.m3.util.StableLibrary +import com.mikepenz.aboutlibraries.ui.compose.m3.util.htmlReadyLicenseContent +import com.mikepenz.aboutlibraries.ui.compose.m3.util.stable +import com.mikepenz.aboutlibraries.util.withContext +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +/** + * Displays all provided libraries in a simple list. + */ +@Composable +fun LibrariesContainer( + modifier: Modifier = Modifier, + librariesBlock: (Context) -> Libs = { context -> + Libs.Builder().withContext(context).build() + }, + lazyListState: LazyListState = rememberLazyListState(), + contentPadding: PaddingValues = PaddingValues(0.dp), + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + itemSpacing: Dp = LibraryDefaults.LibraryItemSpacing, + header: (LazyListScope.() -> Unit)? = null, + onLibraryClick: ((StableLibrary) -> Unit)? = null, +) { + val context = LocalContext.current + + val libraries = produceState(null) { + value = withContext(Dispatchers.IO) { + librariesBlock(context) + } + } + LibrariesContainer( + libraries.value?.stable, + modifier, + lazyListState, + contentPadding, + showAuthor, + showVersion, + showLicenseBadges, + colors, + padding, + itemContentPadding, + itemSpacing, + header, + onLibraryClick, + licenseDialogBody = { library -> + HtmlText( + html = library.library.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(), + color = colors.contentColor, + ) + } + ) +} + +@Composable +fun HtmlText( + html: String, + modifier: Modifier = Modifier, + color: Color = LibraryDefaults.libraryColors().contentColor, +) { + AndroidView(modifier = modifier, factory = { context -> + TextView(context).apply { + setTextColor(color.toArgb()) + } + }, update = { it.text = HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_COMPACT) }) +} + +@Preview("Library items (Default)") +@Composable +fun PreviewLibraries() { + MaterialTheme { + Surface { + Libraries(fakeData.libraries.stable) + } + } +} + + +@Preview("Library items (Off)") +@Composable +fun PreviewLibrariesOff() { + MaterialTheme { + Surface { + Libraries(fakeData.libraries.stable, showAuthor = false, showLicenseBadges = false) + } + } +} + +@Preview("Library item") +@Composable +fun PreviewLibrary() { + MaterialTheme { + Surface { + Library( + fakeData.libraries.first().stable + ) { + // on-click + } + } + } +} diff --git a/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/data/FakeData.kt b/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/data/FakeData.kt new file mode 100644 index 000000000..f5c59c7dc --- /dev/null +++ b/aboutlibraries-compose-m3/src/androidMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/data/FakeData.kt @@ -0,0 +1,211 @@ +package com.mikepenz.aboutlibraries.ui.compose.m3.data + +import com.mikepenz.aboutlibraries.Libs + +internal val fakeData: Libs + get() = Libs.Builder().withJson( + """ + { + "libraries": [ + { + "uniqueId": "com.mikepenz:materialdrawer", + "developers": [ + { + "organisationUrl": "https://mikepenz.dev", + "name": "Mike Penz" + } + ], + "artifactVersion": "9.0.0-a01", + "description": "(Merged) The flexible, easy to use, all in one drawer library for your Android project.", + "scm": { + "connection": "scm:git@github.com:mikepenz/MaterialDrawer.git", + "url": "https://github.com/mikepenz/MaterialDrawer", + "developerConnection": "scm:git@github.com:mikepenz/MaterialDrawer.git" + }, + "name": "ABC MaterialDrawer Library", + "website": "https://github.com/mikepenz/MaterialDrawer", + "licenses": [ + "133a737bef925d338a857868bf2a1db5", + "686f4183d3c0e1d6f495fd0ae3d74771", + "Apache-2.0" + ] + }, + { + "uniqueId": "com.mikepenz:fastadapter-extensions-expandable", + "developers": [ + { + "name": "Mike Penz" + } + ], + "artifactVersion": "5.5.1", + "description": "Commons extension for the FastAdapter library. The bullet proof, fast and easy to use adapter library.", + "scm": { + "connection": "scm:git@github.com:mikepenz/FastAdapter.git", + "url": "https://github.com/mikepenz/FastAdapter", + "developerConnection": "scm:git@github.com:mikepenz/FastAdapter.git" + }, + "name": "FastAdapter Library-Extensions-Expandable", + "website": "https://github.com/mikepenz/FastAdapter", + "licenses": [ + "29162c4a2ae4d7ec6b3925cbde680772" + ] + }, + { + "uniqueId": "org.jetbrains.kotlin:kotlin-stdlib-jdk8", + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "Kotlin Team" + } + ], + "artifactVersion": "1.5.31", + "description": "Kotlin Standard Library JDK 8 extension", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/kotlin.git", + "url": "https://github.com/JetBrains/kotlin", + "developerConnection": "scm:git:https://github.com/JetBrains/kotlin.git" + }, + "name": "Kotlin Stdlib Jdk8", + "website": "https://kotlinlang.org/", + "licenses": [ + "Apache-2.0" + ] + }, + { + "uniqueId": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "Kotlin Team" + } + ], + "artifactVersion": "1.5.31", + "description": "Kotlin Standard Library JDK 7 extension", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/kotlin.git", + "url": "https://github.com/JetBrains/kotlin", + "developerConnection": "scm:git:https://github.com/JetBrains/kotlin.git" + }, + "name": "Kotlin Stdlib Jdk7", + "website": "https://kotlinlang.org/", + "licenses": [ + "Apache-2.0" + ] + }, + { + "uniqueId": "org.jetbrains.kotlin:kotlin-stdlib", + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "Kotlin Team" + } + ], + "artifactVersion": "1.5.31", + "description": "Kotlin Standard Library for JVM", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/kotlin.git", + "url": "https://github.com/JetBrains/kotlin", + "developerConnection": "scm:git:https://github.com/JetBrains/kotlin.git" + }, + "name": "Kotlin Stdlib", + "website": "https://kotlinlang.org/", + "licenses": [ + "Apache-2.0" + ] + }, + { + "uniqueId": "org.jetbrains:annotations", + "developers": [ + { + "organisationUrl": "http://www.jetbrains.com", + "name": "JetBrains Team" + } + ], + "artifactVersion": "13.0", + "description": "A set of annotations used for code inspection support and code documentation.", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/intellij-community.git", + "url": "https://github.com/JetBrains/intellij-community" + }, + "name": "IntelliJ IDEA Annotations", + "website": "http://www.jetbrains.org", + "licenses": [ + "686f4183d3c0e1d6f495fd0ae3d74771" + ] + }, + { + "uniqueId": "org.jetbrains.kotlin:kotlin-stdlib-common", + "developers": [ + { + "organisationUrl": "https://www.jetbrains.com", + "name": "Kotlin Team" + } + ], + "artifactVersion": "1.5.31", + "description": "Kotlin Common Standard Library", + "scm": { + "connection": "scm:git:https://github.com/JetBrains/kotlin.git", + "url": "https://github.com/JetBrains/kotlin", + "developerConnection": "scm:git:https://github.com/JetBrains/kotlin.git" + }, + "name": "Kotlin Stdlib Common", + "website": "https://kotlinlang.org/", + "licenses": [ + "Apache-2.0" + ] + }, + { + "uniqueId": "com.mikepenz:fastadapter", + "developers": [ + { + "name": "Mike Penz" + } + ], + "artifactVersion": "5.5.1", + "description": "The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...", + "scm": { + "connection": "scm:git@github.com:mikepenz/FastAdapter.git", + "url": "https://github.com/mikepenz/FastAdapter", + "developerConnection": "scm:git@github.com:mikepenz/FastAdapter.git" + }, + "name": "FastAdapter Library", + "website": "https://github.com/mikepenz/FastAdapter", + "licenses": [ + "29162c4a2ae4d7ec6b3925cbde680772" + ] + } + ], + "licenses": { + "29162c4a2ae4d7ec6b3925cbde680772": { + "content": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2021 Mike Penz\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n", + "hash": "29162c4a2ae4d7ec6b3925cbde680772", + "url": "https://raw.githubusercontent.com/mikepenz/FastAdapter/develop/LICENSE", + "spdxId": "Apache-2.0", + "name": "Apache License 2.0" + }, + "Apache-2.0": { + "content": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.\n\n\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:\n\n (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.\n\n You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\nTo apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same \"printed page\" as the copyright notice for easier identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", + "hash": "Apache-2.0", + "internalHash": "Apache-2.0", + "url": "https://spdx.org/licenses/Apache-2.0.html", + "spdxId": "Apache-2.0", + "name": "Apache License 2.0" + }, + "133a737bef925d338a857868bf2a1db5": { + "content": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2021 Mike Penz\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", + "hash": "133a737bef925d338a857868bf2a1db5", + "url": "https://raw.githubusercontent.com/mikepenz/MaterialDrawer/develop/LICENSE", + "spdxId": "Apache-2.0", + "name": "Apache License 2.0" + }, + "686f4183d3c0e1d6f495fd0ae3d74771": { + "content": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2000-2021 JetBrains s.r.o.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", + "hash": "686f4183d3c0e1d6f495fd0ae3d74771", + "url": "https://raw.githubusercontent.com/JetBrains/intellij-community/master/LICENSE.txt", + "spdxId": "Apache-2.0", + "name": "Apache License 2.0" + } + } + } + """.trimIndent() + ).build() \ No newline at end of file diff --git a/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/Libraries.kt b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/Libraries.kt new file mode 100644 index 000000000..3681b4c8f --- /dev/null +++ b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/Libraries.kt @@ -0,0 +1,96 @@ +package com.mikepenz.aboutlibraries.ui.compose.m3 + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.ui.compose.m3.util.StableLibrary +import com.mikepenz.aboutlibraries.ui.compose.m3.util.stable + +/** + * Displays all provided libraries in a simple list. + */ +@Composable +fun LibrariesContainer( + aboutLibsJson: String, + modifier: Modifier = Modifier, + lazyListState: LazyListState = rememberLazyListState(), + contentPadding: PaddingValues = PaddingValues(0.dp), + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + itemSpacing: Dp = LibraryDefaults.LibraryItemSpacing, + header: (LazyListScope.() -> Unit)? = null, + onLibraryClick: ((StableLibrary) -> Unit)? = null, +) { + val libs = Libs.Builder().withJson(aboutLibsJson).build().stable + LibrariesContainer( + libs, + modifier = modifier, + lazyListState = lazyListState, + contentPadding = contentPadding, + showAuthor = showAuthor, + showVersion = showVersion, + showLicenseBadges = showLicenseBadges, + colors = colors, + padding = padding, + itemContentPadding = itemContentPadding, + itemSpacing = itemSpacing, + header = header, + onLibraryClick = onLibraryClick, + licenseDialogBody = { library -> + Text(library.library.licenses.firstOrNull()?.licenseContent ?: "") + } + ) +} + +/** + * Displays all provided libraries in a simple list. + */ +@Composable +fun LibrariesContainer( + librariesBlock: () -> Libs, + modifier: Modifier = Modifier, + lazyListState: LazyListState = rememberLazyListState(), + contentPadding: PaddingValues = PaddingValues(0.dp), + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + itemSpacing: Dp = LibraryDefaults.LibraryItemSpacing, + header: (LazyListScope.() -> Unit)? = null, + onLibraryClick: ((StableLibrary) -> Unit)? = null, +) { + val libs = librariesBlock().stable + + LibrariesContainer( + libs, + modifier, + lazyListState, + contentPadding, + showAuthor, + showVersion, + showLicenseBadges, + colors, + padding, + itemContentPadding, + itemSpacing, + header, + onLibraryClick, + licenseDialogBody = { library -> + Text(library.library.licenses.firstOrNull()?.licenseContent ?: "") + } + ) + +} \ No newline at end of file diff --git a/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/SharedLibraries.kt b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/SharedLibraries.kt new file mode 100644 index 000000000..310ab1077 --- /dev/null +++ b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/SharedLibraries.kt @@ -0,0 +1,442 @@ +package com.mikepenz.aboutlibraries.ui.compose.m3 + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Badge +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.Typography +import androidx.compose.material3.contentColorFor +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.Stable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.aboutlibraries.ui.compose.m3.util.StableLibrary +import com.mikepenz.aboutlibraries.ui.compose.m3.util.StableLibs +import com.mikepenz.aboutlibraries.ui.compose.m3.util.author +import com.mikepenz.aboutlibraries.ui.compose.m3.util.htmlReadyLicenseContent +import com.mikepenz.aboutlibraries.ui.compose.m3.util.stable +import kotlinx.collections.immutable.ImmutableList + + +/** + * Displays all provided libraries in a simple list. + */ +@Composable +fun LibrariesContainer( + libraries: StableLibs?, + modifier: Modifier = Modifier, + lazyListState: LazyListState = rememberLazyListState(), + contentPadding: PaddingValues = PaddingValues(0.dp), + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + itemSpacing: Dp = LibraryDefaults.LibraryItemSpacing, + header: (LazyListScope.() -> Unit)? = null, + onLibraryClick: ((StableLibrary) -> Unit)? = null, + licenseDialogBody: (@Composable (StableLibrary) -> Unit)? = null, + licenseDialogConfirmText: String = "OK", +) { + val uriHandler = LocalUriHandler.current + + val libs = libraries?.libraries ?: emptyList().stable + val openDialog = remember { mutableStateOf(null) } + + Libraries( + libraries = libs, + modifier = modifier, + lazyListState = lazyListState, + contentPadding = contentPadding, + showAuthor = showAuthor, + showVersion = showVersion, + showLicenseBadges = showLicenseBadges, + colors = colors, + padding = padding, + itemContentPadding = itemContentPadding, + itemSpacing = itemSpacing, + header = header, + onLibraryClick = { library -> + val license = library.library.licenses.firstOrNull() + if (onLibraryClick != null) { + onLibraryClick(library) + } else if (!license?.htmlReadyLicenseContent.isNullOrBlank()) { + openDialog.value = library + } else if (!license?.url.isNullOrBlank()) { + license?.url?.also { + try { + uriHandler.openUri(it) + } catch (t: Throwable) { + println("Failed to open url: ${it}") + } + } + } + }, + ) + + val library = openDialog.value + if (library != null && licenseDialogBody != null) { + LicenseDialog(library, colors, licenseDialogConfirmText, body = licenseDialogBody) { + openDialog.value = null + } + } +} + +@OptIn(ExperimentalLayoutApi::class) +@Composable +fun LicenseDialog( + library: StableLibrary, + colors: LibraryColors = LibraryDefaults.libraryColors(), + confirmText: String = "OK", + body: @Composable (StableLibrary) -> Unit, + onDismiss: () -> Unit, +) { + val scrollState = rememberScrollState() + + Dialog( + onDismissRequest = onDismiss, + properties = DialogProperties(), + content = { + Surface( + shape = MaterialTheme.shapes.medium, + color = colors.backgroundColor, + contentColor = colors.contentColor + ) { + Column { + FlowRow( + modifier = Modifier.verticalScroll(scrollState).padding(8.dp).weight(1f) + ) { + body(library) + } + FlowRow( + modifier = Modifier + .align(Alignment.End) + .padding(horizontal = 8.dp, vertical = 2.dp) + ) { + TextButton( + onClick = onDismiss, + colors = ButtonDefaults.textButtonColors( + contentColor = colors.dialogConfirmButtonColor, + ) + ) { + Text(confirmText) + } + } + } + } + }, + ) +} + +/** + * Displays all provided libraries in a simple list. + */ +@Composable +fun Libraries( + libraries: ImmutableList, + modifier: Modifier = Modifier, + lazyListState: LazyListState = rememberLazyListState(), + contentPadding: PaddingValues = PaddingValues(0.dp), + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + itemSpacing: Dp = LibraryDefaults.LibraryItemSpacing, + header: (LazyListScope.() -> Unit)? = null, + onLibraryClick: ((StableLibrary) -> Unit)? = null, +) { + val uriHandler = LocalUriHandler.current + + LazyColumn( + modifier, + verticalArrangement = Arrangement.spacedBy(itemSpacing), + state = lazyListState, + contentPadding = contentPadding + ) { + header?.invoke(this) + libraryItems( + libraries, + showAuthor, + showVersion, + showLicenseBadges, + colors, + padding, + itemContentPadding + ) { library -> + val license = library.library.licenses.firstOrNull() + if (onLibraryClick != null) { + onLibraryClick.invoke(library) + } else if (!license?.url.isNullOrBlank()) { + license?.url?.also { + try { + uriHandler.openUri(it) + } catch (t: Throwable) { + println("Failed to open url: ${it}") + } + } + } + } + } +} + +internal inline fun LazyListScope.libraryItems( + libraries: ImmutableList, + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors, + padding: LibraryPadding, + itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding, + crossinline onLibraryClick: ((StableLibrary) -> Unit), +) { + items(libraries) { library -> + Library( + library, + showAuthor, + showVersion, + showLicenseBadges, + colors, + padding, + itemContentPadding + ) { + onLibraryClick.invoke(library) + } + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +internal fun Library( + library: StableLibrary, + showAuthor: Boolean = true, + showVersion: Boolean = true, + showLicenseBadges: Boolean = true, + colors: LibraryColors = LibraryDefaults.libraryColors(), + padding: LibraryPadding = LibraryDefaults.libraryPadding(), + contentPadding: PaddingValues = LibraryDefaults.ContentPadding, + typography: Typography = MaterialTheme.typography, + onClick: () -> Unit, +) { + Column( + modifier = Modifier + .fillMaxWidth() + .background(colors.backgroundColor) + .clickable { onClick.invoke() } + .padding(contentPadding) + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = library.library.name, + modifier = Modifier + .padding(padding.namePadding) + .weight(1f), + style = typography.titleLarge, + color = colors.contentColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + val version = library.library.artifactVersion + if (version != null && showVersion) { + Text( + version, + modifier = Modifier.padding(padding.versionPadding), + style = typography.bodyMedium, + color = colors.contentColor, + textAlign = TextAlign.Center + ) + } + } + val author = library.library.author + if (showAuthor && author.isNotBlank()) { + Text( + text = author, + style = typography.bodyMedium, + color = colors.contentColor + ) + } + if (showLicenseBadges && library.library.licenses.isNotEmpty()) { + Row { + library.library.licenses.forEach { + Badge( + modifier = Modifier.padding(padding.badgePadding), + contentColor = colors.badgeContentColor, + containerColor = colors.badgeBackgroundColor + ) { + Text( + modifier = Modifier.padding(padding.badgeContentPadding), + text = it.name + ) + } + } + } + } + } +} + + +/** + * Contains the default values used by [Library] + */ +object LibraryDefaults { + private val LibraryItemPadding = 16.dp + private val LibraryNamePaddingTop = 4.dp + private val LibraryVersionPaddingStart = 8.dp + private val LibraryBadgePaddingTop = 8.dp + private val LibraryBadgePaddingEnd = 4.dp + internal val LibraryItemSpacing = 0.dp + + /** + * The default content padding used by [Library] + */ + val ContentPadding = PaddingValues(LibraryItemPadding) + + /** + * Creates a [LibraryColors] that represents the default colors used in + * a [Library]. + * + * @param backgroundColor the background color of this [Library] + * @param contentColor the content color of this [Library] + * @param badgeBackgroundColor the badge background color of this [Library] + * @param badgeContentColor the badge content color of this [Library] + * @param dialogConfirmButtonColor the dialog's confirm button color of this [Library] + */ + @Composable + fun libraryColors( + backgroundColor: Color = MaterialTheme.colorScheme.background, + contentColor: Color = contentColorFor(backgroundColor), + badgeBackgroundColor: Color = MaterialTheme.colorScheme.primary, + badgeContentColor: Color = contentColorFor(badgeBackgroundColor), + dialogConfirmButtonColor: Color = MaterialTheme.colorScheme.primary, + ): LibraryColors = DefaultLibraryColors( + backgroundColor = backgroundColor, + contentColor = contentColor, + badgeBackgroundColor = badgeBackgroundColor, + badgeContentColor = badgeContentColor, + dialogConfirmButtonColor = dialogConfirmButtonColor, + ) + + /** + * Creates a [LibraryPadding] that represents the default paddings used in a [Library] + * + * @param namePadding the padding around the name shown as part of a [Library] + * @param versionPadding the padding around the version shown as part of a [Library] + * @param badgePadding the padding around a badge element shown as part of a [Library] + * @param badgeContentPadding the padding around the content of a badge element shown as part of a [Library] + */ + @Composable + fun libraryPadding( + namePadding: PaddingValues = PaddingValues(top = LibraryNamePaddingTop), + versionPadding: PaddingValues = PaddingValues(start = LibraryVersionPaddingStart), + badgePadding: PaddingValues = PaddingValues( + top = LibraryBadgePaddingTop, + end = LibraryBadgePaddingEnd + ), + badgeContentPadding: PaddingValues = PaddingValues(0.dp), + ): LibraryPadding = DefaultLibraryPadding( + namePadding = namePadding, + versionPadding = versionPadding, + badgePadding = badgePadding, + badgeContentPadding = badgeContentPadding, + ) +} + +/** + * Represents the background and content colors used in a library. + */ +@Stable +interface LibraryColors { + /** Represents the background color for this library item. */ + val backgroundColor: Color + + /** Represents the content color for this library item. */ + val contentColor: Color + + /** Represents the badge background color for this library item. */ + val badgeBackgroundColor: Color + + /** Represents the badge content color for this library item. */ + val badgeContentColor: Color + + /** Represents the text color of the dialog's confirm button */ + val dialogConfirmButtonColor: Color +} + +/** + * Default [LibraryColors]. + */ +@Immutable +private class DefaultLibraryColors( + override val backgroundColor: Color, + override val contentColor: Color, + override val badgeBackgroundColor: Color, + override val badgeContentColor: Color, + override val dialogConfirmButtonColor: Color, +) : LibraryColors + + +/** + * Represents the padding values used in a library. + */ +@Stable +interface LibraryPadding { + /** Represents the padding around the name shown as part of a [Library] */ + val namePadding: PaddingValues + + /** Represents the padding around the version shown as part of a [Library] */ + val versionPadding: PaddingValues + + /** Represents the padding around a badge element shown as part of a [Library] */ + val badgePadding: PaddingValues + + /** Represents the padding around the content of a badge element shown as part of a [Library] */ + val badgeContentPadding: PaddingValues +} + +/** + * Default [LibraryPadding]. + */ +@Immutable +private class DefaultLibraryPadding( + override val namePadding: PaddingValues, + override val versionPadding: PaddingValues, + override val badgePadding: PaddingValues, + override val badgeContentPadding: PaddingValues, +) : LibraryPadding diff --git a/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/util/Extensions.kt b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/util/Extensions.kt new file mode 100644 index 000000000..cdf03d708 --- /dev/null +++ b/aboutlibraries-compose-m3/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/m3/util/Extensions.kt @@ -0,0 +1,45 @@ +package com.mikepenz.aboutlibraries.ui.compose.m3.util + +import androidx.compose.runtime.Immutable +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.aboutlibraries.entity.License +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.ImmutableSet +import kotlinx.collections.immutable.toImmutableList +import kotlinx.collections.immutable.toImmutableSet +import kotlin.jvm.JvmInline + +@JvmInline +@Immutable +value class StableLibrary(val library: Library) + +val Library.stable get() = StableLibrary(this) + +val List.stable get() = map { it.stable }.toImmutableList() + +@JvmInline +@Immutable +value class StableLicense(val license: License) + +val License.stable get() = StableLicense(this) + +val Set.stable get() = map { it.stable }.toImmutableSet() + +@Immutable +class StableLibs( + val libraries: ImmutableList, + val licenses: ImmutableSet, +) + +val Libs.stable get() = StableLibs(this.libraries.stable, this.licenses.stable) + +val Library.author: String + get() = developers.takeIf { it.isNotEmpty() }?.map { it.name }?.joinToString(", ") + ?: organization?.name ?: "" + +val License.htmlReadyLicenseContent: String? + get() = licenseContent?.replace("\n", "
") + +val License.strippedLicenseContent: String? + get() = licenseContent?.replace("
", "\n")?.replace("
", "\n") diff --git a/app-desktop/build.gradle.kts b/app-desktop/build.gradle.kts index f2bfd5604..4f89ff10c 100644 --- a/app-desktop/build.gradle.kts +++ b/app-desktop/build.gradle.kts @@ -16,8 +16,10 @@ dependencies { implementation(compose.desktop.currentOs) implementation(compose.foundation) implementation(compose.material) + implementation(compose.material3) implementation(project(":aboutlibraries-core")) - implementation(project(":aboutlibraries-compose")) + implementation(project(":aboutlibraries-compose-m2")) + implementation(project(":aboutlibraries-compose-m3")) // Coroutines implementation(libs.kotlin.coroutines.core) diff --git a/app-desktop/src/main/kotlin/Color.kt b/app-desktop/src/main/kotlin/Color.kt deleted file mode 100644 index 13a91b883..000000000 --- a/app-desktop/src/main/kotlin/Color.kt +++ /dev/null @@ -1,8 +0,0 @@ -import androidx.compose.ui.graphics.Color - -val StoryblokGreen = Color(0xff09B3AF) -val StoryblokGreenDark = Color(0xff008380) -val StoryblokGreenLight = Color(0x5de6e1) - -val Red200 = Color(0xfff297a2) -val Red800 = Color(0xffd00036) \ No newline at end of file diff --git a/app-desktop/src/main/kotlin/m2/Color.kt b/app-desktop/src/main/kotlin/m2/Color.kt new file mode 100644 index 000000000..9ff81edf7 --- /dev/null +++ b/app-desktop/src/main/kotlin/m2/Color.kt @@ -0,0 +1,10 @@ +package m2 + +import androidx.compose.ui.graphics.Color + +val Green = Color(0xff09B3AF) +val GreenDark = Color(0xff008380) +val GreenLight = Color(0x5de6e1) + +val Red200 = Color(0xfff297a2) +val Red800 = Color(0xffd00036) \ No newline at end of file diff --git a/app-desktop/src/main/kotlin/Theme.kt b/app-desktop/src/main/kotlin/m2/Theme.kt similarity index 73% rename from app-desktop/src/main/kotlin/Theme.kt rename to app-desktop/src/main/kotlin/m2/Theme.kt index 1c4e7d3ad..1a6a0c401 100644 --- a/app-desktop/src/main/kotlin/Theme.kt +++ b/app-desktop/src/main/kotlin/m2/Theme.kt @@ -1,3 +1,5 @@ +package m2 + import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material.MaterialTheme import androidx.compose.material.darkColors @@ -6,20 +8,20 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color private val DarkColorPalette = darkColors( - primary = StoryblokGreen, - primaryVariant = StoryblokGreenDark, + primary = Green, + primaryVariant = GreenDark, onPrimary = Color.White, - secondary = StoryblokGreen, + secondary = Green, onSecondary = Color.White, error = Red200 ) private val LightColorPalette = lightColors( - primary = StoryblokGreen, - primaryVariant = StoryblokGreenDark, + primary = Green, + primaryVariant = GreenDark, onPrimary = Color.White, - secondary = StoryblokGreen, - secondaryVariant = StoryblokGreenDark, + secondary = Green, + secondaryVariant = GreenDark, onSecondary = Color.White, error = Red800 ) @@ -27,7 +29,7 @@ private val LightColorPalette = lightColors( @Composable fun SampleTheme( darkTheme: Boolean = isSystemInDarkTheme(), - content: @Composable() () -> Unit + content: @Composable() () -> Unit, ) { val colors = if (darkTheme) { DarkColorPalette diff --git a/app-desktop/src/main/kotlin/m3/Color.kt b/app-desktop/src/main/kotlin/m3/Color.kt new file mode 100644 index 000000000..809c830ba --- /dev/null +++ b/app-desktop/src/main/kotlin/m3/Color.kt @@ -0,0 +1,68 @@ +package m3 + +import androidx.compose.ui.graphics.Color + +val md_theme_light_primary = Color(0xFFB90063) +val md_theme_light_onPrimary = Color(0xFFFFFFFF) +val md_theme_light_primaryContainer = Color(0xFFFFD9E2) +val md_theme_light_onPrimaryContainer = Color(0xFF3E001D) +val md_theme_light_secondary = Color(0xFF74565F) +val md_theme_light_onSecondary = Color(0xFFFFFFFF) +val md_theme_light_secondaryContainer = Color(0xFFFFD9E2) +val md_theme_light_onSecondaryContainer = Color(0xFF2B151C) +val md_theme_light_tertiary = Color(0xFFB91445) +val md_theme_light_onTertiary = Color(0xFFFFFFFF) +val md_theme_light_tertiaryContainer = Color(0xFFFFD9DC) +val md_theme_light_onTertiaryContainer = Color(0xFF400011) +val md_theme_light_error = Color(0xFFBA1A1A) +val md_theme_light_errorContainer = Color(0xFFFFDAD6) +val md_theme_light_onError = Color(0xFFFFFFFF) +val md_theme_light_onErrorContainer = Color(0xFF410002) +val md_theme_light_background = Color(0xFFFFFBFF) +val md_theme_light_onBackground = Color(0xFF201A1B) +val md_theme_light_surface = Color(0xFFFFFBFF) +val md_theme_light_onSurface = Color(0xFF201A1B) +val md_theme_light_surfaceVariant = Color(0xFFF2DDE1) +val md_theme_light_onSurfaceVariant = Color(0xFF514347) +val md_theme_light_outline = Color(0xFF837377) +val md_theme_light_inverseOnSurface = Color(0xFFFAEEEF) +val md_theme_light_inverseSurface = Color(0xFF352F30) +val md_theme_light_inversePrimary = Color(0xFFFFB1C8) +val md_theme_light_shadow = Color(0xFF000000) +val md_theme_light_surfaceTint = Color(0xFFB90063) +val md_theme_light_outlineVariant = Color(0xFFD5C2C6) +val md_theme_light_scrim = Color(0xFF000000) + +val md_theme_dark_primary = Color(0xFFFFB1C8) +val md_theme_dark_onPrimary = Color(0xFF650033) +val md_theme_dark_primaryContainer = Color(0xFF8E004A) +val md_theme_dark_onPrimaryContainer = Color(0xFFFFD9E2) +val md_theme_dark_secondary = Color(0xFFE3BDC6) +val md_theme_dark_onSecondary = Color(0xFF422931) +val md_theme_dark_secondaryContainer = Color(0xFF5B3F47) +val md_theme_dark_onSecondaryContainer = Color(0xFFFFD9E2) +val md_theme_dark_tertiary = Color(0xFFFFB2BA) +val md_theme_dark_onTertiary = Color(0xFF670021) +val md_theme_dark_tertiaryContainer = Color(0xFF910031) +val md_theme_dark_onTertiaryContainer = Color(0xFFFFD9DC) +val md_theme_dark_error = Color(0xFFFFB4AB) +val md_theme_dark_errorContainer = Color(0xFF93000A) +val md_theme_dark_onError = Color(0xFF690005) +val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6) +val md_theme_dark_background = Color(0xFF201A1B) +val md_theme_dark_onBackground = Color(0xFFEBE0E1) +val md_theme_dark_surface = Color(0xFF201A1B) +val md_theme_dark_onSurface = Color(0xFFEBE0E1) +val md_theme_dark_surfaceVariant = Color(0xFF514347) +val md_theme_dark_onSurfaceVariant = Color(0xFFD5C2C6) +val md_theme_dark_outline = Color(0xFF9E8C90) +val md_theme_dark_inverseOnSurface = Color(0xFF201A1B) +val md_theme_dark_inverseSurface = Color(0xFFEBE0E1) +val md_theme_dark_inversePrimary = Color(0xFFB90063) +val md_theme_dark_shadow = Color(0xFF000000) +val md_theme_dark_surfaceTint = Color(0xFFFFB1C8) +val md_theme_dark_outlineVariant = Color(0xFF514347) +val md_theme_dark_scrim = Color(0xFF000000) + + +val seed = Color(0xFFBA0063) diff --git a/app-desktop/src/main/kotlin/m3/Theme.kt b/app-desktop/src/main/kotlin/m3/Theme.kt new file mode 100644 index 000000000..baa0f0188 --- /dev/null +++ b/app-desktop/src/main/kotlin/m3/Theme.kt @@ -0,0 +1,90 @@ +package m3 + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable + + +private val LightColors = lightColorScheme( + primary = md_theme_light_primary, + onPrimary = md_theme_light_onPrimary, + primaryContainer = md_theme_light_primaryContainer, + onPrimaryContainer = md_theme_light_onPrimaryContainer, + secondary = md_theme_light_secondary, + onSecondary = md_theme_light_onSecondary, + secondaryContainer = md_theme_light_secondaryContainer, + onSecondaryContainer = md_theme_light_onSecondaryContainer, + tertiary = md_theme_light_tertiary, + onTertiary = md_theme_light_onTertiary, + tertiaryContainer = md_theme_light_tertiaryContainer, + onTertiaryContainer = md_theme_light_onTertiaryContainer, + error = md_theme_light_error, + errorContainer = md_theme_light_errorContainer, + onError = md_theme_light_onError, + onErrorContainer = md_theme_light_onErrorContainer, + background = md_theme_light_background, + onBackground = md_theme_light_onBackground, + surface = md_theme_light_surface, + onSurface = md_theme_light_onSurface, + surfaceVariant = md_theme_light_surfaceVariant, + onSurfaceVariant = md_theme_light_onSurfaceVariant, + outline = md_theme_light_outline, + inverseOnSurface = md_theme_light_inverseOnSurface, + inverseSurface = md_theme_light_inverseSurface, + inversePrimary = md_theme_light_inversePrimary, + surfaceTint = md_theme_light_surfaceTint, + outlineVariant = md_theme_light_outlineVariant, + scrim = md_theme_light_scrim, +) + + +private val DarkColors = darkColorScheme( + primary = md_theme_dark_primary, + onPrimary = md_theme_dark_onPrimary, + primaryContainer = md_theme_dark_primaryContainer, + onPrimaryContainer = md_theme_dark_onPrimaryContainer, + secondary = md_theme_dark_secondary, + onSecondary = md_theme_dark_onSecondary, + secondaryContainer = md_theme_dark_secondaryContainer, + onSecondaryContainer = md_theme_dark_onSecondaryContainer, + tertiary = md_theme_dark_tertiary, + onTertiary = md_theme_dark_onTertiary, + tertiaryContainer = md_theme_dark_tertiaryContainer, + onTertiaryContainer = md_theme_dark_onTertiaryContainer, + error = md_theme_dark_error, + errorContainer = md_theme_dark_errorContainer, + onError = md_theme_dark_onError, + onErrorContainer = md_theme_dark_onErrorContainer, + background = md_theme_dark_background, + onBackground = md_theme_dark_onBackground, + surface = md_theme_dark_surface, + onSurface = md_theme_dark_onSurface, + surfaceVariant = md_theme_dark_surfaceVariant, + onSurfaceVariant = md_theme_dark_onSurfaceVariant, + outline = md_theme_dark_outline, + inverseOnSurface = md_theme_dark_inverseOnSurface, + inverseSurface = md_theme_dark_inverseSurface, + inversePrimary = md_theme_dark_inversePrimary, + surfaceTint = md_theme_dark_surfaceTint, + outlineVariant = md_theme_dark_outlineVariant, + scrim = md_theme_dark_scrim, +) + +@Composable +fun AppTheme( + useDarkTheme: Boolean = isSystemInDarkTheme(), + content: @Composable() () -> Unit, +) { + val colors = if (!useDarkTheme) { + LightColors + } else { + DarkColors + } + + MaterialTheme( + colorScheme = colors, + content = content + ) +} \ No newline at end of file diff --git a/app-desktop/src/main/kotlin/m3/main.kt b/app-desktop/src/main/kotlin/m3/main.kt new file mode 100644 index 000000000..44f69271a --- /dev/null +++ b/app-desktop/src/main/kotlin/m3/main.kt @@ -0,0 +1,28 @@ +package m3 + +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.useResource +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application +import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer + +@OptIn(ExperimentalMaterial3Api::class) +fun main() = application { + Window(title = "AboutLibraries M3 Sample", onCloseRequest = ::exitApplication) { + AppTheme { + Scaffold( + topBar = { TopAppBar(title = { Text("AboutLibraries Compose M3 Desktop Sample") }) } + ) { + LibrariesContainer(useResource("aboutlibraries.json") { + it.bufferedReader().readText() + }, Modifier.fillMaxSize().padding(it)) + } + } + } +} diff --git a/app-desktop/src/main/kotlin/main.kt b/app-desktop/src/main/kotlin/main.kt index a520b5b4f..bd75e8109 100644 --- a/app-desktop/src/main/kotlin/main.kt +++ b/app-desktop/src/main/kotlin/main.kt @@ -7,6 +7,7 @@ import androidx.compose.ui.res.useResource import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer +import m2.SampleTheme fun main() = application { Window(title = "AboutLibraries Sample", onCloseRequest = ::exitApplication) { diff --git a/app-wasm/build.gradle.kts b/app-wasm/build.gradle.kts index defa9bbc6..4fadafa8f 100644 --- a/app-wasm/build.gradle.kts +++ b/app-wasm/build.gradle.kts @@ -50,7 +50,8 @@ kotlin { implementation(compose.components.resources) implementation(project(":aboutlibraries-core")) - implementation(project(":aboutlibraries-compose")) + implementation(project(":aboutlibraries-compose-m2")) + implementation(project(":aboutlibraries-compose-m3")) } } } diff --git a/app/build.gradle b/app/build.gradle index aa3ecd25d..2d2fbbc14 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -123,7 +123,8 @@ aboutLibraries { dependencies { implementation project(':aboutlibraries-core') implementation project(':aboutlibraries') - implementation project(':aboutlibraries-compose') + implementation project(':aboutlibraries-compose-m2') + implementation project(':aboutlibraries-compose-m3') implementation(libs.androidx.activity.compose) implementation(libs.androidx.cardView) diff --git a/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt b/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt index 63e589200..1c9d820f6 100644 --- a/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt +++ b/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt @@ -6,14 +6,33 @@ import androidx.activity.compose.setContent import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.asPaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBars +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBars +import androidx.compose.material.Icon +import androidx.compose.material.IconButton +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Scaffold +import androidx.compose.material.Text +import androidx.compose.material.TopAppBar +import androidx.compose.material.darkColors import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Build import androidx.compose.material.icons.filled.Info import androidx.compose.material.icons.filled.List import androidx.compose.material.icons.filled.Person -import androidx.compose.runtime.* +import androidx.compose.material.lightColors +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color diff --git a/gradle.properties b/gradle.properties index 261ca13b6..addfcb55a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ GROUP=com.mikepenz -VERSION_NAME=10.10.0-rc02 +VERSION_NAME=10.10.0 VERSION_CODE=101000 POM_URL=https://github.com/mikepenz/AboutLibraries POM_SCM_URL=https://github.com/mikepenz/AboutLibraries diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3d90f5311..35b0d72fd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,12 +11,12 @@ buildTools = "34.0.0" dokka = "1.9.10" kotlinCore = { require = "1.9.21" } kotlinCoroutines = { require = "1.7.3" } -kotlinxSerialization = "1.6.0" +kotlinxSerialization = "1.6.2" kotlinxCollections = "0.3.7" # compose compose = "1.5.4" composeUi = "1.5.4" # foundation / material -composeCompiler = "1.5.6" +composeCompiler = "1.5.7" composejb = "1.6.0-alpha01" # "1.4.0-dev-wasm09" composeCompilerJb = "1.5.4" # androidx diff --git a/multiplatform-demo/build.gradle.kts b/multiplatform-demo/build.gradle.kts index 9187433e4..ec7764f2c 100644 --- a/multiplatform-demo/build.gradle.kts +++ b/multiplatform-demo/build.gradle.kts @@ -39,7 +39,7 @@ kotlin { implementation(compose.desktop.currentOs) implementation("com.mikepenz:aboutlibraries-core:${extra["aboutlibraries.version"] as String}") - implementation("com.mikepenz:aboutlibraries-compose:${extra["aboutlibraries.version"] as String}") + implementation("com.mikepenz:aboutlibraries-compose-m2:${extra["aboutlibraries.version"] as String}") } } val jvmTest by getting diff --git a/settings.gradle b/settings.gradle index f1e9c421e..cb569a1d1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,8 @@ rootProject.name = "AboutLibraries" include ':aboutlibraries-core' include ':aboutlibraries' -include ':aboutlibraries-compose' +include ':aboutlibraries-compose-m2' +include ':aboutlibraries-compose-m3' include ':app' include ':app-desktop'