Custom components used across my Android projects
Add jitpack repository in project build.gradle
at the end of list of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to module build.gradle
dependencies {
implementation 'io.github.adityabhaskar:CustomComponents:<version>'
}
See badge above for current version
number.
If using custom preferences, ideally extend settings fragment from CustomSettingsFragment
. The custom fragment handles onDisplayPreferenceDialog
to show the custom preference dialogs.
Otherwise, use CustomPreferenceUtils.displayPreferenceDialog
method to let the library handle displaying dialogs. Sample usage:
override fun onDisplayPreferenceDialog(preference: Preference?) {
val fm = parentFragment?.childFragmentManager
if(CustomPreferenceUtils.displayPreferenceDialog(preference, fm, this))
return
// Do any other preference dialog handling here, if needed.
super.onDisplayPreferenceDialog(preference)
}
Customisable resource values and attributes
Details on how to use are here.
Details on how to use are here.