A simple library to show the list of licenses your app uses
repositories {
jcenter()
}
...
dependencies {
compile 'com.vbg:licenses-library:1.0.2'
}
- Extend your licenses activity with
LicensesActivity
:
public class InfoLicensesActivity extends LicensesActivity
- Implement methods of
LicensesActivity
:
@Override
public int getActivityStyle() {
return DARK;
}
With getActivityStyle
you set the style of the licenses activity. The return must be DARK
or LIGHT
- Add the libraries. You can add the libraries with 2 forms:
- Calling the method
setLicenses(LicensesLibrary.Builder licenses)
- Or overriding the method
setupLicenses()
like this:
- Calling the method
@Override
public LicensesLibrary.Builder setupLicenses() {
return new LicensesLibrary.Builder(this)
.addLicense(new License("Android Open Source Project", "The Android Open Source Project", "2017", LicensesType.APACHE20));
}
Licenses can be set manually (adding the entire license into strings and then creating a License object with only the name and the license string) or letting the library build the license for you, you only have to provide the name, the author, the year and the type of the license.
new License("ObservableScrollView", "Soichiro Kashima", "2014", LicensesType.APACHE20)
new License(name, author, year, license type)
new License("Custom license", R.string.example_license)
License name | LicenseType in the library |
---|---|
MIT | LicenseType.MIT |
Apache 2.0 | LicenseType.APACHE20 |
Creative Commons 3.0 | LicenseType.CC30 |
BSD 2.0 | LicenseType.BSD2 |
BSD 3.0 | LicenseType.BSD3 |
Copyright 2017 Victor Blanco
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.