From 069cec0a2def05040fe0c3c481415cbc73f7e991 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Sun, 24 Nov 2024 12:51:43 +0100 Subject: [PATCH] [Oztechan/CCC#4085] Hide the unused area when ads are not visible (#4086) --- .../ccc/android/ui/mobile/util/ViewExtensions.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/android/ui/mobile/src/main/kotlin/com/oztechan/ccc/android/ui/mobile/util/ViewExtensions.kt b/android/ui/mobile/src/main/kotlin/com/oztechan/ccc/android/ui/mobile/util/ViewExtensions.kt index 9deafcbe7..cd0cdfaa3 100644 --- a/android/ui/mobile/src/main/kotlin/com/oztechan/ccc/android/ui/mobile/util/ViewExtensions.kt +++ b/android/ui/mobile/src/main/kotlin/com/oztechan/ccc/android/ui/mobile/util/ViewExtensions.kt @@ -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() {