Skip to content

Commit

Permalink
Label padding fix on bottomsheet after updating dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosPaha01 committed Mar 8, 2022
1 parent 249b64a commit ccd931d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.dertyp7214.rboardthememanager.core

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.os.Handler
Expand All @@ -18,6 +19,7 @@ fun Context.getAttr(@AttrRes attr: Int): Int {
return typedValue.data
}

@SuppressLint("DiscouragedApi")
fun Context.getNavigationBarHeight(): Int {
val resourceId: Int = resources.getIdentifier("navigation_bar_height", "dimen", "android")
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class MainActivity : AppCompatActivity() {
searchBar.menuVisible = !preferences.getBoolean("demo_shown", false)

navigation.setHeight((resources.getDimension(R.dimen.bottomBarHeight) + getNavigationBarHeight()).roundToInt())
navigation.itemPaddingBottom = 8.dpToPx(this).toInt()

val reloadThemesLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
Expand Down Expand Up @@ -230,14 +231,14 @@ class MainActivity : AppCompatActivity() {

binding.fragmentContainerView.setMargin(
bottomMargin = resources.getDimension(R.dimen.bottomBarHeight)
.toInt() + 18.dpToPx(this)
.toInt() + 28.dpToPx(this)
.toInt() + getNavigationBarHeight()
)

bottomSheetBehavior.isFitToContents = true
bottomSheetBehavior.skipCollapsed = true
bottomSheetBehavior.peekHeight =
resources.getDimension(R.dimen.bottomBarHeight).toInt() + 8.dpToPx(this)
resources.getDimension(R.dimen.bottomBarHeight).toInt() + 18.dpToPx(this)
.toInt() + getNavigationBarHeight()
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED

Expand Down

0 comments on commit ccd931d

Please sign in to comment.