Skip to content

Commit 5bcc08c

Browse files
Refine paddings and margins in MainActivity.
1 parent 7b7e381 commit 5bcc08c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ protected void onCreate(Bundle savedInstanceState) {
255255
if (isImmersiveInterface()) {
256256
binding.drawerLayout.setStatusBarBackgroundColor(Color.TRANSPARENT);
257257
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
258-
binding.drawerLayout.setFitsSystemWindows(false);
258+
//binding.drawerLayout.setFitsSystemWindows(false);
259259
window.setDecorFitsSystemWindows(false);
260260
} else {
261261
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
@@ -283,6 +283,12 @@ public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowIn
283283
fabParams.bottomMargin = allInsets.bottom;
284284
navigationWrapper.floatingActionButton.setLayoutParams(fabParams);
285285
}
286+
} else {
287+
ViewGroup.MarginLayoutParams navRailParams = (ViewGroup.MarginLayoutParams)
288+
navigationWrapper.navigationRailView.getLayoutParams();
289+
navRailParams.bottomMargin = allInsets.bottom;
290+
navRailParams.setMarginStart(allInsets.left);
291+
navigationWrapper.navigationRailView.setLayoutParams(navRailParams);
286292
}
287293

288294
if (navigationWrapper.bottomAppBar != null) {
@@ -301,10 +307,14 @@ public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowIn
301307
View toolbar = binding.includedAppBar.toolbar;
302308
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
303309
params.topMargin = allInsets.top;
304-
params.setMarginStart(params.getMarginStart() + allInsets.left);
305-
params.setMarginEnd(params.getMarginEnd() + allInsets.right);
310+
params.setMarginStart(allInsets.left);
311+
params.setMarginEnd(allInsets.right);
306312
toolbar.setLayoutParams(params);
307313

314+
binding.includedAppBar.tabLayoutMainActivity.setPadding(
315+
allInsets.left, 0, allInsets.right, 0
316+
);
317+
308318
return WindowInsetsCompat.CONSUMED;
309319
}
310320
});

0 commit comments

Comments
 (0)