Skip to content
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

Merged
merged 1 commit into from Apr 20, 2021
Merged

Conversation

helios175
Copy link
Collaborator

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.

Copy link
Collaborator

@zach-klippenstein zach-klippenstein left a 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?
Copy link
Collaborator

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.
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.
@helios175 helios175 merged commit 6731722 into main Apr 20, 2021
@helios175 helios175 deleted the helios175/accessextensions branch April 20, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants