Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Update FreeformView.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Live-Block authored Nov 3, 2024
1 parent c4909b9 commit 127003c
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ class FreeformView(
private var freeformHeight = 0
private var freeformWidth = 0

private var minFreeformHeight = 0
private var minFreeformWidth = 0

private var maxFreeformHeight = 0
private var maxFreeformWidth = 0

// 挂起后与边缘的 Padding
private var screenPaddingX: Int = context.resources.getDimension(R.dimen.freeform_screen_width_padding).roundToInt()
private var screenPaddingY: Int = context.resources.getDimension(R.dimen.freeform_screen_height_padding).roundToInt()
Expand Down Expand Up @@ -1033,8 +1027,7 @@ class FreeformView(

if (dy != 0f) {
val tempHeight = freeformHeight + dy
val tempWidth = (tempHeight * config.widthHeightRatio).roundToInt()
if (tempHeight >= minFreeformHeight && tempWidth <= maxFreeformWidth) {
if (tempHeight >= hangUpViewHeight && tempHeight <= rootHeight * 0.9) {
freeformHeight += dy.roundToInt()
freeformWidth = (freeformHeight * config.widthHeightRatio).roundToInt()
if (virtualDisplayRotation == VIRTUAL_DISPLAY_ROTATION_LANDSCAPE) {
Expand All @@ -1048,8 +1041,7 @@ class FreeformView(
}
} else if (dx != 0f) {
val tempWidth = freeformWidth + dx
val tempHeight = (tempWidth / config.widthHeightRatio).roundToInt()
if (tempWidth >= minFreeformWidth && tempHeight <= maxFreeformHeight) {
if (tempWidth >= hangUpViewWidth && tempWidth <= rootWidth * 0.9) {
freeformWidth += dx.roundToInt()
freeformHeight = ((freeformWidth / config.widthHeightRatio) - cardWidthMargin).roundToInt()
if (virtualDisplayRotation == VIRTUAL_DISPLAY_ROTATION_LANDSCAPE) {
Expand Down

0 comments on commit 127003c

Please sign in to comment.