Skip to content

Commit 552eca8

Browse files
Refactor ad_bottom_app_bar.xml to use LinearLayoutCompat
The MaterialCardView was removed and its attributes were moved to the root LinearLayoutCompat. The padding was also updated from 16dp to 12dp.
1 parent 96dcadb commit 552eca8

File tree

1 file changed

+49
-57
lines changed

1 file changed

+49
-57
lines changed
Lines changed: 49 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,73 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<com.google.android.gms.ads.nativead.NativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
43
android:layout_width="match_parent"
54
android:layout_height="wrap_content">
65

7-
<com.google.android.material.card.MaterialCardView
8-
android:id="@+id/ad_card"
9-
style="@style/Widget.Material3.CardView.Outlined"
6+
<androidx.appcompat.widget.LinearLayoutCompat
107
android:layout_width="match_parent"
118
android:layout_height="wrap_content"
12-
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded">
9+
android:orientation="vertical"
10+
android:background="?attr/colorSurfaceContainer"
11+
android:padding="12dp">
12+
13+
<include layout="@layout/ad_attribution" />
1314

1415
<androidx.appcompat.widget.LinearLayoutCompat
1516
android:layout_width="match_parent"
1617
android:layout_height="wrap_content"
17-
android:orientation="vertical"
18-
android:padding="16dp">
19-
20-
<include layout="@layout/ad_attribution" />
18+
android:layout_marginTop="8dp"
19+
android:gravity="center_vertical"
20+
android:orientation="horizontal">
2121

22-
<androidx.appcompat.widget.LinearLayoutCompat
23-
android:layout_width="match_parent"
24-
android:layout_height="wrap_content"
25-
android:layout_marginTop="8dp"
26-
android:gravity="center_vertical"
27-
android:orientation="horizontal">
22+
<FrameLayout
23+
android:layout_width="40dp"
24+
android:layout_height="40dp"
25+
android:layout_marginEnd="12dp">
2826

29-
<FrameLayout
30-
android:layout_width="40dp"
31-
android:layout_height="40dp"
32-
android:layout_marginEnd="12dp">
27+
<com.google.android.gms.ads.nativead.MediaView
28+
android:id="@+id/ad_media"
29+
android:layout_width="match_parent"
30+
android:layout_height="match_parent" />
3331

34-
<com.google.android.gms.ads.nativead.MediaView
35-
android:id="@+id/ad_media"
36-
android:layout_width="match_parent"
37-
android:layout_height="match_parent" />
32+
<androidx.appcompat.widget.AppCompatImageView
33+
android:id="@+id/ad_app_icon"
34+
android:layout_width="match_parent"
35+
android:layout_height="match_parent"
36+
android:visibility="gone" />
37+
</FrameLayout>
3838

39-
<androidx.appcompat.widget.AppCompatImageView
40-
android:id="@+id/ad_app_icon"
41-
android:layout_width="match_parent"
42-
android:layout_height="match_parent"
43-
android:visibility="gone" />
44-
</FrameLayout>
39+
<androidx.appcompat.widget.LinearLayoutCompat
40+
android:layout_width="0dp"
41+
android:layout_height="wrap_content"
42+
android:layout_weight="1"
43+
android:orientation="vertical">
4544

46-
<androidx.appcompat.widget.LinearLayoutCompat
47-
android:layout_width="0dp"
45+
<com.google.android.material.textview.MaterialTextView
46+
android:id="@+id/ad_headline"
47+
android:layout_width="wrap_content"
4848
android:layout_height="wrap_content"
49-
android:layout_weight="1"
50-
android:orientation="vertical">
51-
52-
<com.google.android.material.textview.MaterialTextView
53-
android:id="@+id/ad_headline"
54-
android:layout_width="wrap_content"
55-
android:layout_height="wrap_content"
56-
android:ellipsize="end"
57-
android:maxLines="1"
58-
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />
59-
60-
<com.google.android.material.textview.MaterialTextView
61-
android:id="@+id/ad_body"
62-
android:layout_width="wrap_content"
63-
android:layout_height="wrap_content"
64-
android:ellipsize="end"
65-
android:maxLines="1"
66-
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
67-
</androidx.appcompat.widget.LinearLayoutCompat>
49+
android:ellipsize="end"
50+
android:maxLines="1"
51+
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />
6852

69-
<com.google.android.material.button.MaterialButton
70-
android:id="@+id/ad_call_to_action"
71-
style="@style/Widget.Material3.Button.TextButton"
53+
<com.google.android.material.textview.MaterialTextView
54+
android:id="@+id/ad_body"
7255
android:layout_width="wrap_content"
7356
android:layout_height="wrap_content"
74-
android:layout_marginStart="8dp"
75-
android:minWidth="88dp"
76-
android:minHeight="40dp" />
57+
android:ellipsize="end"
58+
android:maxLines="1"
59+
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
7760
</androidx.appcompat.widget.LinearLayoutCompat>
61+
62+
<com.google.android.material.button.MaterialButton
63+
android:id="@+id/ad_call_to_action"
64+
style="@style/Widget.Material3.Button.TextButton"
65+
android:layout_width="wrap_content"
66+
android:layout_height="wrap_content"
67+
android:layout_marginStart="8dp"
68+
android:minWidth="88dp"
69+
android:minHeight="40dp" />
7870
</androidx.appcompat.widget.LinearLayoutCompat>
79-
</com.google.android.material.card.MaterialCardView>
71+
</androidx.appcompat.widget.LinearLayoutCompat>
8072
</com.google.android.gms.ads.nativead.NativeAdView>
8173

0 commit comments

Comments
 (0)