Better Edge-to-edge support & fixed some visual glitches
This commit is contained in:
parent
50c7d4aeb7
commit
e0b3960374
27 changed files with 124 additions and 73 deletions
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
package code.name.monkey.retromusic.fragments
|
||||
|
||||
import android.animation.ValueAnimator
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.*
|
||||
import code.name.monkey.retromusic.*
|
||||
|
@ -42,7 +43,7 @@ class LibraryViewModel(
|
|||
private val legacyPlaylists = MutableLiveData<List<Playlist>>()
|
||||
private val genres = MutableLiveData<List<Genre>>()
|
||||
private val searchResults = MutableLiveData<List<Any>>()
|
||||
private val fabMargin = MutableLiveData(0)
|
||||
private val fabMargin = MutableLiveData<Int>(0)
|
||||
val paletteColor: LiveData<Int> = _paletteColor
|
||||
|
||||
init {
|
||||
|
@ -337,11 +338,18 @@ class LibraryViewModel(
|
|||
}
|
||||
|
||||
fun setFabMargin(bottomMargin: Int) {
|
||||
fabMargin.postValue(
|
||||
// Normal Margin
|
||||
DensityUtil.dip2px(App.getContext(), 16F) +
|
||||
bottomMargin
|
||||
)
|
||||
val currentValue = DensityUtil.dip2px(App.getContext(), 16F) +
|
||||
bottomMargin
|
||||
if (currentValue != fabMargin.value) {
|
||||
ValueAnimator.ofInt(fabMargin.value!!, currentValue).apply {
|
||||
addUpdateListener {
|
||||
fabMargin.postValue(
|
||||
it.animatedValue as Int
|
||||
)
|
||||
}
|
||||
start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
|
|||
// insets are not passed to child views
|
||||
// https://github.com/material-components/material-components-android/issues/1310
|
||||
if (!RetroUtil.isLandscape()) {
|
||||
binding.root.updatePadding(bottom = RetroUtil.getNavigationBarHeight())
|
||||
binding.aboutContent.root.updatePadding(bottom = RetroUtil.getNavigationBarHeight())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import androidx.appcompat.widget.Toolbar
|
|||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||
|
@ -161,11 +160,9 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
|
|||
val itemCount: Int = adapter?.itemCount ?: 0
|
||||
|
||||
if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
||||
val height = dip(R.dimen.mini_player_height_expanded)
|
||||
binding.recyclerView.updatePadding(0, 0, 0, height)
|
||||
binding.recyclerView.updatePadding(bottom = dip(R.dimen.mini_player_height_expanded))
|
||||
} else {
|
||||
val height = dip(R.dimen.mini_player_height)
|
||||
binding.recyclerView.updatePadding(0, 0, 0, height)
|
||||
binding.recyclerView.updatePadding(bottom = dip(R.dimen.mini_player_height))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
override fun onChanged() {
|
||||
super.onChanged()
|
||||
val height = dipToPix(52f)
|
||||
binding.recyclerView.setPadding(0, 0, 0, height.toInt())
|
||||
binding.recyclerView.updatePadding(bottom = height.toInt())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
if (RetroUtil.isTablet()) {
|
||||
return if (RetroUtil.isLandscape()) 6 else 4
|
||||
}
|
||||
return 2
|
||||
return if (RetroUtil.isLandscape()) 4 else 2
|
||||
}
|
||||
|
||||
override fun onArtist(artistId: Long, view: View) {
|
||||
|
|
|
@ -379,6 +379,7 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
|||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
(requireActivity() as MainActivity).expandPanel()
|
||||
if (MusicPlayerRemote.playingQueue.isNotEmpty())
|
||||
(requireActivity() as MainActivity).expandPanel()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
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.activities.MainActivity
|
||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||
import code.name.monkey.retromusic.databinding.FragmentPlayingQueueBinding
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
|
@ -172,6 +174,8 @@ class PlayingQueueFragment : AbsMusicServiceFragment(R.layout.fragment_playing_q
|
|||
}
|
||||
playingQueueAdapter = null
|
||||
super.onDestroy()
|
||||
if (MusicPlayerRemote.playingQueue.isNotEmpty())
|
||||
(requireActivity() as MainActivity).expandPanel()
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
|
@ -191,6 +195,7 @@ class PlayingQueueFragment : AbsMusicServiceFragment(R.layout.fragment_playing_q
|
|||
findNavController().navigateUp()
|
||||
}
|
||||
setNavigationIcon(R.drawable.ic_keyboard_backspace_black)
|
||||
ToolbarContentTintHelper.colorBackButton(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
|||
import code.name.monkey.retromusic.views.addAlpha
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.chip.ChipGroup
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.transition.MaterialSharedAxis
|
||||
import java.util.*
|
||||
|
@ -96,6 +97,8 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
|
|||
bottomMargin = it
|
||||
}
|
||||
})
|
||||
binding.appBarLayout.statusBarForeground =
|
||||
MaterialShapeDrawable.createWithElevationOverlay(requireContext())
|
||||
}
|
||||
|
||||
private fun setupChips() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue