From 4a8e23dfc7d845487aa4a0ac6b6e694e60e3ce6a Mon Sep 17 00:00:00 2001 From: marrisaichandan Date: Mon, 6 Feb 2023 13:21:41 +0530 Subject: [PATCH] fixes6 --- .../main/java/com/appyhigh/adutils/AdSdk.kt | 44 ++++++++++++++----- .../layout/native_admob_dynamic8_side1x1.xml | 16 ++++--- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/adutils/src/main/java/com/appyhigh/adutils/AdSdk.kt b/adutils/src/main/java/com/appyhigh/adutils/AdSdk.kt index 8b2d521..073c318 100644 --- a/adutils/src/main/java/com/appyhigh/adutils/AdSdk.kt +++ b/adutils/src/main/java/com/appyhigh/adutils/AdSdk.kt @@ -6327,7 +6327,8 @@ object AdSdk { textColor2, buttonColor, mediaMaxHeight1, - true + true, + layoutId ) } else { @@ -6340,7 +6341,8 @@ object AdSdk { textColor2, buttonColor, mediaMaxHeight1, - false + false, + layoutId ) } } @@ -6367,7 +6369,8 @@ object AdSdk { textColor2: Int?, buttonColor: String?, mediaMaxHeight: Int = 300, - isDynamic: Boolean = false + isDynamic: Boolean = false, + layoutId: Int ){ val iconView = adView?.findViewById(R.id.icon) as ImageView Log.e("$TAG: nativead", "ad body : " + nativeAd.body) @@ -6402,15 +6405,34 @@ object AdSdk { val maxHeightPixels = mediaMaxHeight if (child is ImageView) { //Images child.adjustViewBounds = true - val layoutParams1 = child.layoutParams - layoutParams1.width = MATCH_PARENT - layoutParams1.height = WRAP_CONTENT - child.layoutParams = layoutParams1 + if (layoutId == R.layout.native_admob_dynamic8_sidelarge || layoutId == R.layout.native_admob_dynamic8_side1x1){ + val params = child.layoutParams + params.width = MATCH_PARENT + params.height = MATCH_PARENT + child.layoutParams = params + } + else { + + val layoutParams1 = child.layoutParams + layoutParams1.width = MATCH_PARENT + layoutParams1.height = WRAP_CONTENT + child.layoutParams = layoutParams1 + } + } else { //Videos - val params = child.layoutParams - params.width = MATCH_PARENT - params.height = WRAP_CONTENT - child.layoutParams = params + if (layoutId == R.layout.native_admob_dynamic8_sidelarge || layoutId == R.layout.native_admob_dynamic8_side1x1){ + val params = child.layoutParams + params.width = MATCH_PARENT + params.height = MATCH_PARENT + child.layoutParams = params + } + else { + val params = child.layoutParams + params.width = MATCH_PARENT + params.height = WRAP_CONTENT + child.layoutParams = params + } + } } diff --git a/adutils/src/main/res/layout/native_admob_dynamic8_side1x1.xml b/adutils/src/main/res/layout/native_admob_dynamic8_side1x1.xml index e245f3a..1751c96 100644 --- a/adutils/src/main/res/layout/native_admob_dynamic8_side1x1.xml +++ b/adutils/src/main/res/layout/native_admob_dynamic8_side1x1.xml @@ -22,19 +22,19 @@ android:orientation="horizontal" android:layout_weight="1" android:weightSum="1" - android:layout_height="wrap_content"> + android:layout_height="200dp"> @@ -82,7 +82,7 @@ @@ -102,6 +102,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardCornerRadius="5dp" + android:layout_gravity="center" app:cardElevation="5dp">