Skip to content

Commit 81dc494

Browse files
Rename layout XMLs for consistent naming
1 parent 81d299e commit 81dc494

19 files changed

+86
-76
lines changed

app/src/main/java/com/d4rk/androidtutorials/java/ads/managers/NativeAdLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class NativeAdLoader {
2929
private static final String TAG = "NativeAdLoader";
3030

3131
public static void load(@NonNull Context context, @NonNull ViewGroup container) {
32-
load(context, container, R.layout.large_home_banner_native_ad, null);
32+
load(context, container, R.layout.ad_home_banner_large, null);
3333
}
3434

3535
public static void load(@NonNull Context context, @NonNull ViewGroup container, @LayoutRes int layoutRes) {

app/src/main/java/com/d4rk/androidtutorials/java/ads/views/NativeAdBannerView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
public class NativeAdBannerView extends FrameLayout {
2222

23-
private int layoutRes = R.layout.large_home_banner_native_ad;
23+
private int layoutRes = R.layout.ad_home_banner_large;
2424

2525
public NativeAdBannerView(@NonNull Context context) {
2626
super(context);
@@ -40,7 +40,7 @@ public NativeAdBannerView(@NonNull Context context, @Nullable AttributeSet attrs
4040
private void init(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
4141
if (attrs != null) {
4242
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NativeAdBannerView, defStyleAttr, 0);
43-
layoutRes = a.getResourceId(R.styleable.NativeAdBannerView_nativeAdLayout, R.layout.large_home_banner_native_ad);
43+
layoutRes = a.getResourceId(R.styleable.NativeAdBannerView_nativeAdLayout, R.layout.ad_home_banner_large);
4444
a.recycle();
4545
}
4646
}

app/src/main/java/com/d4rk/androidtutorials/java/ui/screens/android/AndroidStudioFragment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,15 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
341341
adView.setLayoutParams(new RecyclerView.LayoutParams(
342342
ViewGroup.LayoutParams.MATCH_PARENT,
343343
ViewGroup.LayoutParams.WRAP_CONTENT));
344-
adView.setNativeAdLayout(R.layout.android_studio_list_native_ad);
344+
adView.setNativeAdLayout(R.layout.ad_android_studio_list);
345345
return new AdHolder(adView);
346346
} else if (viewType == TYPE_CATEGORY) {
347347
View view = LayoutInflater.from(parent.getContext())
348-
.inflate(R.layout.android_studio_category_item, parent, false);
348+
.inflate(R.layout.item_android_studio_category, parent, false);
349349
return new CategoryHolder(view);
350350
} else {
351351
View view = LayoutInflater.from(parent.getContext())
352-
.inflate(R.layout.android_studio_lesson_item, parent, false);
352+
.inflate(R.layout.item_android_studio_lesson, parent, false);
353353
return new LessonHolder(view);
354354
}
355355
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
android:id="@+id/ad_view"
5858
android:layout_width="match_parent"
5959
android:layout_height="wrap_content"
60-
app:nativeAdLayout="@layout/bottom_app_bar_native_ad" />
60+
app:nativeAdLayout="@layout/ad_bottom_app_bar" />
6161
</FrameLayout>
6262

6363
<com.google.android.material.bottomnavigation.BottomNavigationView

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
android:layout_height="wrap_content"
127127
android:layout_marginTop="16dp"
128128
android:layout_marginBottom="16dp"
129-
app:nativeAdLayout="@layout/large_home_banner_native_ad" />
129+
app:nativeAdLayout="@layout/ad_home_banner_large" />
130130
</androidx.appcompat.widget.LinearLayoutCompat>
131131
</me.zhanghai.android.fastscroll.FastScrollScrollView>
132132
</androidx.constraintlayout.widget.ConstraintLayout>
File renamed without changes.

app/src/main/res/layout/android_studio_list_native_ad.xml renamed to app/src/main/res/layout/ad_android_studio_list.xml

File renamed without changes.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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:cardUseCompatPadding="false"
13+
app:cardPreventCornerOverlap="true">
14+
15+
<LinearLayout
16+
android:id="@+id/ad_host"
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:orientation="vertical"
20+
android:background="?attr/colorSurfaceContainer"
21+
android:paddingStart="16dp"
22+
android:paddingEnd="16dp"
23+
android:paddingTop="12dp"
24+
android:paddingBottom="12dp">
25+
26+
<include layout="@layout/ad_attribution" />
27+
28+
<LinearLayout
29+
android:layout_width="match_parent"
30+
android:layout_height="wrap_content"
31+
android:gravity="center_vertical"
32+
android:orientation="horizontal">
33+
34+
<ImageView
35+
android:id="@+id/ad_app_icon"
36+
android:layout_width="32dp"
37+
android:layout_height="32dp"
38+
android:layout_marginEnd="12dp" />
39+
40+
<LinearLayout
41+
android:layout_width="0dp"
42+
android:layout_height="wrap_content"
43+
android:layout_weight="1"
44+
android:orientation="vertical">
45+
46+
<TextView
47+
android:id="@+id/ad_headline"
48+
android:layout_width="wrap_content"
49+
android:layout_height="wrap_content"
50+
android:ellipsize="end"
51+
android:maxLines="1"
52+
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />
53+
54+
<TextView
55+
android:id="@+id/ad_body"
56+
android:layout_width="wrap_content"
57+
android:layout_height="wrap_content"
58+
android:ellipsize="end"
59+
android:maxLines="1"
60+
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
61+
</LinearLayout>
62+
63+
<com.google.android.material.button.MaterialButton
64+
android:id="@+id/ad_call_to_action"
65+
style="@style/Widget.Material3.Button.TextButton"
66+
android:layout_width="wrap_content"
67+
android:layout_height="wrap_content"
68+
android:minWidth="88dp"
69+
android:minHeight="40dp"
70+
android:layout_marginStart="8dp" />
71+
</LinearLayout>
72+
</LinearLayout>
73+
</com.google.android.material.card.MaterialCardView>
74+
</com.google.android.gms.ads.nativead.NativeAdView>
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)