Skip to content

Commit

Permalink
[#4085] Hide the unused area when ads are not visible (#4086)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan authored Nov 24, 2024
1 parent 266e0f6 commit 069cec0
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ fun FrameLayout.buildBanner(
adManager: AdManager,
adId: String,
shouldShowAd: Boolean
) {
if (shouldShowAd) {
val maxAdHeight =
(context.resources.getDimension(R.dimen.ads_banner_height) / resources.displayMetrics.density).toInt()
removeAllViews()
addView(adManager.getBannerAd(context, adId, maxAdHeight))
}
) = if (shouldShowAd) {
val maxAdHeight =
(context.resources.getDimension(R.dimen.ads_banner_height) / resources.displayMetrics.density).toInt()
removeAllViews()
addView(adManager.getBannerAd(context, adId, maxAdHeight))
} else {
visibility = View.GONE
}

fun FrameLayout.destroyBanner() {
Expand Down

0 comments on commit 069cec0

Please sign in to comment.