处理横屏ad后 dialog 不居中问题

This commit is contained in:
renhaoting 2026-01-04 15:50:42 +08:00
parent c5d7234d92
commit 9ef0b062af
2 changed files with 7 additions and 2 deletions

View File

@ -334,6 +334,7 @@ object AdShowExt {
{ _, _, revenueValue ->
val rewardedData = CommonRewardedData(revenueValue.toFloat())
rewardCallback?.invoke(rewardedData)
//xxxx
AdLogger.e("TopOn激励视频奖励回调, 奖励值:$revenueValue")
}, closeCallback
)

View File

@ -107,13 +107,17 @@ open class BindingDialog<VB : ViewBinding>(protected val mActivity: Activity,
}
private fun getProperWidth(): Int {
return Math.min(ScreenUtils.getScreenWidth(), ScreenUtils.getScreenHeight())
}
fun init() {
if (mActivity is ComponentActivity) {
mActivity.lifecycle.addObserver(this)
}
setCanceledOnTouchOutside(true)
window?.setBackgroundDrawableResource(R.color.transparent)
width = (Math.min(ScreenUtils.getScreenWidth(), ScreenUtils.getScreenHeight()) * 0.8).toInt()
width = (getProperWidth() * 0.8).toInt()
height = WindowManager.LayoutParams.WRAP_CONTENT
setWidthHeight()
window?.setWindowAnimations(R.style.dialog_alpha)
@ -280,7 +284,7 @@ open class BindingDialog<VB : ViewBinding>(protected val mActivity: Activity,
* 设置宽占屏幕的比例
*/
fun setWidthRatio(widthRatio: Double): BindingDialog<VB> {
width = (ScreenUtils.getScreenWidth() * widthRatio).toInt()
width = (getProperWidth() * widthRatio).toInt()
setWidthHeight()
return this
}