-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
4083 limit dialog sizes #4084
base: develop
Are you sure you want to change the base?
4083 limit dialog sizes #4084
Conversation
@@ -78,3 +81,15 @@ fun TextView.fixTextSelection() { | |||
setTextIsSelectable(false) | |||
post { setTextIsSelectable(true) } | |||
} | |||
|
|||
fun Float.dpToPx(resource: Resources): Float { |
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.
We didn't have those, yet?
maxHeightSpec = maxAvailablePixels.height | ||
} | ||
|
||
this.setLayout(maxWidthSpec, maxHeightSpec) |
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.
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) |
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.
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 |
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.
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.
Fixes #4083
Limits the size of full screen dialogs on larger devices.