Skip to content

MOBILE-52: Fix snackbar cross and cross margins#721

Merged
enotniy merged 1 commit into
developfrom
feature/MOBILE-52_fix_inapp_cross
Jun 1, 2026
Merged

MOBILE-52: Fix snackbar cross and cross margins#721
enotniy merged 1 commit into
developfrom
feature/MOBILE-52_fix_inapp_cross

Conversation

@enotniy
Copy link
Copy Markdown
Collaborator

@enotniy enotniy commented Jun 1, 2026

https://tracker.yandex.ru/MOBILE-52

InAppImageView.kt — fix ClassCastException in snackbar: used FrameLayout.LayoutParams on a ConstraintLayout child; switched to ConstraintLayout.LayoutParams.

InAppCrossView.kt — fix close button stuck in corner: margins were computed from currentDialog.height/width which are 0 before layout. Wrapped margin calc + constraints in doOnLayout {} (works for both sync cache-hit and async paths).

Extensions.kt — fix Glide cache-key mismatch on foldables/multi-display: maxScreenDimension() returned different metrics for Application vs Activity context → different .override() → cache miss. Now always reads from applicationContext.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes several in-app UI and image-loading edge cases affecting snackbars and multi-display/foldable devices by correcting layout params usage, deferring constraint/margin calculations until layout, and stabilizing Glide sizing inputs to avoid cache misses.

Changes:

  • Fix ClassCastException risk in snackbar image by switching to ConstraintLayout.LayoutParams.
  • Fix close (“cross”) button positioning by calculating margins after layout (doOnLayout) and simplifying constraint updates via a new helper.
  • Fix Glide cache-key mismatch by reading screen metrics from applicationContext consistently; update unit test mocks accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/src/test/java/cloud/mindbox/mobile_sdk/inapp/data/managers/InAppGlideImageLoaderImplTest.kt Mocks applicationContext to align with updated screen-metrics lookup.
sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/InAppImageView.kt Uses ConstraintLayout.LayoutParams for snackbar image view to match its parent layout type.
sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/InAppCrossView.kt Defers margin/constraint calculation until layout to avoid zero-sized parent measurements.
sdk/src/main/java/cloud/mindbox/mobile_sdk/inapp/presentation/view/InAppConstraintLayout.kt Adds updateConstraints {} helper to reduce ConstraintSet boilerplate at call sites.
sdk/src/main/java/cloud/mindbox/mobile_sdk/Extensions.kt Makes maxScreenDimension() use applicationContext display metrics for consistent Glide overrides/caching.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@enotniy enotniy requested a review from sergeysozinov June 1, 2026 11:40
@enotniy enotniy merged commit 531ea30 into develop Jun 1, 2026
7 checks passed
@enotniy enotniy deleted the feature/MOBILE-52_fix_inapp_cross branch June 1, 2026 13:02
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.

3 participants