diff --git a/app/src/debug/res/values/donottranslate.xml b/app/src/debug/res/values/donottranslate.xml new file mode 100644 index 00000000..879226a3 --- /dev/null +++ b/app/src/debug/res/values/donottranslate.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file 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 5f80b71e..dd325878 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 @@ -22,8 +22,6 @@ import android.view.ViewTreeObserver import android.widget.FrameLayout import androidx.core.view.ViewCompat import androidx.core.view.isVisible -import androidx.core.view.updateLayoutParams -import androidx.core.view.updatePadding import androidx.fragment.app.Fragment import androidx.fragment.app.commit import code.name.monkey.appthemehelper.util.ColorUtil @@ -118,6 +116,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() { super.onCreate(savedInstanceState) binding = createContentView() setContentView(binding.root) + binding.bottomNavigationView.drawAboveNavBarWithPadding() chooseFragmentForTheme() setupSlidingUpPanel() setupBottomSheet() @@ -128,13 +127,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() { println("dimBackground") collapsePanel() } - binding.bottomNavigationView.apply { - val navbarHeight = RetroUtil.getNavigationBarHeight() - updatePadding(bottom = navbarHeight) - binding.bottomNavigationView.updateLayoutParams { - height = dip(R.dimen.bottom_nav_height) + navbarHeight - } - } } private fun setupBottomSheet() { @@ -280,6 +272,13 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() { } fun setBottomBarVisibility(visible: Boolean) { + if (!(visible && binding.bottomNavigationView.isVisible)) { + if (visible) { + binding.bottomNavigationView.translateYAnimate(0F) + } else { + binding.bottomNavigationView.translateYAnimate(dip(R.dimen.bottom_nav_height).toFloat()) + } + } binding.bottomNavigationView.isVisible = visible hideBottomBar(MusicPlayerRemote.playingQueue.isEmpty()) } @@ -313,7 +312,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() { libraryViewModel.setFabMargin(heightOfBar - RetroUtil.getNavigationBarHeight()) } } - bottomSheetBehavior.setAllowDragging(true) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/extensions/FragmentExt.kt b/app/src/main/java/code/name/monkey/retromusic/extensions/FragmentExt.kt index 27610f53..3bac3826 100644 --- a/app/src/main/java/code/name/monkey/retromusic/extensions/FragmentExt.kt +++ b/app/src/main/java/code/name/monkey/retromusic/extensions/FragmentExt.kt @@ -14,15 +14,13 @@ */ package code.name.monkey.retromusic.extensions +import android.app.Activity import android.content.Context import android.content.res.Configuration import android.graphics.drawable.Drawable import android.os.PowerManager import android.widget.Toast -import androidx.annotation.DrawableRes -import androidx.annotation.IdRes -import androidx.annotation.IntegerRes -import androidx.annotation.StringRes +import androidx.annotation.* import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.content.res.AppCompatResources import androidx.fragment.app.Fragment @@ -101,4 +99,8 @@ fun Fragment.getDrawableCompat(@DrawableRes drawableRes: Int): Drawable { fun Fragment.applyToolbar(toolbar: MaterialToolbar) { (requireActivity() as AppCompatActivity).applyToolbar(toolbar) +} + +fun Fragment.dip(@DimenRes id: Int): Int { + return resources.getDimensionPixelSize(id) } \ No newline at end of file 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 b5c8ad4f..1ea708d7 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 @@ -19,15 +19,20 @@ import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.ViewGroup.MarginLayoutParams import android.view.ViewTreeObserver import android.view.inputmethod.InputMethodManager import android.widget.EditText import androidx.annotation.LayoutRes import androidx.core.animation.doOnEnd import androidx.core.animation.doOnStart +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updateLayoutParams import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.util.PreferenceUtil +import com.afollestad.materialdialogs.utils.MDUtil.updatePadding import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.imageview.ShapeableImageView import com.google.android.material.shape.ShapeAppearanceModel @@ -124,4 +129,52 @@ fun ShapeableImageView.setCircleShape(boolean: Boolean) { val radius = width / 2f shapeAppearanceModel = ShapeAppearanceModel().withCornerSize(radius) } +} + + +/** + * This will draw our view above the navigation bar instead of behind it by adding margins. + */ +fun View.drawAboveNavBar() { + ViewCompat.setOnApplyWindowInsetsListener( + (this) + ) { v: View, insets: WindowInsetsCompat -> + v.updateLayoutParams { + bottomMargin = + insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom + } + insets + } +} + +/** + * This will draw our view above the navigation bar instead of behind it by adding padding. + */ +fun View.drawAboveNavBarWithPadding() { + ViewCompat.setOnApplyWindowInsetsListener( + (this) + ) { v: View, insets: WindowInsetsCompat -> + val navBarHeight = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom + v.updatePadding(bottom = navBarHeight) + insets + } + requestApplyInsetsWhenAttached() +} + +fun View.requestApplyInsetsWhenAttached() { + if (isAttachedToWindow) { + // We're already attached, just request as normal + requestApplyInsets() + } else { + // We're not attached to the hierarchy, add a listener to + // request when we are + addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener { + override fun onViewAttachedToWindow(v: View) { + v.removeOnAttachStateChangeListener(this) + v.requestApplyInsets() + } + + override fun onViewDetachedFromWindow(v: View) = Unit + }) + } } \ No newline at end of file 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 c38c343a..cda1b1a3 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 @@ -33,8 +33,8 @@ import code.name.monkey.retromusic.databinding.FragmentMainRecyclerBinding import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog import code.name.monkey.retromusic.extensions.accentColor +import code.name.monkey.retromusic.extensions.dip import code.name.monkey.retromusic.helper.MusicPlayerRemote -import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.ThemedFastScroller.create import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.transition.MaterialSharedAxis @@ -159,10 +159,10 @@ abstract class AbsRecyclerViewFragment, LM : Recycle val itemCount: Int = adapter?.itemCount ?: 0 if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) { - val height = DensityUtil.dip2px(requireContext(), 112f) + val height = dip(R.dimen.mini_player_height_expanded) binding.recyclerView.updatePadding(0, 0, 0, height) } else { - val height = DensityUtil.dip2px(requireContext(), 56f) + val height = dip(R.dimen.mini_player_height) binding.recyclerView.updatePadding(0, 0, 0, height) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/other/LyricsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/other/LyricsFragment.kt index b86785ee..78d684cc 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/other/LyricsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/other/LyricsFragment.kt @@ -26,6 +26,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.activities.MainActivity import code.name.monkey.retromusic.activities.tageditor.WriteTagsAsyncTask import code.name.monkey.retromusic.databinding.FragmentLyricsBinding import code.name.monkey.retromusic.databinding.FragmentNormalLyricsBinding @@ -361,5 +362,8 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) { } } - + override fun onDestroyView() { + super.onDestroyView() + (requireActivity() as MainActivity).expandPanel() + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt index 382d65f5..c556f1ed 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt @@ -21,6 +21,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentAdaptivePlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.extensions.surfaceColor import code.name.monkey.retromusic.extensions.textColorPrimary import code.name.monkey.retromusic.extensions.textColorSecondary @@ -47,7 +48,7 @@ class AdaptiveFragment : AbsPlayerFragment(R.layout.fragment_adaptive_player) { _binding = FragmentAdaptivePlayerBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(binding.root) + binding.root.drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt index 654e35fd..87e733e1 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt @@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.NEW_BLUR_AMOUNT import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentBlurBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.glide.BlurTransformation @@ -56,7 +57,7 @@ class BlurPlayerFragment : AbsPlayerFragment(R.layout.fragment_blur), _binding = FragmentBlurBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(binding.playerToolbar) + binding.playerToolbar.drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt index 172d03bf..c5650883 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt @@ -21,12 +21,12 @@ import androidx.appcompat.widget.Toolbar import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentCardPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.color.MediaNotificationProcessor class CardFragment : AbsPlayerFragment(R.layout.fragment_card_player) { @@ -83,7 +83,7 @@ class CardFragment : AbsPlayerFragment(R.layout.fragment_card_player) { _binding = FragmentCardPlayerBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(binding.playbackControlsFragment.parent as View) + (binding.playbackControlsFragment.parent as View).drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt index 4c02f776..2315fd48 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt @@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.NEW_BLUR_AMOUNT import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentCardBlurPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment @@ -94,7 +95,7 @@ class CardBlurFragment : AbsPlayerFragment(R.layout.fragment_card_blur_player), _binding = FragmentCardBlurPlayerBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(binding.cardContainer) + binding.cardContainer?.drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt index 80a26abd..ef457339 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt @@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentColorPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -115,7 +116,7 @@ class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) { val playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment playerAlbumCoverFragment.setCallbacks(this) - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt index 81f358b0..2b3ca3b2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt @@ -21,6 +21,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentFitBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -86,7 +87,7 @@ class FitFragment : AbsPlayerFragment(R.layout.fragment_fit) { _binding = FragmentFitBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt index 4c2dedea..02ac580a 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt @@ -26,6 +26,7 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentFlatPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -91,7 +92,7 @@ class FlatPlayerFragment : AbsPlayerFragment(R.layout.fragment_flat_player) { _binding = FragmentFlatPlayerBinding.bind(view) setUpPlayerToolbar() setUpSubFragments() - RetroUtil.drawAboveNavBar(binding.playbackControlsFragment) + binding.playbackControlsFragment.drawAboveNavBar() } override fun onShow() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt index c8ce6fd3..d170c4bd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt @@ -21,6 +21,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentMaterialBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment @@ -94,7 +95,7 @@ class MaterialFragment : AbsPlayerFragment(R.layout.fragment_material) { _binding = FragmentMaterialBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt index c7b082ae..fef43e76 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt @@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -121,7 +122,7 @@ class PlayerFragment : AbsPlayerFragment(R.layout.fragment_player) { _binding = FragmentPlayerBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } override fun onDestroyView() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt index 429aea36..84fea266 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt @@ -21,6 +21,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentPlainPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.base.goToAlbum import code.name.monkey.retromusic.fragments.base.goToArtist @@ -85,7 +86,7 @@ class PlainPlayerFragment : AbsPlayerFragment(R.layout.fragment_plain_player) { binding.text.setOnClickListener { goToArtist(requireActivity()) } - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt index 05c03ee8..16444734 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt @@ -21,6 +21,7 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentSimplePlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -52,7 +53,7 @@ class SimplePlayerFragment : AbsPlayerFragment(R.layout.fragment_simple_player) _binding = FragmentSimplePlayerBinding.bind(view) setUpSubFragments() setUpPlayerToolbar() - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt index 50b6ddcc..a7393646 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt @@ -27,6 +27,7 @@ import androidx.appcompat.widget.Toolbar import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.databinding.FragmentTinyPlayerBinding +import code.name.monkey.retromusic.extensions.drawAboveNavBar import code.name.monkey.retromusic.extensions.hide import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment @@ -39,7 +40,6 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil -import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlin.math.abs @@ -148,7 +148,7 @@ class TinyPlayerFragment : AbsPlayerFragment(R.layout.fragment_tiny_player), binding.text.setOnClickListener { goToArtist(requireActivity()) } - RetroUtil.drawAboveNavBar(playerToolbar()) + playerToolbar().drawAboveNavBar() } private fun setUpSubFragments() { diff --git a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java index a68c3a87..bda9b0b9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java @@ -231,31 +231,6 @@ public class RetroUtil { window.setStatusBarColor(Color.TRANSPARENT); } - /** - * This will draw our view above the navigation bar instead of behind it by adding margins. - * - * @param view view to draw above Navigation Bar - */ - public static void drawAboveNavBar(View view) { - ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> { - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); - params.bottomMargin = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom; - return WindowInsetsCompat.CONSUMED; - }); - } - - /** - * This will draw our view above the navigation bar instead of behind it by adding padding. - * - * @param view view to draw above Navigation Bar - */ - public static void drawAboveNavBarWithPadding(View view) { - ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> { - v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom); - return WindowInsetsCompat.CONSUMED; - }); - } - public static String getIpAddress(boolean useIPv4) { try { List interfaces = diff --git a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt index 99a91e59..14b96c28 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt +++ b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt @@ -49,7 +49,7 @@ class BottomNavigationBarTinted @JvmOverloads constructor( accentColor ) itemRippleColor = ColorStateList.valueOf(accentColor.addAlpha(0.08F)) - background = ColorDrawable(ATHUtil.resolveColor(context, R.attr.colorSurface)) + background = ColorDrawable(ATHUtil.resolveColor(context, R.attr.bottomSheetTint)) itemActiveIndicatorColor = ColorStateList.valueOf(accentColor.addAlpha(0.12F)) } } diff --git a/app/src/main/res/layout/fragment_main_recycler.xml b/app/src/main/res/layout/fragment_main_recycler.xml index 2c2174b6..1c1478b7 100644 --- a/app/src/main/res/layout/fragment_main_recycler.xml +++ b/app/src/main/res/layout/fragment_main_recycler.xml @@ -49,7 +49,6 @@ app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" tools:listitem="@layout/item_list" /> - diff --git a/app/src/main/res/layout/home_content.xml b/app/src/main/res/layout/home_content.xml index 77f3e86f..11f3da0d 100644 --- a/app/src/main/res/layout/home_content.xml +++ b/app/src/main/res/layout/home_content.xml @@ -74,7 +74,7 @@ + android:layout_height="@dimen/mini_player_height_expanded" /> \ No newline at end of file diff --git a/app/src/main/res/layout/sliding_music_panel_layout.xml b/app/src/main/res/layout/sliding_music_panel_layout.xml index 9b40ae73..80bc7b2a 100644 --- a/app/src/main/res/layout/sliding_music_panel_layout.xml +++ b/app/src/main/res/layout/sliding_music_panel_layout.xml @@ -8,6 +8,7 @@ \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index ad6663c7..b44662d3 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -13,6 +13,12 @@ 8dp 56dp + 64dp + + 120dp + 128dp + + 64dp 96dp 96dp @@ -34,8 +40,6 @@ 12dp 32dp - 136dp - 144dp 8dp 48dp 52dp @@ -52,6 +56,4 @@ 18sp 10dp 20dp - 64dp - 80dp