Skip to content

SimpleLibsPreference

Marc Auberer edited this page Jan 17, 2021 · 6 revisions

Integration of Mike Penz`s AboutLibraries lib.

Requirements

If you want to use the SimpleLibsPreference or LibsClickListener you have to meet a few more requirements, which are needed to parse the dependencies, you used within your project.

Please edit the build.gradle file at project level:

buildscript {
   ...
   ext.aboutLibsVersion = '<latest-version>'
   ...
}
repositories {...}
dependencies {
   ...
   classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:$aboutLibsVersion"
   ...
}
...

And the build.gradle file at module level:

...
apply plugin: 'com.mikepenz.aboutlibraries.plugin'

android {...}

dependencies {
   ...
   implementation 'com.chillibits:simplesettings:<latest-version>'
   implementation 'com.google.android.material:material:<latest-version>'
   implementation 'androidx.preference:preference:<latest-version>'
   implementation "com.mikepenz:aboutlibraries-core:$aboutLibsVersion"
   implementation "com.mikepenz:aboutlibraries:$aboutLibsVersion@aar"
   ...
}

Usage in Kotlin

SimpleSettings(this).show {
	Section {
		LibsPref {
            activityTitle = "LibsPreference"
            edgeToEdge = true
			...
        }
	}
}

Usage in XML

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
	xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">

	<com.chillibits.simplesettings.preference.LibsPreference
        app:key="libs_preference"
        app:title="@string/libsPreferenceTitle"
        app:summary="@string/libsPreferenceSummary"
        app:sort="true"
        app:activity_title="@string/app_name"/>
</PreferenceScreen>

Customization options

The LibsActivity can be styled by passing the customization parameters to the SimpleLibsPreference object. It then forwards the customization to the LibsActivity.