Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ private static void populateNativeAdView(@NonNull NativeAd nativeAd, @NonNull Na
ImageView iconView = adView.findViewById(R.id.ad_app_icon);
TextView attributionView = adView.findViewById(R.id.ad_attribution);

adView.setMediaView(mediaView);
if (mediaView != null) {
adView.setMediaView(mediaView);
}
adView.setHeadlineView(headlineView);
adView.setBodyView(bodyView);
adView.setCallToActionView(callToActionView);
Expand Down
67 changes: 67 additions & 0 deletions app/src/main/res/layout/ad_lesson_code.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.ads.nativead.NativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.card.MaterialCardView
android:id="@+id/ad_card"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewBottomRounded">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="4dp"
android:paddingHorizontal="16dp">

<include layout="@layout/ad_attribution" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:id="@+id/ad_app_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="16dp" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:id="@+id/ad_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium" />

<TextView
android:id="@+id/ad_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
</LinearLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/ad_call_to_action"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</com.google.android.gms.ads.nativead.NativeAdView>
18 changes: 13 additions & 5 deletions app/src/main/res/layout/fragment_buttons_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand Down Expand Up @@ -266,6 +268,12 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
19 changes: 14 additions & 5 deletions app/src/main/res/layout/fragment_clock_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"

android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand Down Expand Up @@ -73,6 +76,12 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
14 changes: 10 additions & 4 deletions app/src/main/res/layout/fragment_code.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand All @@ -30,7 +32,11 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
14 changes: 10 additions & 4 deletions app/src/main/res/layout/fragment_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand All @@ -30,7 +32,11 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/res/layout/fragment_linear_layout_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand Down Expand Up @@ -56,6 +58,12 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 13 additions & 5 deletions app/src/main/res/layout/fragment_no_code.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand All @@ -27,6 +29,12 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 13 additions & 5 deletions app/src/main/res/layout/fragment_same_code.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
android:layout_height="match_parent">

<com.google.android.material.card.MaterialCardView
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="24dp"
app:cardCornerRadius="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded"
app:layout_constraintBottom_toTopOf="@id/ad_view"
app:layout_constraintTop_toTopOf="parent">

Expand Down Expand Up @@ -52,6 +54,12 @@
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_marginStart="24dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:nativeAdLayout="@layout/ad_lesson_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>