Skip to content

Commit ee6b06d

Browse files
Merge pull request #142 from MihaiCristianCondrea/codex/rename-xml-files-for-consistency
Align layout XML naming conventions
2 parents 81d299e + 90ef09d commit ee6b06d

20 files changed

+33
-28
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/components/navigation/BottomSheetMenuFragment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111

1212
import com.d4rk.androidtutorials.java.BuildConfig;
1313
import com.d4rk.androidtutorials.java.R;
14-
import com.d4rk.androidtutorials.java.databinding.BottomSheetMenuBinding;
14+
import com.d4rk.androidtutorials.java.databinding.DialogBottomSheetMenuBinding;
1515
import com.d4rk.androidtutorials.java.ui.screens.settings.SettingsActivity;
1616
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
1717

1818
public class BottomSheetMenuFragment extends BottomSheetDialogFragment {
1919

20-
private BottomSheetMenuBinding binding;
20+
private DialogBottomSheetMenuBinding binding;
2121

2222
@Override
2323
public View onCreateView(@NonNull LayoutInflater inflater,
2424
ViewGroup container,
2525
Bundle savedInstanceState) {
26-
binding = BottomSheetMenuBinding.inflate(inflater, container, false);
26+
binding = DialogBottomSheetMenuBinding.inflate(inflater, container, false);
2727

2828
binding.menuSettings.setOnClickListener(v -> {
2929
Intent intent = new Intent(requireContext(), SettingsActivity.class);

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/java/com/d4rk/androidtutorials/java/ui/screens/home/HomeFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
5555
java.util.List<PromotedApp> apps = state.promotedApps();
5656
for (int i = 0; i < apps.size(); i++) {
5757
PromotedApp app = apps.get(i);
58-
com.d4rk.androidtutorials.java.databinding.PromotedAppItemBinding itemBinding =
59-
com.d4rk.androidtutorials.java.databinding.PromotedAppItemBinding.inflate(inflater, promotedContainer, false);
58+
com.d4rk.androidtutorials.java.databinding.ItemPromotedAppBinding itemBinding =
59+
com.d4rk.androidtutorials.java.databinding.ItemPromotedAppBinding.inflate(inflater, promotedContainer, false);
6060
loadImage(app.iconUrl(), itemBinding.appIcon);
6161
itemBinding.appName.setText(app.name());
6262
itemBinding.appDescription.setVisibility(android.view.View.GONE);

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/bottom_app_bar_native_ad.xml renamed to app/src/main/res/layout/ad_bottom_app_bar.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99
android:layout_height="wrap_content"
1010
android:orientation="vertical"
1111
android:background="?attr/colorSurfaceContainer"
12-
android:paddingStart="16dp"
13-
android:paddingEnd="16dp"
14-
android:paddingTop="12dp"
15-
android:paddingBottom="12dp">
12+
android:paddingHorizontal="16dp">
1613

17-
<include layout="@layout/ad_attribution" />
14+
<include
15+
android:layout_width="wrap_content"
16+
android:layout_height="wrap_content"
17+
android:layout_marginTop="4dp"
18+
layout="@layout/ad_attribution" />
1819

1920
<LinearLayout
2021
android:layout_width="match_parent"
2122
android:layout_height="wrap_content"
2223
android:gravity="center_vertical"
2324
android:orientation="horizontal">
2425

25-
<ImageView
26+
<androidx.appcompat.widget.AppCompatImageView
2627
android:id="@+id/ad_app_icon"
2728
android:layout_width="32dp"
2829
android:layout_height="32dp"

0 commit comments

Comments
 (0)