Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Conversation

@Lakoja
Copy link
Collaborator

@Lakoja Lakoja commented Oct 29, 2023

Fixes #4083

Limits the size of full screen dialogs on larger devices.

grafik

post { setTextIsSelectable(true) }
}

fun Float.dpToPx(resource: Resources): Float {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We didn't have those, yet?

maxHeightSpec = maxAvailablePixels.height
}

this.setLayout(maxWidthSpec, maxHeightSpec)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Draft..

However this leads to this size being fixed. I. e. SOFT_INPUT_ADJUST_RESIZE not working anymore: Once the keyboard is visible half the (caption) dialog is covered and not scrollable...

if (maxWidthDp == ViewGroup.LayoutParams.MATCH_PARENT && maxHeightDp == ViewGroup.LayoutParams.MATCH_PARENT) {
this.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
} else {
val maxAvailablePixels = getAvailableScreenPixels(this)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Anyway: I have the feeling this could be a one-line configuration somewhere. E. g. defining the right variable in a style and use that for dialogs?

}

private fun getAvailableScreenPixels(window: Window): Size {
val windowInsets = window.windowManager.maximumWindowMetrics.windowInsets
Copy link
Collaborator Author

@Lakoja Lakoja Jan 3, 2024

Choose a reason for hiding this comment

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

Draft

Unfortunately all methods and fields in this method are api level 30 (and not 24).

The task should be simple: Get size available to / used by app window.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit dialog sizes on tablets

1 participant