Skip to content

Commit 39b1e77

Browse files
Optimize layouts to reduce redundant containers
1 parent 67dfa50 commit 39b1e77

11 files changed

+9
-29
lines changed

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

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
android:id="@+id/nav_rail"
2525
android:layout_width="wrap_content"
2626
android:layout_height="0dp"
27-
app:layout_constraintBottom_toTopOf="@+id/ad_container"
27+
app:layout_constraintBottom_toTopOf="@+id/ad_view"
2828
app:layout_constraintStart_toStartOf="parent"
2929
app:layout_constraintTop_toBottomOf="@id/app_bar_layout"
3030
app:menu="@menu/bottom_nav_menu" />
@@ -35,30 +35,20 @@
3535
android:layout_width="0dp"
3636
android:layout_height="0dp"
3737
app:defaultNavHost="true"
38-
app:layout_constraintBottom_toTopOf="@+id/ad_container"
38+
app:layout_constraintBottom_toTopOf="@+id/ad_view"
3939
app:layout_constraintEnd_toEndOf="parent"
4040
app:layout_constraintStart_toEndOf="@id/nav_rail"
4141
app:layout_constraintTop_toBottomOf="@id/app_bar_layout"
4242
app:navGraph="@navigation/mobile_navigation" />
4343

44-
<FrameLayout
45-
android:id="@+id/ad_container"
44+
<com.d4rk.androidtutorials.java.ads.views.NativeAdBannerView
45+
android:id="@+id/ad_view"
4646
android:layout_width="match_parent"
4747
android:layout_height="wrap_content"
48-
app:layout_constraintBottom_toTopOf="@+id/nav_view">
49-
50-
<View
51-
android:id="@+id/ad_placeholder"
52-
android:layout_width="match_parent"
53-
android:layout_height="match_parent"
54-
android:background="?attr/colorSurfaceContainer" />
55-
56-
<com.d4rk.androidtutorials.java.ads.views.NativeAdBannerView
57-
android:id="@+id/ad_view"
58-
android:layout_width="match_parent"
59-
android:layout_height="wrap_content"
60-
app:nativeAdLayout="@layout/ad_bottom_app_bar" />
61-
</FrameLayout>
48+
app:layout_constraintBottom_toTopOf="@+id/nav_view"
49+
app:layout_constraintEnd_toEndOf="parent"
50+
app:layout_constraintStart_toStartOf="parent"
51+
app:nativeAdLayout="@layout/ad_bottom_app_bar" />
6252

6353
<com.google.android.material.bottomnavigation.BottomNavigationView
6454
android:id="@+id/nav_view"

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
xmlns:tools="http://schemas.android.com/tools"
66
android:id="@+id/container"
77
android:layout_width="match_parent"
8-
android:layout_height="match_parent"
9-
android:orientation="vertical">
8+
android:layout_height="match_parent">
109

1110
<FrameLayout
1211
android:id="@+id/frame_layout_shortcuts"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@
269269
android:layout_width="match_parent"
270270
android:layout_height="wrap_content"
271271
android:layout_marginStart="24dp"
272-
android:layout_marginTop="0dp"
273272
android:layout_marginEnd="24dp"
274273
android:layout_marginBottom="24dp"
275274
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
android:layout_width="match_parent"
7878
android:layout_height="wrap_content"
7979
android:layout_marginStart="24dp"
80-
android:layout_marginTop="0dp"
8180
android:layout_marginEnd="24dp"
8281
android:layout_marginBottom="24dp"
8382
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
android:layout_width="match_parent"
3434
android:layout_height="wrap_content"
3535
android:layout_marginStart="24dp"
36-
android:layout_marginTop="0dp"
3736
android:layout_marginEnd="24dp"
3837
android:layout_marginBottom="24dp"
3938
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@
188188
android:layout_width="match_parent"
189189
android:layout_height="wrap_content"
190190
android:layout_marginHorizontal="16dp"
191-
android:layout_marginBottom="0dp"
192191
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded">
193192

194193
<androidx.appcompat.widget.LinearLayoutCompat

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
android:layout_width="match_parent"
3434
android:layout_height="wrap_content"
3535
android:layout_marginStart="24dp"
36-
android:layout_marginTop="0dp"
3736
android:layout_marginEnd="24dp"
3837
android:layout_marginBottom="24dp"
3938
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
android:layout_width="match_parent"
6060
android:layout_height="wrap_content"
6161
android:layout_marginStart="24dp"
62-
android:layout_marginTop="0dp"
6362
android:layout_marginEnd="24dp"
6463
android:layout_marginBottom="24dp"
6564
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
android:layout_width="match_parent"
3131
android:layout_height="wrap_content"
3232
android:layout_marginStart="24dp"
33-
android:layout_marginTop="0dp"
3433
android:layout_marginEnd="24dp"
3534
android:layout_marginBottom="24dp"
3635
app:layout_constraintBottom_toBottomOf="parent"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
android:layout_width="match_parent"
5656
android:layout_height="wrap_content"
5757
android:layout_marginStart="24dp"
58-
android:layout_marginTop="0dp"
5958
android:layout_marginEnd="24dp"
6059
android:layout_marginBottom="24dp"
6160
app:layout_constraintBottom_toBottomOf="parent"

0 commit comments

Comments
 (0)