Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
app: Optimize Fab bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Apr 28, 2024
1 parent 4153779 commit 052e327
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,16 @@ class MainActivity : AppCompatActivity() {
if (AppUtils.atLeast(Build.VERSION_CODES.R)) {
mainContentBinding.downloadInfo.setOnApplyWindowInsetsListener { _, insets ->
mainContentBinding.downloadInfo.layoutParams.apply {
// View bottom margin + Fab bottom height + Fab bottom margin + System gestures height.
// Bottom margin + System gestures height.
(this as LinearLayout.LayoutParams).bottomMargin =
18.dp + 56.dp + if (isLandscape()) 32.dp else 24.dp + insets.getInsets(WindowInsets.Type.systemGestures()).bottom
if (isLandscape()) 32.dp else 24.dp + insets.getInsets(WindowInsets.Type.systemGestures()).bottom
}
insets
}
} else {
mainContentBinding.downloadInfo.layoutParams.apply {
// View bottom margin + Fab bottom height + Fab bottom margin + Fixed spacing.
(this as LinearLayout.LayoutParams).bottomMargin = 18.dp + 56.dp + if (isLandscape()) 32.dp else 24.dp + 46.dp
// Bottom margin + Fixed spacing.
(this as LinearLayout.LayoutParams).bottomMargin = if (isLandscape()) 32.dp else 24.dp + 46.dp
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
android:textColor="?attr/colorOnSecondaryContainer"
app:backgroundTint="?attr/colorSecondaryContainer"
app:icon="@drawable/ic_check"
app:iconTint="?attr/colorOnSecondaryContainer" />
app:iconTint="?attr/colorOnSecondaryContainer"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
android:textColor="?attr/colorOnSecondaryContainer"
app:backgroundTint="?attr/colorSecondaryContainer"
app:icon="@drawable/ic_check"
app:iconTint="?attr/colorOnSecondaryContainer" />
app:iconTint="?attr/colorOnSecondaryContainer"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit 052e327

Please sign in to comment.