Skip to content

fix: cap popup width on tablets and large screens#521

Open
TomasULR wants to merge 1 commit intokavishdevar:mainfrom
TomasULR:fix/tablet-popup-width
Open

fix: cap popup width on tablets and large screens#521
TomasULR wants to merge 1 commit intokavishdevar:mainfrom
TomasULR:fix/tablet-popup-width

Conversation

@TomasULR
Copy link
Copy Markdown

Summary

  • On tablets in landscape mode, the AirPods connection popup covers the entire screen because width is set to MATCH_PARENT
  • This caps the popup width to 400dp on screens wider than 600dp (standard Android tablet breakpoint) and centers it horizontally
  • Also fixes a bug where a duplicate gravity assignment in init was overwriting the CENTER_HORIZONTAL flag set in the LayoutParams initializer

Changes

  • PopupWindow.kt: Added screen width detection using displayMetrics, caps width to 400dp on large screens
  • Changed gravity from Gravity.BOTTOM to Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
  • Removed redundant mParams.gravity = Gravity.BOTTOM in init block

Fixes #425

On tablets in landscape mode, the AirPods connection popup covers the
entire screen because width is set to MATCH_PARENT. This caps the popup
width to 400dp on screens wider than 600dp and centers it horizontally.

Also removes a duplicate gravity assignment in init that was overwriting
the CENTER_HORIZONTAL flag.

Fixes kavishdevar#425
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.

UI issues on android tablet (Tab S9 Ultra)

1 participant