GithubHelp home page GithubHelp logo

lerist / licenseadapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yshrsmz/licenseadapter

0.0 3.0 0.0 266 KB

adapter for RecyclerView to display app's oss dependencies' license

License: Apache License 2.0

Java 100.00%

licenseadapter's Introduction

LicenseAdapter

Android Arsenal

Adapter library for RecyclerView to display your app's OSS dependencies.

This library fetch license text from GitHub(and your custom location), so technically this library is capable of displaying any license.

screenshot_1 screenshot_2

Installation

LicenseAdapter is distributed via jCenter.

dependencies {
  compile 'net.yslibrary.licenseadapter:licenseadapter:1.2.1'
}

Usage

Don't forget to add android.permission.INTERNET permission to your AndroidManifest.

// create list of licenses
List<LicenseEntry> dataset = new ArrayList<>();

// library that is not hosted on GitHub
licenses.add(Licenses.noContent("Android SDK", "Google Inc.", "https://developer.android.com/sdk/terms.html"));
// library that is hosted on GitHub, but does not provide license text
licenses.add(Licenses.fromGitHub("gabrielemariotti/changeloglib", Licenses.LICENSE_APACHE_V2));
// library that is hosted on GitHub, and "LICENSE.txt" is provided
dataset.add(Licenses.fromGitHub("google/dagger"));
// library that is hosted on GitHub, and license file is provided as "LICENSE"
dataset.add(Licenses.fromGitHub("reactivex/rxjava", Licenses.FILE_NO_EXTENSION));
dataset.add(Licenses.fromGitHub("reactivex/rxandroid", Licenses.FILE_NO_EXTENSION));
dataset.add(Licenses.fromGitHub("realm/realm-java", Licenses.FILE_NO_EXTENSION));
dataset.add(Licenses.fromGitHub("square/retrofit"));

// create adapter
LicenseAdapter adapter = new LicenseAdapter(dataset);
RecyclerView list = (RecyclerView) findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
list.setAdapter(adapter);

// finally load license text from Web
Licenses.load(dataset);

Predefined License name strings

License name Actual variable
Apache License V2.0 Licenses#NAME_APACHE_V2
MIT LICENSE Licenses#NAME_MIT
BSD LICENSE Licenses#NAME_BSD

Predefined License file name

License file name Actual variable
LICENSE Licenses#FILE_NO_EXTENSION
LICENSE.txt Licenses#FILE_TXT
LICENSE.md Licenses#FILE_MD

License

Copyright 2016 Shimizu Yasuhiro (yshrsmz)

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.

licenseadapter's People

Contributors

yshrsmz avatar

Watchers

James Cloos avatar Lerist avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.