Merge pull request #1173 from prathameshmm02/dev

Fixed some bugs & visual inconsistencies
main
Daksh P. Jain 2021-11-25 16:52:17 +05:30 committed by GitHub
commit be460124ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 221 additions and 158 deletions

View File

@ -9,14 +9,14 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 31 targetSdkVersion 30
renderscriptTargetApi 29//must match target sdk and build tools renderscriptTargetApi 29//must match target sdk and build tools
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 10543 versionCode 10544
versionName '5.4.0 ' + "_" + getDate() versionName '5.4.1 ' + "_" + getDate()
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"") buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
} }
@ -110,7 +110,7 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
def room_version = "2.3.0" def room_version = '2.4.0-beta02'
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version" kapt "androidx.room:room-compiler:$room_version"
@ -154,7 +154,7 @@ dependencies {
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5' implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3' implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
implementation 'com.anjlab.android.iab.v3:library:2.0.1' implementation 'com.anjlab.android.iab.v3:library:2.0.3'
implementation 'com.r0adkll:slidableactivity:2.1.0' implementation 'com.r0adkll:slidableactivity:2.1.0'
implementation 'com.heinrichreimersoftware:material-intro:2.0.0' implementation 'com.heinrichreimersoftware:material-intro:2.0.0'
implementation 'com.github.dhaval2404:imagepicker:1.7.1' implementation 'com.github.dhaval2404:imagepicker:1.7.1'

View File

@ -64,7 +64,7 @@
<body> <body>
<div> <div>
<h5>Date</h5> <h5>Date</h5>
<h2>v5.1.0<span class="tag"><i>Beta</i></span></h2> <h2>v5.4.0<span class="tag"><i>Beta</i></span></h2>
<h3>What's New</h3> <h3>What's New</h3>
<ul> <ul>
<li><b>Material You</b></li> <li><b>Material You</b></li>
@ -73,6 +73,7 @@
</ul> </ul>
<h3>Improved</h3> <h3>Improved</h3>
<ul> <ul>
<li>Improved Animations</li>
<li>Improved Crossfade</li> <li>Improved Crossfade</li>
</ul> </ul>
</div> </div>

View File

@ -129,7 +129,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
if (RetroUtil.isLandscape()) { if (RetroUtil.isLandscape()) {
binding.slidingPanel.drawAboveSystemBarsWithPadding(true) binding.slidingPanel.drawAboveSystemBarsWithPadding(true)
} }
binding.fragmentContainer.addBottomInsets()
chooseFragmentForTheme() chooseFragmentForTheme()
setupSlidingUpPanel() setupSlidingUpPanel()
setupBottomSheet() setupBottomSheet()
@ -235,7 +234,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
super.onQueueChanged() super.onQueueChanged()
// Mini player should be hidden in Playing Queue // Mini player should be hidden in Playing Queue
// it may pop up if hideBottomSheet is called // it may pop up if hideBottomSheet is called
if (currentFragment(R.id.fragment_container) !is PlayingQueueFragment) { if (currentFragment(R.id.fragment_container) !is PlayingQueueFragment &&
bottomSheetBehavior.state != STATE_EXPANDED
) {
hideBottomSheet(MusicPlayerRemote.playingQueue.isEmpty()) hideBottomSheet(MusicPlayerRemote.playingQueue.isEmpty())
} }
} }
@ -350,7 +351,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
binding.bottomNavigationView.translationY = 0F binding.bottomNavigationView.translationY = 0F
} }
binding.bottomNavigationView.bringToFront() binding.bottomNavigationView.bringToFront()
libraryViewModel.setFabMargin(heightOfBarWithTabs - 2 * windowInsets.safeGetBottomInsets()) libraryViewModel.setFabMargin(dip(R.dimen.mini_player_height_expanded))
} else { } else {
println("Details") println("Details")
if (animate) { if (animate) {
@ -367,7 +368,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
dip(R.dimen.bottom_nav_height).toFloat() dip(R.dimen.bottom_nav_height).toFloat()
binding.slidingPanel.bringToFront() binding.slidingPanel.bringToFront()
} }
libraryViewModel.setFabMargin(heightOfBar - 2 * windowInsets.safeGetBottomInsets()) libraryViewModel.setFabMargin(dip(R.dimen.mini_player_height))
} }
} }
} }

View File

@ -44,6 +44,7 @@ import code.name.monkey.retromusic.util.RetroColorUtil.getColor
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.target.ImageViewTarget import com.bumptech.glide.request.target.ImageViewTarget
import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.request.transition.Transition
import com.google.android.material.shape.MaterialShapeDrawable
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import java.util.* import java.util.*
@ -101,8 +102,9 @@ class AlbumTagEditorActivity : AbsTagEditorActivity<ActivityAlbumTagEditorBindin
private var deleteAlbumArt: Boolean = false private var deleteAlbumArt: Boolean = false
private fun setupToolbar() { private fun setupToolbar() {
binding.toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(binding.toolbar) setSupportActionBar(binding.toolbar)
binding.appBarLayout?.statusBarForeground =
MaterialShapeDrawable.createWithElevationOverlay(this)
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -21,13 +21,12 @@ import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.LayoutInflater import android.view.LayoutInflater
import android.widget.ImageView import android.widget.ImageView
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.databinding.ActivitySongTagEditorBinding import code.name.monkey.retromusic.databinding.ActivitySongTagEditorBinding
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.setTint import code.name.monkey.retromusic.extensions.setTint
import code.name.monkey.retromusic.repository.SongRepository import code.name.monkey.retromusic.repository.SongRepository
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import com.google.android.material.shape.MaterialShapeDrawable
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.util.* import java.util.*
@ -44,8 +43,9 @@ class SongTagEditorActivity : AbsTagEditorActivity<ActivitySongTagEditorBinding>
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setUpViews() setUpViews()
setNoImageMode() setNoImageMode()
binding.toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(binding.toolbar) setSupportActionBar(binding.toolbar)
binding.appBarLayout.statusBarForeground =
MaterialShapeDrawable.createWithElevationOverlay(this)
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")

View File

@ -90,9 +90,9 @@ class DeleteSongsDialog : DialogFragment() {
if ((songs.size == 1) && MusicPlayerRemote.isPlaying(songs[0])) { if ((songs.size == 1) && MusicPlayerRemote.isPlaying(songs[0])) {
MusicPlayerRemote.playNextSong() MusicPlayerRemote.playNextSong()
} }
if (VersionUtils.hasQ()) { if (VersionUtils.hasR()) {
dismiss() dismiss()
MusicUtil.deleteTracksQ(requireActivity(), songs) MusicUtil.deleteTracksR(requireActivity(), songs)
reloadTabs() reloadTabs()
} else if (!SAFUtil.isSAFRequiredForSongs(songs)) { } else if (!SAFUtil.isSAFRequiredForSongs(songs)) {
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {

View File

@ -138,7 +138,7 @@ class SleepTimerDialog : DialogFragment() {
} }
private fun makeTimerPendingIntent(flag: Int): PendingIntent? { private fun makeTimerPendingIntent(flag: Int): PendingIntent? {
return PendingIntent.getService(requireActivity(), 0, makeTimerIntent(), flag) return PendingIntent.getService(requireActivity(), 0, makeTimerIntent(), flag or PendingIntent.FLAG_IMMUTABLE)
} }
private fun makeTimerIntent(): Intent { private fun makeTimerIntent(): Intent {

View File

@ -237,6 +237,6 @@ data class InitialPadding(
val right: Int, val bottom: Int val right: Int, val bottom: Int
) )
private fun recordInitialPaddingForView(view: View) = InitialPadding( fun recordInitialPaddingForView(view: View) = InitialPadding(
view.paddingLeft, view.paddingTop, view.paddingRight, view.paddingBottom view.paddingLeft, view.paddingTop, view.paddingRight, view.paddingBottom
) )

View File

@ -14,6 +14,7 @@
*/ */
package code.name.monkey.retromusic.fragments package code.name.monkey.retromusic.fragments
import android.animation.ValueAnimator
import android.widget.Toast import android.widget.Toast
import androidx.lifecycle.* import androidx.lifecycle.*
import code.name.monkey.retromusic.* import code.name.monkey.retromusic.*
@ -42,7 +43,7 @@ class LibraryViewModel(
private val legacyPlaylists = MutableLiveData<List<Playlist>>() private val legacyPlaylists = MutableLiveData<List<Playlist>>()
private val genres = MutableLiveData<List<Genre>>() private val genres = MutableLiveData<List<Genre>>()
private val searchResults = MutableLiveData<List<Any>>() private val searchResults = MutableLiveData<List<Any>>()
private val fabMargin = MutableLiveData(0) private val fabMargin = MutableLiveData<Int>(0)
val paletteColor: LiveData<Int> = _paletteColor val paletteColor: LiveData<Int> = _paletteColor
init { init {
@ -337,11 +338,18 @@ class LibraryViewModel(
} }
fun setFabMargin(bottomMargin: Int) { fun setFabMargin(bottomMargin: Int) {
fabMargin.postValue( val currentValue = DensityUtil.dip2px(App.getContext(), 16F) +
// Normal Margin bottomMargin
DensityUtil.dip2px(App.getContext(), 16F) + if (currentValue != fabMargin.value) {
bottomMargin ValueAnimator.ofInt(fabMargin.value!!, currentValue).apply {
) addUpdateListener {
fabMargin.postValue(
it.animatedValue as Int
)
}
start()
}
}
} }
} }

View File

@ -49,7 +49,7 @@ class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
// insets are not passed to child views // insets are not passed to child views
// https://github.com/material-components/material-components-android/issues/1310 // https://github.com/material-components/material-components-android/issues/1310
if (!RetroUtil.isLandscape()) { if (!RetroUtil.isLandscape()) {
binding.root.updatePadding(bottom = RetroUtil.getNavigationBarHeight()) binding.aboutContent.root.updatePadding(bottom = RetroUtil.getNavigationBarHeight())
} }
} }

View File

@ -1,10 +1,12 @@
package code.name.monkey.retromusic.fragments.backup package code.name.monkey.retromusic.fragments.backup
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
@ -16,9 +18,11 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.backup.BackupAdapter import code.name.monkey.retromusic.adapter.backup.BackupAdapter
import code.name.monkey.retromusic.databinding.FragmentBackupBinding import code.name.monkey.retromusic.databinding.FragmentBackupBinding
import code.name.monkey.retromusic.helper.BackupHelper import code.name.monkey.retromusic.helper.BackupHelper
import code.name.monkey.retromusic.helper.sanitize
import code.name.monkey.retromusic.util.BackupUtil import code.name.monkey.retromusic.util.BackupUtil
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.input.input import com.afollestad.materialdialogs.input.input
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.io.File import java.io.File
@ -42,25 +46,16 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
backupAdapter?.swapDataset(listOf()) backupAdapter?.swapDataset(listOf())
} }
backupViewModel.loadBackups() backupViewModel.loadBackups()
setupButtons() val openFilePicker = registerForActivityResult(ActivityResultContracts.OpenDocument()) {
} lifecycleScope.launch(Dispatchers.IO) {
backupViewModel.restoreBackup(requireActivity(), requireContext().contentResolver.openInputStream(it))
private fun setupButtons() {
binding.createBackup.setOnClickListener {
MaterialDialog(requireContext()).show {
title(res = R.string.action_rename)
input(prefill = System.currentTimeMillis().toString()) { _, text ->
// Text submitted with the action button
lifecycleScope.launch {
BackupHelper.createBackup(requireContext(), text.toString())
backupViewModel.loadBackups()
}
}
positiveButton(android.R.string.ok)
negativeButton(R.string.action_cancel)
setTitle(R.string.title_new_backup)
} }
}
binding.createBackup.setOnClickListener {
showCreateBackupDialog()
}
binding.restoreBackup.setOnClickListener {
openFilePicker.launch(arrayOf("application/octet-stream"))
} }
} }
@ -76,7 +71,6 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
private fun checkIsEmpty() { private fun checkIsEmpty() {
val isEmpty = backupAdapter!!.itemCount == 0 val isEmpty = backupAdapter!!.itemCount == 0
binding.empty.isVisible = isEmpty
binding.backupTitle.isVisible = !isEmpty binding.backupTitle.isVisible = !isEmpty
binding.backupRecyclerview.isVisible = !isEmpty binding.backupRecyclerview.isVisible = !isEmpty
} }
@ -88,13 +82,31 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
} }
} }
@SuppressLint("CheckResult")
private fun showCreateBackupDialog() {
MaterialDialog(requireContext()).show {
cornerRadius(res = R.dimen.m3_card_corner_radius)
title(res = R.string.action_rename)
input(prefill = System.currentTimeMillis().toString()) { _, text ->
// Text submitted with the action button
lifecycleScope.launch {
BackupHelper.createBackup(requireContext(), text.sanitize())
backupViewModel.loadBackups()
}
}
positiveButton(android.R.string.ok)
negativeButton(R.string.action_cancel)
setTitle(R.string.title_new_backup)
}
}
override fun onBackupClicked(file: File) { override fun onBackupClicked(file: File) {
AlertDialog.Builder(requireContext()) AlertDialog.Builder(requireContext())
.setTitle(R.string.restore) .setTitle(R.string.restore)
.setMessage(R.string.restore_message) .setMessage(R.string.restore_message)
.setPositiveButton(R.string.restore) { _, _ -> .setPositiveButton(R.string.restore) { _, _ ->
lifecycleScope.launch { lifecycleScope.launch {
backupViewModel.restoreBackup(requireActivity(), file) backupViewModel.restoreBackup(requireActivity(), file.inputStream())
} }
} }
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
@ -102,6 +114,7 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
.show() .show()
} }
@SuppressLint("CheckResult")
override fun onBackupMenuClicked(file: File, menuItem: MenuItem): Boolean { override fun onBackupMenuClicked(file: File, menuItem: MenuItem): Boolean {
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.action_delete -> { R.id.action_delete -> {
@ -119,7 +132,11 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
} }
R.id.action_share -> { R.id.action_share -> {
activity?.startActivity( activity?.startActivity(
Intent.createChooser(BackupUtil.createShareFileIntent(file, requireContext()), null)) Intent.createChooser(
BackupUtil.createShareFileIntent(file, requireContext()),
null
)
)
return true return true
} }
R.id.action_rename -> { R.id.action_rename -> {

View File

@ -9,6 +9,7 @@ import code.name.monkey.retromusic.helper.BackupHelper
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.File import java.io.File
import java.io.InputStream
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -24,8 +25,8 @@ class BackupViewModel : ViewModel() {
} }
} }
suspend fun restoreBackup(activity: Activity, file: File) { suspend fun restoreBackup(activity: Activity, inputStream: InputStream?) {
BackupHelper.restoreBackup(activity, file) BackupHelper.restoreBackup(activity, inputStream)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
val intent = Intent( val intent = Intent(
activity, activity,

View File

@ -22,7 +22,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.view.doOnPreDraw import androidx.core.view.doOnPreDraw
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.common.ATHToolbarActivity 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 val itemCount: Int = adapter?.itemCount ?: 0
if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) { if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) {
val height = dip(R.dimen.mini_player_height_expanded) binding.recyclerView.updatePadding(bottom = dip(R.dimen.mini_player_height_expanded))
binding.recyclerView.updatePadding(0, 0, 0, height)
} else { } else {
val height = dip(R.dimen.mini_player_height) binding.recyclerView.updatePadding(bottom = dip(R.dimen.mini_player_height))
binding.recyclerView.updatePadding(0, 0, 0, height)
} }
} }

View File

@ -89,7 +89,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
override fun onChanged() { override fun onChanged() {
super.onChanged() super.onChanged()
val height = dipToPix(52f) 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()) { if (RetroUtil.isTablet()) {
return if (RetroUtil.isLandscape()) 6 else 4 return if (RetroUtil.isLandscape()) 6 else 4
} }
return 2 return if (RetroUtil.isLandscape()) 4 else 2
} }
override fun onArtist(artistId: Long, view: View) { override fun onArtist(artistId: Long, view: View) {

View File

@ -379,6 +379,7 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
(requireActivity() as MainActivity).expandPanel() if (MusicPlayerRemote.playingQueue.isNotEmpty())
(requireActivity() as MainActivity).expandPanel()
} }
} }

View File

@ -23,7 +23,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper 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.R
import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
import code.name.monkey.retromusic.databinding.FragmentPlayingQueueBinding import code.name.monkey.retromusic.databinding.FragmentPlayingQueueBinding
import code.name.monkey.retromusic.extensions.accentColor import code.name.monkey.retromusic.extensions.accentColor
@ -172,6 +174,8 @@ class PlayingQueueFragment : AbsMusicServiceFragment(R.layout.fragment_playing_q
} }
playingQueueAdapter = null playingQueueAdapter = null
super.onDestroy() super.onDestroy()
if (MusicPlayerRemote.playingQueue.isNotEmpty())
(requireActivity() as MainActivity).expandPanel()
} }
private fun setupToolbar() { private fun setupToolbar() {
@ -191,6 +195,7 @@ class PlayingQueueFragment : AbsMusicServiceFragment(R.layout.fragment_playing_q
findNavController().navigateUp() findNavController().navigateUp()
} }
setNavigationIcon(R.drawable.ic_keyboard_backspace_black) setNavigationIcon(R.drawable.ic_keyboard_backspace_black)
ToolbarContentTintHelper.colorBackButton(this)
} }
} }
} }

View File

@ -40,6 +40,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.addAlpha import code.name.monkey.retromusic.views.addAlpha
import com.google.android.material.chip.Chip import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup 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.textfield.TextInputEditText
import com.google.android.material.transition.MaterialSharedAxis import com.google.android.material.transition.MaterialSharedAxis
import java.util.* import java.util.*
@ -96,6 +97,8 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
bottomMargin = it bottomMargin = it
} }
}) })
binding.appBarLayout.statusBarForeground =
MaterialShapeDrawable.createWithElevationOverlay(requireContext())
} }
private fun setupChips() { private fun setupChips() {

View File

@ -66,7 +66,6 @@ abstract class AbsSettingsFragment : ATEPreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
setDivider(ColorDrawable(Color.TRANSPARENT)) setDivider(ColorDrawable(Color.TRANSPARENT))
listView.overScrollMode = View.OVER_SCROLL_NEVER
// This is a workaround as CollapsingToolbarLayout consumes insets and // This is a workaround as CollapsingToolbarLayout consumes insets and
// insets are not passed to child views // insets are not passed to child views
// https://github.com/material-components/material-components-android/issues/1310 // https://github.com/material-components/material-components-android/issues/1310

View File

@ -19,15 +19,18 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.databinding.FragmentMainSettingsBinding import code.name.monkey.retromusic.databinding.FragmentMainSettingsBinding
import code.name.monkey.retromusic.extensions.addBottomInsets
import code.name.monkey.retromusic.extensions.hide import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.RetroUtil
class MainSettingsFragment : Fragment(), View.OnClickListener { class MainSettingsFragment : Fragment(), View.OnClickListener {
@ -84,6 +87,9 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
binding.buyPremium.setTextColor(it) binding.buyPremium.setTextColor(it)
binding.diamondIcon.imageTintList = ColorStateList.valueOf(it) binding.diamondIcon.imageTintList = ColorStateList.valueOf(it)
} }
if (!RetroUtil.isLandscape()) {
binding.container.updatePadding(bottom = RetroUtil.getNavigationBarHeight())
}
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -15,7 +15,7 @@ import java.util.zip.ZipOutputStream
object BackupHelper { object BackupHelper {
suspend fun createBackup(context: Context, name: String) { suspend fun createBackup(context: Context, name: String) {
val backupFile = val backupFile =
File(backupRootPath + name + APPEND_EXTENSION) File(backupRootPath + File.separator + name + APPEND_EXTENSION)
if (backupFile.parentFile?.exists() != true) { if (backupFile.parentFile?.exists() != true) {
backupFile.parentFile?.mkdirs() backupFile.parentFile?.mkdirs()
} }
@ -28,7 +28,7 @@ object BackupHelper {
} }
} }
private fun zipAll(zipItems: List<ZipItem>, backupFile: File) { private suspend fun zipAll(zipItems: List<ZipItem>, backupFile: File) {
try { try {
ZipOutputStream(BufferedOutputStream(FileOutputStream(backupFile))).use { out -> ZipOutputStream(BufferedOutputStream(FileOutputStream(backupFile))).use { out ->
for (zipItem in zipItems) { for (zipItem in zipItems) {
@ -36,13 +36,17 @@ object BackupHelper {
BufferedInputStream(fi).use { origin -> BufferedInputStream(fi).use { origin ->
val entry = ZipEntry(zipItem.zipPath) val entry = ZipEntry(zipItem.zipPath)
out.putNextEntry(entry) out.putNextEntry(entry)
origin.copyTo(out, 1024) origin.copyTo(out)
} }
} }
} }
} }
} catch (exception: FileNotFoundException) { } catch (exception: FileNotFoundException) {
Toast.makeText(App.getContext(), "Couldn't create backup", Toast.LENGTH_SHORT).show() exception.printStackTrace()
withContext(Dispatchers.Main) {
Toast.makeText(App.getContext(), "Couldn't create backup", Toast.LENGTH_SHORT)
.show()
}
} }
} }
@ -72,9 +76,9 @@ object BackupHelper {
} }
} }
suspend fun restoreBackup(context: Context, file: File) { suspend fun restoreBackup(context: Context, inputStream: InputStream?) {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
ZipInputStream(FileInputStream(file)).use { ZipInputStream(inputStream).use {
var entry = it.nextEntry var entry = it.nextEntry
while (entry != null) { while (entry != null) {
if (entry.isDatabaseEntry()) restoreDatabase(context, it, entry) if (entry.isDatabaseEntry()) restoreDatabase(context, it, entry)
@ -156,4 +160,17 @@ object BackupHelper {
} }
} }
data class ZipItem(val filePath: String, val zipPath: String) data class ZipItem(val filePath: String, val zipPath: String)
fun CharSequence.sanitize(): String {
return toString().replace("/", "_")
.replace(":", "_")
.replace("*", "_")
.replace("?", "_")
.replace("\"", "_")
.replace("<", "_")
.replace(">", "_")
.replace("|", "_")
.replace("\\", "_")
.replace("&", "_")
}

View File

@ -72,6 +72,7 @@ interface Repository {
suspend fun genresHome(): Home suspend fun genresHome(): Home
suspend fun playlists(): Home suspend fun playlists(): Home
suspend fun homeSections(): List<Home> suspend fun homeSections(): List<Home>
@ExperimentalCoroutinesApi
suspend fun homeSectionsFlow(): Flow<Result<List<Home>>> suspend fun homeSectionsFlow(): Flow<Result<List<Home>>>
suspend fun playlist(playlistId: Long): Playlist suspend fun playlist(playlistId: Long): Playlist
suspend fun fetchPlaylistWithSongs(): List<PlaylistWithSongs> suspend fun fetchPlaylistWithSongs(): List<PlaylistWithSongs>

View File

@ -525,7 +525,7 @@ object MusicUtil : KoinComponent {
} }
@RequiresApi(Build.VERSION_CODES.R) @RequiresApi(Build.VERSION_CODES.R)
fun deleteTracksQ(activity: Activity, songs: List<Song>) { fun deleteTracksR(activity: Activity, songs: List<Song>) {
val pendingIntent = MediaStore.createDeleteRequest(activity.contentResolver, songs.map { val pendingIntent = MediaStore.createDeleteRequest(activity.contentResolver, songs.map {
getSongFileUri(it.id) getSongFileUri(it.id)
}) })

View File

@ -7,6 +7,7 @@ import androidx.core.content.ContextCompat
import androidx.core.content.edit import androidx.core.content.edit
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.* import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.extensions.getIntRes import code.name.monkey.retromusic.extensions.getIntRes
import code.name.monkey.retromusic.extensions.getStringOrDefault import code.name.monkey.retromusic.extensions.getStringOrDefault
@ -615,5 +616,5 @@ object PreferenceUtil {
.getInt(CROSS_FADE_DURATION, 0) .getInt(CROSS_FADE_DURATION, 0)
val materialYou val materialYou
get() = sharedPreferences.getBoolean(MATERIAL_YOU, false) get() = sharedPreferences.getBoolean(MATERIAL_YOU, VersionUtils.hasS())
} }

View File

@ -0,0 +1,23 @@
package code.name.monkey.retromusic.views.insets
import android.content.Context
import android.util.AttributeSet
import android.view.WindowInsets
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.WindowInsetsCompat
import code.name.monkey.retromusic.extensions.drawAboveSystemBarsWithPadding
import code.name.monkey.retromusic.extensions.recordInitialPaddingForView
import code.name.monkey.retromusic.extensions.requestApplyInsetsWhenAttached
import code.name.monkey.retromusic.util.RetroUtil
import com.afollestad.materialdialogs.utils.MDUtil.updatePadding
class InsetsConstraintLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
if (!RetroUtil.isLandscape())
drawAboveSystemBarsWithPadding()
}
}

View File

@ -0,0 +1,30 @@
package code.name.monkey.retromusic.views.insets
import android.content.Context
import android.util.AttributeSet
import androidx.annotation.Px
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.retromusic.extensions.drawAboveSystemBarsWithPadding
import code.name.monkey.retromusic.util.RetroUtil
class InsetsRecyclerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RecyclerView(context, attrs, defStyleAttr) {
init {
if (!RetroUtil.isLandscape())
drawAboveSystemBarsWithPadding()
}
fun updatePadding(
@Px left: Int = paddingLeft,
@Px top: Int = paddingTop,
@Px right: Int = paddingRight,
@Px bottom: Int = paddingBottom
) {
setPadding(left, top, right, bottom)
if (!RetroUtil.isLandscape())
drawAboveSystemBarsWithPadding()
}
}

View File

@ -66,7 +66,7 @@
android:transitionGroup="true" android:transitionGroup="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.constraintlayout.widget.ConstraintLayout <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout
android:id="@+id/contentContainer" android:id="@+id/contentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -152,6 +152,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageContainer" /> app:layout_constraintTop_toBottomOf="@+id/imageContainer" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -59,14 +59,12 @@
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
android:descendantFocusability="beforeDescendants" android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:transitionGroup="true" android:transitionGroup="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.constraintlayout.widget.ConstraintLayout <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout
android:id="@+id/contentContainer" android:id="@+id/contentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -119,6 +117,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleWelcome" /> app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -5,8 +5,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:orientation="vertical" android:orientation="vertical">
tools:ignore="UnusedAttribute">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"

View File

@ -59,14 +59,13 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/finish" android:id="@+id/finish"
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.Material3.Button"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="16dp"
android:paddingVertical="12dp" android:paddingVertical="12dp"
android:text="Let's go" android:text="Let's go"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
app:cornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -1,9 +1,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true">
@ -20,8 +18,7 @@
style="@style/Toolbar" style="@style/Toolbar"
app:navigationIcon="@drawable/ic_keyboard_backspace_black" app:navigationIcon="@drawable/ic_keyboard_backspace_black"
app:title="@string/action_tag_editor" app:title="@string/action_tag_editor"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
tools:ignore="UnusedAttribute" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -197,4 +197,4 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/listeners" /> app:layout_constraintTop_toBottomOf="@id/listeners" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -192,4 +192,4 @@
android:layout_height="72dp" android:layout_height="72dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/listeners" /> app:layout_constraintTop_toBottomOf="@id/listeners" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/create_backup" android:id="@+id/create_backup"
@ -60,37 +58,4 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/backup_title" /> app:layout_constraintTop_toBottomOf="@+id/backup_title" />
<LinearLayout
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/create_backup"
tools:visibility="visible">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/emptyEmoji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/empty_text_emoji"
android:textAppearance="@style/TextViewHeadline3" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/emptyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/no_backups_found"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorSecondary"
tools:visibility="visible" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -63,7 +63,7 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.constraintlayout.widget.ConstraintLayout <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout
android:id="@+id/contentContainer" android:id="@+id/contentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -149,6 +149,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageContainer" /> app:layout_constraintTop_toBottomOf="@+id/imageContainer" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -77,7 +77,7 @@
tools:visibility="visible" /> tools:visibility="visible" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <code.name.monkey.retromusic.views.insets.InsetsRecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -63,7 +63,7 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.constraintlayout.widget.ConstraintLayout <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout
android:id="@+id/contentContainer" android:id="@+id/contentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -116,7 +116,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleWelcome" /> app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -38,7 +38,7 @@
</FrameLayout> </FrameLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView <code.name.monkey.retromusic.views.insets.InsetsRecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -8,6 +8,7 @@
android:transitionGroup="true"> android:transitionGroup="true">
<LinearLayout <LinearLayout
android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

View File

@ -30,7 +30,7 @@
</FrameLayout> </FrameLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView <code.name.monkey.retromusic.views.insets.InsetsRecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -4,21 +4,20 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSurface"
app:navigationIcon="@drawable/ic_keyboard_backspace_black" app:navigationIcon="@drawable/ic_keyboard_backspace_black"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"> app:titleTextAppearance="@style/ToolbarTextAppearanceNormal">
@ -30,7 +29,7 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchView" android:id="@+id/searchView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@null" android:background="@null"
android:hint="@string/action_search" android:hint="@string/action_search"
@ -70,14 +69,6 @@
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
</com.google.android.material.appbar.MaterialToolbar> </com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -128,18 +119,16 @@
</com.google.android.material.chip.ChipGroup> </com.google.android.material.chip.ChipGroup>
</HorizontalScrollView> </HorizontalScrollView>
</com.google.android.material.appbar.AppBarLayout>
<code.name.monkey.retromusic.views.insets.InsetsRecyclerView
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView"
android:id="@+id/recyclerView" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:clipToPadding="false"
android:clipToPadding="false" android:scrollbarStyle="outsideOverlay"
android:scrollbarStyle="outsideOverlay" android:scrollbars="vertical"
android:scrollbars="vertical" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
</LinearLayout>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@android:id/empty" android:id="@android:id/empty"

View File

@ -12,7 +12,7 @@
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:fitsSystemWindows="true"
app:liftOnScroll="true"> app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -25,7 +25,7 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout <code.name.monkey.retromusic.views.insets.InsetsConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
@ -85,7 +85,7 @@
tools:text="@tools:sample/full_names" /> tools:text="@tools:sample/full_names" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </code.name.monkey.retromusic.views.insets.InsetsConstraintLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton

View File

@ -54,12 +54,11 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/button" android:id="@+id/button"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingVertical="10dp" android:paddingVertical="10dp"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
app:cornerRadius="8dp"
app:icon="@drawable/ic_history" app:icon="@drawable/ic_history"
app:iconGravity="start" app:iconGravity="start"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -241,7 +241,7 @@
<string name="no_songs">Aucun morceau</string> <string name="no_songs">Aucun morceau</string>
<string name="normal">Normal</string> <string name="normal">Normal</string>
<string name="normal_lyrics">Paroles normales</string> <string name="normal_lyrics">Paroles normales</string>
<string name="not_listed_in_media_store"><![CDATA[<b>%s</b> N'est pas répertorié dans le stockage des médias.]]></string> <string name="not_listed_in_media_store"><![CDATA[<b>%s</b> N\'est pas répertorié dans le stockage des médias.]]></string>
<string name="not_recently_played">Non jouée récemment</string> <string name="not_recently_played">Non jouée récemment</string>
<string name="nothing_to_scan">Rien à scanner.</string> <string name="nothing_to_scan">Rien à scanner.</string>
<string name="nothing_to_see">Rien à afficher</string> <string name="nothing_to_see">Rien à afficher</string>

View File

@ -8,6 +8,9 @@
<item name="android:statusBarColor">@color/transparent</item> <item name="android:statusBarColor">@color/transparent</item>
<item name="android:navigationBarColor">@color/transparent</item> <item name="android:navigationBarColor">@color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item> <item name="android:enforceNavigationBarContrast">false</item>
<item name="floatingActionButtonStyle">
@style/Widget.MaterialComponents.FloatingActionButton
</item>
<item name="popupMenuBackground">@drawable/popup_background</item> <item name="popupMenuBackground">@drawable/popup_background</item>
</style> </style>

View File

@ -307,7 +307,7 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
} }
private fun isMD3Enabled(context: Context): Boolean { private fun isMD3Enabled(context: Context): Boolean {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ThemeStorePrefKeys.KEY_MATERIAL_YOU, false) return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ThemeStorePrefKeys.KEY_MATERIAL_YOU, VersionUtils.hasS())
} }
} }
} }

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.5.31' ext.kotlin_version = '1.6.0'
repositories { repositories {
mavenCentral() mavenCentral()
google() google()