LeOS-Ice-browser/android-components/components/support/license
harvey186 7a6de5f3e6 v131 2024-10-12 11:57:06 +02:00
..
src v131 2024-10-12 11:57:06 +02:00
README.md v131 2024-10-12 11:57:06 +02:00
build.gradle v131 2024-10-12 11:57:06 +02:00
proguard-rules.pro v131 2024-10-12 11:57:06 +02:00

README.md

Android Components > Support > License

A component to help generate and display licensing agreements.

Setting up the dependency

Use Gradle to download the library from maven.mozilla.org (Setup repository):

implementation "org.mozilla.components:support-license:{latest-version}"

Usage

License Plugin

Add the license plugin directly to your project's build.gradle classpath:

// root build.gradle
buildscript {
    dependencies {
        classpath "com.google.android.gms:oss-licenses-plugin:0.10.4"
    }
}

Apply the plugin to the top of your application's build.gradle:

apply plugin: 'com.google.android.gms.oss-licenses-plugin'

Display licenses

Extend the abstract LibrariesListFragment and provide the resource location to the licenses and the metadata:

class MyLicense : LibrariesListFragment() {
    override val resources = LicenseResources(
        licenses = R.raw.third_party_licenses,
        licenseMetadata = R.raw.third_party_license_metadata,
    )
}

Optionally, add more fragment decorations as desired. For example:

class MyLicense : LibrariesListFragment() {
    override fun onResume() {
        super.onResume()

        showToolbar("Licenses we use")
    }
}

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/