Skip to content

Commit

Permalink
fixes6
Browse files Browse the repository at this point in the history
  • Loading branch information
marrisaichandan committed Feb 6, 2023
1 parent bcd4dbd commit 4a8e23d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 18 deletions.
44 changes: 33 additions & 11 deletions adutils/src/main/java/com/appyhigh/adutils/AdSdk.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6327,7 +6327,8 @@ object AdSdk {
textColor2,
buttonColor,
mediaMaxHeight1,
true
true,
layoutId
)
}
else {
Expand All @@ -6340,7 +6341,8 @@ object AdSdk {
textColor2,
buttonColor,
mediaMaxHeight1,
false
false,
layoutId
)
}
}
Expand All @@ -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)
Expand Down Expand Up @@ -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
}

}
}

Expand Down
16 changes: 9 additions & 7 deletions adutils/src/main/res/layout/native_admob_dynamic8_side1x1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
android:orientation="horizontal"
android:layout_weight="1"
android:weightSum="1"
android:layout_height="wrap_content">
android:layout_height="200dp">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="0.5"
android:layout_weight="0.5"
android:orientation="vertical">

<com.google.android.gms.ads.nativead.MediaView
android:id="@+id/ad_media"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@color/cardview_dark_background"
android:layout_margin="5dp" />
Expand Down Expand Up @@ -82,7 +82,7 @@

<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"
Expand All @@ -93,7 +93,7 @@
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="8dip">
Expand All @@ -102,6 +102,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="5dp"
android:layout_gravity="center"
app:cardElevation="5dp">

<ImageView
Expand All @@ -118,6 +119,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="5dp"
android:orientation="vertical">

<TextView
Expand Down

0 comments on commit 4a8e23d

Please sign in to comment.