コード整形
This commit is contained in:
parent
ca9bcce271
commit
8e33880dbc
|
@ -92,20 +92,7 @@ internal class StatusButtonsPopup(
|
|||
buttonsForStatus.closeWindow = window
|
||||
|
||||
val density = activity.density
|
||||
fun dip(src: Float) = (src * density + 0.5f).toInt()
|
||||
|
||||
val location = IntArray(2)
|
||||
|
||||
listView.getLocationInWindow(location)
|
||||
val listviewTop = location[1]
|
||||
val clipTop = listviewTop + dip(8f)
|
||||
val clipBottom = listviewTop + listView.height - dip(8f)
|
||||
|
||||
anchor.getLocationInWindow(location)
|
||||
val anchorLeft = location[0]
|
||||
val anchorTop = location[1]
|
||||
val anchorWidth = anchor.width
|
||||
val anchorHeight = anchor.height
|
||||
fun Int.dp() = (this * density + 0.5f).toInt()
|
||||
|
||||
// popupの大きさ
|
||||
viewRoot.measure(
|
||||
|
@ -115,6 +102,19 @@ internal class StatusButtonsPopup(
|
|||
val popupWidth = viewRoot.measuredWidth
|
||||
val popupHeight = viewRoot.measuredHeight
|
||||
|
||||
val location = IntArray(2)
|
||||
|
||||
listView.getLocationInWindow(location)
|
||||
val listviewTop = location[1]
|
||||
val clipTop = listviewTop + 8.dp()
|
||||
val clipBottom = listviewTop + listView.height - 8.dp()
|
||||
|
||||
anchor.getLocationInWindow(location)
|
||||
val anchorLeft = location[0]
|
||||
val anchorTop = location[1]
|
||||
val anchorWidth = anchor.width
|
||||
val anchorHeight = anchor.height
|
||||
|
||||
// ポップアップウィンドウの左上(基準は親ウィンドウの左上)
|
||||
val popupX = anchorLeft + max(0, (anchorWidth - popupWidth) / 2)
|
||||
var popupY = anchorTop + anchorHeight / 2
|
||||
|
|
Loading…
Reference in New Issue