||4 months ago|
|app||4 months ago|
|demo||4 months ago|
|gradle/wrapper||4 months ago|
|.gitignore||2 years ago|
|LICENSE||2 years ago|
|README.md||4 months ago|
|build.gradle||4 months ago|
|gradle.properties||2 years ago|
|gradlew||2 years ago|
|screenshot.png||2 years ago|
|settings.gradle||2 years ago|
A library to display an about screen in an Android app. It was created for use with other Direct projects but may be used independently as well.
minSdkVersion 14 targetSdkVersion 28
Including in your project
Please use Jitpack to download compiled AAR packages. See how here.
AboutDirectActivity, you have to use the builder class
AboutDirectActivity.IntentBuilder like seen here:
new AboutDirectActivity.IntentBuilder(context, R.string.app_name, BuildConfig.VERSION_NAME) .setContent(…) .build();
Since version 3.1, the about screen is also available as a Fragment. Simply call
buildFragment() at the end instead.
These are the calls that you can use to configure the builder class:
Pass an array of
Object will be displayed by the About screen. All of them have similar constructors and look slightly different
to each other when viewed.
For example, here's how a library is constructed:
new Library(String name, License license, @Nullable String foreword, String author, String url)
name: Name of the library
license: A license object. The
Licenseclass has a small selection of licenses already hardcoded for you, including MIT and Apache 2.0, but you can construct your own license using
new License(String name, String licenseText)as well.
foreword: Some people put one line or two of copyright statement above their paste of e.g. the MIT license. Use the foreword string in that case, or pass null.
author: Should fit into this sentence: "
authoris distributing this library."
plural(optional): Whether author is a word that needs to be referred to in plural
url: The website that the library can be found at. May be null, in that case the "open externally" button will be hidden.
For example, if you wanted to credit aboutDirect, add this line to your
new Library("aboutDirect", License.CC0_LICENSE, null, "Fynn Godau", "https://codeberg.org/fynngodau/librariesDirect"),
For the other classes, JavaDoc explains how to use them.
Pass an icon resource to display it at the top to the left of the app's name.
Pass the app developer's name to display it at the top below you app's name.
Pass a URL to display a Mastodon icon to the right of the developer's name that links to that URL.
Pass an implementation of the
ContextConsumer interface in case there is something you need to do after the activity
has launched, like setting style dynamically.
When used with
buildFragment(), the consumer is executed by the fragment on creation, but before the layout is created.
Therefore, the activities
Context is provided to you in the interface's
accept(Context) method immediately before
the layout is inflated.
Note that the
ContextConsumer interface extends the
Serializable interface. As such, all fields that your
implementation has must also be
Serializable. If you create a
ContextConsumer implementation as a non-static inner
class of an
Activity (possibly by creating an anonymous class), the app will crash.
Once you are done, call
build() on the builder class to receive an
Intent which you can start using
Version 3 migration
- The namespace of some classes changed. You need to fix your imports.
- Consider switching to
AboutLibrariesActivityhas been deprecated and may be removed in a future release.
Because I think it would have been annoying to have to credit a library that is used to credit libraries, this library is licensed under CC0; no credits are required, even though they are welcome.