diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
index e1cb26e4..3240d5ff 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
@@ -313,7 +313,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
bottomNavAnimator?.end()
bottomNavAnimator = binding.bottomNavigationView.translateYAnimate(0F)
binding.bottomNavigationView.bringToFront()
- libraryViewModel.setFabMargin(heightOfBarWithTabs - windowInsets.safeGetBottomInsets())
+ libraryViewModel.setFabMargin(heightOfBarWithTabs - 2 * windowInsets.safeGetBottomInsets())
} else {
println("Details")
bottomSheetBehavior.peekHeightAnimate(heightOfBar)
@@ -323,7 +323,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
bottomNavAnimator?.doOnEnd {
binding.slidingPanel.bringToFront()
}
- libraryViewModel.setFabMargin(heightOfBar - windowInsets.safeGetBottomInsets())
+ libraryViewModel.setFabMargin(heightOfBar - 2 * windowInsets.safeGetBottomInsets())
}
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt b/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt
index 050fb1e8..6ea76dae 100644
--- a/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt
@@ -24,11 +24,11 @@ import android.view.ViewGroup.MarginLayoutParams
import android.view.ViewTreeObserver
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
+import android.widget.FrameLayout
import androidx.annotation.LayoutRes
import androidx.core.animation.doOnEnd
import androidx.core.animation.doOnStart
import androidx.core.view.*
-import androidx.core.view.WindowInsetsCompat.Type.navigationBars
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.util.PreferenceUtil
@@ -191,17 +191,16 @@ fun View.requestApplyInsetsWhenAttached() {
}
}
-fun AppBarLayout.drawNextToNavbar() {
- val initialMargin = recordInitialMarginForView(this)
+fun View.drawNextToNavbar() {
+ val initialPadding = recordInitialPaddingForView(this)
ViewCompat.setOnApplyWindowInsetsListener(
(this)
) { v: View, windowInsets: WindowInsetsCompat ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
v.updatePadding(
- top = initialMargin.top + insets.top,
- left = initialMargin.left + insets.left,
- right = initialMargin.right + insets.right
+ left = initialPadding.left + insets.left,
+ right = initialPadding.right + insets.right
)
windowInsets
}
@@ -228,7 +227,7 @@ data class InitialMargin(
val right: Int, val bottom: Int
)
-private fun recordInitialMarginForView(view: View) = InitialMargin(
+fun recordInitialMarginForView(view: View) = InitialMargin(
view.marginLeft, view.marginTop, view.marginRight, view.marginBottom
)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsRecyclerViewFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsRecyclerViewFragment.kt
index 0e21dde2..52ca25e2 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsRecyclerViewFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsRecyclerViewFragment.kt
@@ -64,9 +64,6 @@ abstract class AbsRecyclerViewFragment, LM : Recycle
initAdapter()
setUpRecyclerView()
setupToolbar()
- binding.appBarLayout.statusBarForeground =
- MaterialShapeDrawable.createWithElevationOverlay(requireContext())
-
// Add listeners when shuffle is visible
if (isShuffleVisible) {
binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
@@ -95,7 +92,6 @@ abstract class AbsRecyclerViewFragment, LM : Recycle
bottomMargin = it
}
})
- binding.appBarLayout.drawNextToNavbar()
}
open fun onShuffleClicked() {
@@ -117,6 +113,9 @@ abstract class AbsRecyclerViewFragment, LM : Recycle
}
val appName = resources.getString(titleRes)
binding.appNameText.text = appName
+ binding.toolbarContainer.drawNextToNavbar()
+ binding.appBarLayout.statusBarForeground =
+ MaterialShapeDrawable.createWithElevationOverlay(requireContext())
}
abstract val titleRes: Int
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/folder/FoldersFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/folder/FoldersFragment.kt
index 68bcb282..25241d1d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/folder/FoldersFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/folder/FoldersFragment.kt
@@ -124,7 +124,7 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
}
}
})
- binding.appBarLayout.drawNextToNavbar()
+ binding.toolbarContainer.drawNextToNavbar()
}
private fun setUpTitle() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/home/HomeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/home/HomeFragment.kt
index 0d7bd31a..15464ef5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/home/HomeFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/home/HomeFragment.kt
@@ -76,7 +76,7 @@ class HomeFragment :
view.doOnPreDraw { startPostponedEnterTransition() }
binding.appBarLayout.statusBarForeground =
MaterialShapeDrawable.createWithElevationOverlay(requireContext())
- binding.appBarLayout.drawNextToNavbar()
+ binding.toolbar.drawNextToNavbar()
}
private fun setupListeners() {
diff --git a/app/src/main/res/layout/fragment_user_info.xml b/app/src/main/res/layout/fragment_user_info.xml
index 4a547741..1f222aac 100644
--- a/app/src/main/res/layout/fragment_user_info.xml
+++ b/app/src/main/res/layout/fragment_user_info.xml
@@ -94,6 +94,7 @@
android:layout_gravity="bottom"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="70dp"
+ android:fitsSystemWindows="false"
android:gravity="center"
android:text="@string/save"
app:icon="@drawable/ic_save"
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index dadb45e8..58bac87f 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -191,7 +191,6 @@