Skip to content

Commit 17a7449

Browse files
Apply lesson code ad styling across fragments
1 parent 0020083 commit 17a7449

File tree

6 files changed

+134
-23
lines changed

6 files changed

+134
-23
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content">
6+
7+
<com.google.android.material.card.MaterialCardView
8+
android:id="@+id/ad_card"
9+
style="@style/Widget.Material3.CardView.Outlined"
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewBottomRounded">
13+
14+
<LinearLayout
15+
android:layout_width="match_parent"
16+
android:layout_height="wrap_content"
17+
android:orientation="vertical"
18+
android:padding="16dp">
19+
20+
<include layout="@layout/ad_attribution" />
21+
22+
<LinearLayout
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">
28+
29+
<ImageView
30+
android:id="@+id/ad_app_icon"
31+
android:layout_width="40dp"
32+
android:layout_height="40dp"
33+
android:layout_marginEnd="16dp" />
34+
35+
<LinearLayout
36+
android:layout_width="0dp"
37+
android:layout_height="wrap_content"
38+
android:layout_weight="1"
39+
android:orientation="vertical">
40+
41+
<TextView
42+
android:id="@+id/ad_headline"
43+
android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:textAppearance="@style/TextAppearance.Material3.TitleMedium" />
46+
47+
<TextView
48+
android:id="@+id/ad_body"
49+
android:layout_width="wrap_content"
50+
android:layout_height="wrap_content"
51+
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
52+
</LinearLayout>
53+
54+
<com.google.android.material.button.MaterialButton
55+
android:id="@+id/ad_call_to_action"
56+
style="@style/Widget.Material3.Button.TextButton"
57+
android:layout_width="wrap_content"
58+
android:layout_height="wrap_content" />
59+
</LinearLayout>
60+
61+
<com.google.android.gms.ads.nativead.MediaView
62+
android:id="@+id/ad_media"
63+
android:layout_width="match_parent"
64+
android:layout_height="120dp"
65+
android:layout_marginTop="8dp"
66+
android:scaleType="centerCrop" />
67+
68+
</LinearLayout>
69+
</com.google.android.material.card.MaterialCardView>
70+
</com.google.android.gms.ads.nativead.NativeAdView>

app/src/main/res/layout/fragment_buttons_layout.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
android:layout_height="match_parent">
66

77
<com.google.android.material.card.MaterialCardView
8-
style="@style/Widget.Material3.CardView.Elevated"
8+
style="@style/Widget.Material3.CardView.Outlined"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
11-
android:layout_margin="24dp"
12-
app:cardCornerRadius="24dp"
11+
android:layout_marginStart="24dp"
12+
android:layout_marginTop="24dp"
13+
android:layout_marginEnd="24dp"
14+
android:layout_marginBottom="0dp"
15+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
1316
app:layout_constraintBottom_toTopOf="@id/ad_view"
1417
app:layout_constraintTop_toTopOf="parent">
1518

@@ -266,6 +269,12 @@
266269
android:id="@+id/ad_view"
267270
android:layout_width="match_parent"
268271
android:layout_height="wrap_content"
269-
android:layout_margin="24dp"
270-
app:layout_constraintBottom_toBottomOf="parent" />
272+
android:layout_marginStart="24dp"
273+
android:layout_marginTop="0dp"
274+
android:layout_marginEnd="24dp"
275+
android:layout_marginBottom="24dp"
276+
app:nativeAdLayout="@layout/ad_lesson_code"
277+
app:layout_constraintBottom_toBottomOf="parent"
278+
app:layout_constraintEnd_toEndOf="parent"
279+
app:layout_constraintStart_toStartOf="parent" />
271280
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/fragment_clock_layout.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
android:layout_height="match_parent">
66

77
<com.google.android.material.card.MaterialCardView
8-
style="@style/Widget.Material3.CardView.Elevated"
8+
style="@style/Widget.Material3.CardView.Outlined"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
11-
android:layout_margin="24dp"
12-
app:cardCornerRadius="24dp"
11+
android:layout_marginStart="24dp"
12+
android:layout_marginTop="24dp"
13+
android:layout_marginEnd="24dp"
14+
android:layout_marginBottom="0dp"
15+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
1316
app:layout_constraintBottom_toTopOf="@id/ad_view"
1417
app:layout_constraintTop_toTopOf="parent">
1518

@@ -73,6 +76,12 @@
7376
android:id="@+id/ad_view"
7477
android:layout_width="match_parent"
7578
android:layout_height="wrap_content"
76-
android:layout_margin="24dp"
77-
app:layout_constraintBottom_toBottomOf="parent" />
79+
android:layout_marginStart="24dp"
80+
android:layout_marginTop="0dp"
81+
android:layout_marginEnd="24dp"
82+
android:layout_marginBottom="24dp"
83+
app:nativeAdLayout="@layout/ad_lesson_code"
84+
app:layout_constraintBottom_toBottomOf="parent"
85+
app:layout_constraintEnd_toEndOf="parent"
86+
app:layout_constraintStart_toStartOf="parent" />
7887
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/fragment_code.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
android:layout_height="match_parent">
66

77
<com.google.android.material.card.MaterialCardView
8-
style="@style/Widget.Material3.CardView.Elevated"
8+
style="@style/Widget.Material3.CardView.Outlined"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
11-
android:layout_margin="24dp"
12-
app:cardCornerRadius="24dp"
11+
android:layout_marginStart="24dp"
12+
android:layout_marginTop="24dp"
13+
android:layout_marginEnd="24dp"
14+
android:layout_marginBottom="0dp"
15+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
1316
app:layout_constraintBottom_toTopOf="@id/ad_view"
1417
app:layout_constraintTop_toTopOf="parent">
1518

@@ -30,7 +33,11 @@
3033
android:id="@+id/ad_view"
3134
android:layout_width="match_parent"
3235
android:layout_height="wrap_content"
33-
android:layout_margin="24dp"
36+
android:layout_marginStart="24dp"
37+
android:layout_marginTop="0dp"
38+
android:layout_marginEnd="24dp"
39+
android:layout_marginBottom="24dp"
40+
app:nativeAdLayout="@layout/ad_lesson_code"
3441
app:layout_constraintBottom_toBottomOf="parent"
3542
app:layout_constraintEnd_toEndOf="parent"
3643
app:layout_constraintStart_toStartOf="parent" />

app/src/main/res/layout/fragment_layout.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
android:layout_height="match_parent">
66

77
<com.google.android.material.card.MaterialCardView
8-
style="@style/Widget.Material3.CardView.Elevated"
8+
style="@style/Widget.Material3.CardView.Outlined"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
11-
android:layout_margin="24dp"
12-
app:cardCornerRadius="24dp"
11+
android:layout_marginStart="24dp"
12+
android:layout_marginTop="24dp"
13+
android:layout_marginEnd="24dp"
14+
android:layout_marginBottom="0dp"
15+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
1316
app:layout_constraintBottom_toTopOf="@id/ad_view"
1417
app:layout_constraintTop_toTopOf="parent">
1518

@@ -30,7 +33,11 @@
3033
android:id="@+id/ad_view"
3134
android:layout_width="match_parent"
3235
android:layout_height="wrap_content"
33-
android:layout_margin="24dp"
36+
android:layout_marginStart="24dp"
37+
android:layout_marginTop="0dp"
38+
android:layout_marginEnd="24dp"
39+
android:layout_marginBottom="24dp"
40+
app:nativeAdLayout="@layout/ad_lesson_code"
3441
app:layout_constraintBottom_toBottomOf="parent"
3542
app:layout_constraintEnd_toEndOf="parent"
3643
app:layout_constraintStart_toStartOf="parent" />

app/src/main/res/layout/fragment_linear_layout_layout.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
android:layout_height="match_parent">
66

77
<com.google.android.material.card.MaterialCardView
8-
style="@style/Widget.Material3.CardView.Elevated"
8+
style="@style/Widget.Material3.CardView.Outlined"
99
android:layout_width="match_parent"
1010
android:layout_height="0dp"
11-
android:layout_margin="24dp"
12-
app:cardCornerRadius="24dp"
11+
android:layout_marginStart="24dp"
12+
android:layout_marginTop="24dp"
13+
android:layout_marginEnd="24dp"
14+
android:layout_marginBottom="0dp"
15+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
1316
app:layout_constraintBottom_toTopOf="@id/ad_view"
1417
app:layout_constraintTop_toTopOf="parent">
1518

@@ -56,6 +59,12 @@
5659
android:id="@+id/ad_view"
5760
android:layout_width="match_parent"
5861
android:layout_height="wrap_content"
59-
android:layout_margin="24dp"
60-
app:layout_constraintBottom_toBottomOf="parent" />
62+
android:layout_marginStart="24dp"
63+
android:layout_marginTop="0dp"
64+
android:layout_marginEnd="24dp"
65+
android:layout_marginBottom="24dp"
66+
app:nativeAdLayout="@layout/ad_lesson_code"
67+
app:layout_constraintBottom_toBottomOf="parent"
68+
app:layout_constraintEnd_toEndOf="parent"
69+
app:layout_constraintStart_toStartOf="parent" />
6170
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)