New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Config.extension(block) #45
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, once the documentation comment is addressed.
*/ | ||
inline fun <reified E : ExtensionSpec<I>> extension(block: () -> E): E { | ||
return extensionSpecs | ||
.firstOrNull { it is E } as E? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: .filterInstance<E>().firstOrNull()
* @hide | ||
*/ | ||
fun extension(spec: ExtensionSpec<I>) { | ||
extensionSpecs.add(spec) | ||
} | ||
|
||
/** | ||
* General method which is called from Extension code. DON'T USE DIRECTLY. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who is the "DON'T USE DIRECTLY" speaking to? Who shouldn't use it, and who should? Somebody must be intended to use it, or it wouldn't need to exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. It's for extensions code (edges, sticky headers). Not for using directly from UI code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the comment! LG now
Allows for extension code to optionally add an extension if not present. This might be needed in some cases where a feature (like a DSL that help define row types) need to access a common-shared object associated to the recycler.
038016a
to
5886c3d
Compare
Allows for extension code to optionally add an extension
if not present. This might be needed in some cases
where a feature (like a DSL that help define row types)
need to access a common-shared object associated to the
recycler.