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

More API changes #93

Merged
merged 5 commits into from
Sep 22, 2020
Merged

More API changes #93

merged 5 commits into from
Sep 22, 2020

Conversation

chrisbanes
Copy link
Contributor

@chrisbanes chrisbanes commented Sep 22, 2020

As we're on a roll of API changes, here's one final change:

  • SuccessResult and ErrorResult have now been expanded in the sealed CoilImageState, which now contains: Success, Error, Loading & Empty
  • The recent CoilImage with the image composable has been expanded and made more flexible:
CoilImage(
  data = "https://www.image.url",
) { state ->
  when (state) {
    is CoilImageState.Success -> // TODO
    is CoilImageState.Error -> // TODO
    CoilImageState.Loading -> // TODO
    CoilImageState.Empty -> // TODO
  }
}

The more opinionated (and easier to use) version which hosts content slots still exists, allowing:

CoilImage(
  data = "https://www.image.url",
  fadeIn = true,
  loading = { /* content to show while loading */ },
  error = { /* content to show when an error has occurred */ }
)
  • The tests have been revamped, using MockWebServer to serve the images in a more realistic way.

Closes #92

* This version of the function allows complete control over how the loaded image is displayed,
* by being able to provide custom layout:
* Creates a composable that will attempt to load the given [data] using [Coil], and provides
* complete content of how the current state is displayed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/content/control?

Copy link
Collaborator

@nickbutcher nickbutcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small doc suggestions but changes LG. I like the easy default but ability to customize everything if you want.

- New tests for content composable
- We now use MockWebServer to fetch images over
  the 'network'.
@chrisbanes chrisbanes merged commit 78634e8 into main Sep 22, 2020
@chrisbanes chrisbanes deleted the cb/more-api-changes branch September 22, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API update proposal
3 participants