-
Notifications
You must be signed in to change notification settings - Fork 500
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
Fix #1020: Rendering of Svg images from server. #1019
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.
Add test cases to add various public functions in this PR.
Otherwise as per your suggested changes your PR is working correctly. Thanks.
utility/src/main/java/org/oppia/util/parser/GlideImageLoader.kt
Outdated
Show resolved
Hide resolved
utility/src/main/java/org/oppia/util/parser/RepositoryGlideModule.kt
Outdated
Show resolved
Hide resolved
utility/src/main/java/org/oppia/util/parser/SvgDrawableTranscoder.kt
Outdated
Show resolved
Hide resolved
utility/src/main/java/org/oppia/util/parser/SvgSoftwareLayerSetter.kt
Outdated
Show resolved
Hide resolved
There is issue #277 that need to have testcase for image loading. So I haven't added it here. Issue is mentioned in UrlImageParser file. |
Are we handling the fallback case if the image is not an SVG? |
Yes. |
We can add one more case though to render the url as png if svg fails because some websites have a redirect mechanism in svg url which redirects to png url |
@veena14cs there is an error function in glide which executes if the image fails to render we can add png/svg clause in case of a failure |
In that case you can create a PR and will check it. |
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.
Non-flaky tests are failing, else looks good.
utility/src/main/java/org/oppia/util/parser/RepositoryGlideModule.kt
Outdated
Show resolved
Hide resolved
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.
non_flaky_tests are failing PTAL
Thanks @veena14cs--in the future please assign me the pull request once you need some sort of action item from me (e.g. answering a question or doing another review) so that I can find it more easily. Thanks! :) I will try to take a look today. |
Sure @BenHenning thanks. |
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 @veena14cs! Just a few more comments.
Also, can you make sure all comment threads that are resolved are marked as resolved, otherwise there's a clear question to follow up on them? That makes it easier for me to go back and comment on old threads.
utility/src/main/java/org/oppia/util/parser/SvgSoftwareLayerSetter.kt
Outdated
Show resolved
Hide resolved
utility/src/main/java/org/oppia/util/parser/RepositoryGlideModule.kt
Outdated
Show resolved
Hide resolved
@BenHenning I have addressed your comments also I changed some of the implementation and removed some files which may not be necessary and could load svg's without any issues. |
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 @veena14cs! I reopened a couple of the past conversation threads--please resolve those & my new comment before submitting. Otherwise the changes look good. Thanks for implementing this!
If you have any questions about my comments, please ask or reassign the PR to me before submitting.
Changed the implementation as per the discussion. @BenHenning Please take a final look before I submit this PR. |
@@ -93,7 +94,7 @@ class UrlImageParser private constructor( | |||
} | |||
} | |||
|
|||
class UrlDrawable : BitmapDrawable() { | |||
class UrlDrawable : BitmapDrawable(){ |
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.
I suggest reverting this (e.g. BitmapDrawable() {
).
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 @veena14cs--this LGTM!
Explanation
This PR fixes issue #1020. It implements rendering of svg images from server.
For Testing
GlideImageLoader
on line number 49 replacemodel
with url "https://cdn.shopify.com/s/files/1/0496/1029/files/Freesample.svg"fraction_exploration0.json
file. Search for image nameimg_20180121_113315_pqwqhf863w_height_565_width_343
and replace png to svg.