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

Issue/glide fallback placeholder #7976

Merged
merged 5 commits into from
Jul 3, 2018

Conversation

malinajirka
Copy link
Contributor

@malinajirka malinajirka commented Jul 2, 2018

#7975

Fixes missing placeholder and error images in the Reader. Behavior is basically copied from WPNetworkImageView.showDefaultImage() and WPNetworkImageView.showErrorImage().

To test:
Placeholder

  1. Open Reader
  2. Scroll down and observe grey rectangle is displayed when an image is being loaded (you might need to adjust network connection quality in the emulator)

Error

  1. Turn on air plane mode
  2. Open Reader - make sure images are not cached
  3. Notice grey rectangle is displayed instead of an empty ImageView.

@malinajirka malinajirka added this to the 10.4 milestone Jul 2, 2018
@malinajirka malinajirka requested a review from planarvoid July 2, 2018 11:23
@malinajirka malinajirka modified the milestones: 10.4, 10.5 Jul 2, 2018
@@ -79,55 +78,63 @@ class ImageManager @Inject constructor() {
}
}

private fun addPlaceholder(request: GlideRequest<Drawable>, imageType: ImageType): GlideRequest<Drawable> {
Copy link
Contributor

Choose a reason for hiding this comment

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

this might be a good usecase for a private extension function, especially since this is basically a builder pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea, it looks better now!

import javax.inject.Singleton

@Singleton
class ImagePlaceholderManager @Inject constructor() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this class 👍 Is it worth testing it? It's probably not necessary

}
}

fun getPlaceholderImage(imgType: ImageType): Int? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe let's rename both to getPlaceholderResource since they are not really returning images?

Copy link
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

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

Some minor comments, overall looks good 👍

@malinajirka
Copy link
Contributor Author

Thanks for the review @planarvoid ! It's ready for another round;).

Copy link
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

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

👍

@malinajirka malinajirka merged commit 67a15f7 into develop Jul 3, 2018
@malinajirka malinajirka deleted the issue/glide-fallback-placeholder branch February 20, 2019 06:36
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.

2 participants