[Rendering][Android][Crash]: Fixed the scaling issues for background bitmaps #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
FIX FOR : #135
Description
Fixed Scaling Issues for Background Bitmaps
This commit includes significant enhancements to the
BackgroundImageLoaderAsync.java
file, specifically focusing on the scaling of background images.Key changes include:
Modification of the
getScaleFactorForCover
method to return an array of scale factors for both x and y dimensions instead of the maximum of the two. This allows for more precise scaling of the background image.Addition of checks to ensure that the scaled width and height of the image are not zero or less. This prevents potential crashes due to invalid bitmap dimensions.
Update of the
resizeBitmapForCover
method to use the separate x and y scale factors when scaling the bitmap. This ensures that the bitmap is scaled correctly in both dimensions.These changes aim to fix the scaling issues for background bitmaps in Adaptive Cards, improving the visual quality and preventing potential crashes.
Sample Card
How Verified
Verification of the Fix:
Unit Tests:
No new unit tests were added as this change is an enhancement and does not introduce new functionality that requires testing. The existing unit tests were sufficient to verify the correctness of the changes.
Existing Tests:
The existing unit and regression tests were run to ensure that the changes did not introduce any regressions. All tests passed successfully, indicating that the changes are stable and do not adversely affect existing functionality.
Manual Verification:
Manual testing was performed to verify the changes. This involved running the application and observing the rendering of background images in Adaptive Cards. The images were correctly scaled in both dimensions, and no crashes were observed. This confirms that the changes effectively fix the scaling issues for background bitmaps.
Please note that screenshots or .gif's are not included in this description, but they were used during the manual testing process to confirm the correct rendering of background images without any CRASH