Added navigation graph for settings

This commit is contained in:
Hemanth S 2020-07-24 23:58:15 +05:30
parent 0ebcbd9434
commit 373befcd83
39 changed files with 713 additions and 114 deletions

View file

@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "ru.cleverpumpkin.proguard-dictionaries-generator"
apply plugin: "androidx.navigation.safeargs.kotlin"
proguardDictionaries {
dictionaryNames = [
@ -111,7 +112,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.palette:palette-ktx:1.0.0'
@ -168,4 +169,9 @@ dependencies {
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"
def nav_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
}

View file

@ -24,9 +24,9 @@ import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.fragments.albums.AlbumsFragment
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
import code.name.monkey.retromusic.fragments.folder.FoldersFragment
import code.name.monkey.retromusic.fragments.genres.GenresFragment
import code.name.monkey.retromusic.fragments.home.BannerHomeFragment
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment
import code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment
import code.name.monkey.retromusic.fragments.songs.SongsFragment

View file

@ -10,7 +10,6 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
import com.afollestad.materialdialogs.color.ColorChooserDialog
import kotlinx.android.synthetic.main.activity_settings.*
@ -26,11 +25,6 @@ class SettingsActivity : AbsBaseActivity(), ColorChooserDialog.ColorCallback {
setNavigationbarColorAuto()
setLightNavigationBar(true)
setupToolbar()
if (savedInstanceState == null) {
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment())
.commit()
}
}
private fun setupToolbar() {

View file

@ -8,7 +8,6 @@ import android.view.Menu
import android.view.MenuItem
import android.view.SubMenu
import android.view.View
import android.widget.ImageView
import androidx.core.app.ActivityCompat
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
@ -25,7 +24,6 @@ import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.extensions.surfaceColor
import code.name.monkey.retromusic.glide.AlbumGlideRequest
@ -73,7 +71,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
private lateinit var simpleSongAdapter: SimpleSongAdapter
private lateinit var album: Album
private lateinit var artistImage: ImageView
private var cab: MaterialCab? = null
private val savedSortOrder: String
get() = PreferenceUtil.albumDetailSongSortOrder
@ -101,24 +98,25 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
setBottomBarVisibility(View.GONE)
window.sharedElementsUseOverlay = true
windowEnterTransition()
toolbar.setBackgroundColor(surfaceColor())
addMusicServiceEventListener(detailsViewModel)
ActivityCompat.postponeEnterTransition(this)
//val viewModelFactory = AlbumDetailsViewModelFactory(application, albumId)
//viewModel = ViewModelProvider(this, viewModelFactory).get(AlbumDetailsViewModel::class.java)
detailsViewModel.getAlbum().observe(this, androidx.lifecycle.Observer {
ActivityCompat.startPostponedEnterTransition(this@AlbumDetailsActivity)
album(it)
showAlbum(it)
})
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
loadArtistImage(it)
})
detailsViewModel.getMoreAlbums().observe(this, androidx.lifecycle.Observer {
moreAlbums(it)
})
detailsViewModel.getAlbumInfo().observe(this, androidx.lifecycle.Observer {
aboutAlbum(it)
})
setupRecyclerView()
artistImage = findViewById(R.id.artistImage)
artistImage.setOnClickListener {
val artistPairs = ActivityOptions.makeSceneTransitionAnimation(
this,
@ -155,12 +153,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun complete() {
ActivityCompat.startPostponedEnterTransition(this)
}
fun album(album: Album) {
complete()
private fun showAlbum(album: Album) {
if (album.songs!!.isEmpty()) {
finish()
return
@ -196,7 +189,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
detailsViewModel.loadAlbumInfo(album)
}
fun moreAlbums(albums: List<Album>) {
private fun moreAlbums(albums: List<Album>) {
moreTitle.show()
moreRecyclerView.show()
moreTitle.text = String.format(getString(R.string.label_more_from), album.artistName)
@ -211,7 +204,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
moreRecyclerView.adapter = albumAdapter
}
fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
private fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
if (lastFmAlbum.album != null) {
if (lastFmAlbum.album.wiki != null) {
aboutAlbumText.show()
@ -232,7 +225,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun loadArtistImage(artist: Artist) {
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.generatePalette(this)
.build()
@ -260,15 +253,17 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
private fun setColors(color: MediaNotificationProcessor) {
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
color.backgroundColor.ripAlpha()
else
ATHUtil.resolveColor(this, R.attr.colorSurface)
MaterialUtil.tintColor(
button = shuffleAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(surfaceColor())
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -7,8 +7,8 @@ import androidx.lifecycle.viewModelScope
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.providers.RepositoryImpl
import code.name.monkey.retromusic.network.model.LastFmAlbum
import code.name.monkey.retromusic.providers.RepositoryImpl
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
@ -22,10 +22,12 @@ class AlbumDetailsViewModel(
private val _album = MutableLiveData<Album>()
private val _artist = MutableLiveData<Artist>()
private val _lastFmAlbum = MutableLiveData<LastFmAlbum>()
private val _moreAlbums = MutableLiveData<List<Album>>()
fun getAlbum(): LiveData<Album> = _album
fun getArtist(): LiveData<Artist> = _artist
fun getAlbumInfo(): LiveData<LastFmAlbum> = _lastFmAlbum
fun getMoreAlbums(): LiveData<List<Album>> = _moreAlbums;
init {
loadAlbumDetails()
@ -44,6 +46,10 @@ class AlbumDetailsViewModel(
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
val artist = repository.artistById(artistId)
_artist.postValue(artist)
artist.albums?.filter { item -> item.id != albumId }?.let { albums ->
if (albums.isNotEmpty()) _moreAlbums.postValue(albums)
}
}
private val loadAlbumAsync: Deferred<Album?>

View file

@ -22,7 +22,6 @@ import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.extensions.surfaceColor
import code.name.monkey.retromusic.glide.ArtistGlideRequest
@ -31,7 +30,10 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.network.model.LastFmArtist
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.util.CustomArtistImageUtil
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.afollestad.materialcab.MaterialCab
import com.bumptech.glide.Glide
@ -95,8 +97,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
setBottomBarVisibility(View.GONE)
window.sharedElementsUseOverlay = true
windowEnterTransition()
ActivityCompat.postponeEnterTransition(this)
toolbar.setBackgroundColor(surfaceColor())
addMusicServiceEventListener(detailsViewModel)
ActivityCompat.postponeEnterTransition(this)
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
ActivityCompat.startPostponedEnterTransition(this@ArtistDetailActivity)
artist(it)
@ -150,18 +155,12 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun complete() {
ActivityCompat.startPostponedEnterTransition(this)
}
fun artist(artist: Artist) {
complete()
if (artist.songCount <= 0) {
if (artist.songs.isEmpty()) {
finish()
}
this.artist = artist
loadArtistImage()
loadArtistImage(artist)
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
loadBiography(artist.name)
}
@ -186,7 +185,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
songTitle.text = songText
albumTitle.text = albumText
songAdapter.swapDataSet(artist.songs)
albumAdapter.swapDataSet(artist.albums!!)
artist.albums?.let { albumAdapter.swapDataSet(it) }
}
private fun loadBiography(
@ -198,7 +197,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
detailsViewModel.loadBiography(name, lang, null)
}
fun artistInfo(lastFmArtist: LastFmArtist?) {
private fun artistInfo(lastFmArtist: LastFmArtist?) {
if (lastFmArtist != null && lastFmArtist.artist != null) {
val bioContent = lastFmArtist.artist.bio.content
if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) {
@ -211,7 +210,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
listenersLabel.show()
scrobbles.show()
scrobblesLabel.show()
listeners.text =
RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
scrobbles.text =
@ -228,8 +226,9 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
private var lang: String? = null
private fun loadArtistImage() {
ArtistGlideRequest.Builder.from(Glide.with(this), artist).generatePalette(this).build()
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.generatePalette(this).build()
.dontAnimate().into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors)
@ -238,16 +237,16 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
private fun setColors(color: MediaNotificationProcessor) {
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
color.backgroundColor.ripAlpha()
else
ATHUtil.resolveColor(this, R.attr.colorSurface)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(surfaceColor())
MaterialUtil.tintColor(
button = shuffleAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -3,7 +3,6 @@ package code.name.monkey.retromusic.adapter.album
import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
@ -106,10 +105,6 @@ open class AlbumAdapter(
.generatePalette(activity)
.build()
.into(object : RetroMusicColoredTarget(holder.image!!) {
override fun onLoadCleared(placeholder: Drawable?) {
super.onLoadCleared(placeholder)
//setColors(defaultFooterColor, holder)
}
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors, holder)

View file

@ -7,6 +7,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.lifecycleScope
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
@ -21,7 +22,6 @@ import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -68,7 +68,7 @@ class AlbumCoverPagerAdapter(
class AlbumCoverFragment : Fragment() {
lateinit var albumCover: ImageView
private lateinit var albumCover: ImageView
private var isColorReady: Boolean = false
private lateinit var color: MediaNotificationProcessor
private lateinit var song: Song
@ -96,7 +96,7 @@ class AlbumCoverPagerAdapter(
}
private fun showLyricsDialog() {
GlobalScope.launch(Dispatchers.IO) {
lifecycleScope.launch(Dispatchers.IO) {
val data = MusicUtil.getLyrics(song)
withContext(Dispatchers.Main) {
MaterialAlertDialogBuilder(
@ -116,7 +116,7 @@ class AlbumCoverPagerAdapter(
private fun getLayoutWithPlayerTheme(): Int {
return when (PreferenceUtil.nowPlayingScreen) {
Card, Fit, Tiny, Classic, Peak, Gradient, Full -> R.layout.fragment_album_full_cover
Card, Peak, Fit, Tiny, Classic, Gradient, Full -> R.layout.fragment_album_full_cover
else -> {
if (PreferenceUtil.isCarouselEffect) {
R.layout.fragment_album_carousel_cover

View file

@ -4,7 +4,10 @@ import android.content.Context
import android.content.res.Configuration
import android.os.PowerManager
import androidx.annotation.IntegerRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.navigation.fragment.NavHostFragment
import code.name.monkey.retromusic.util.PreferenceUtil
fun Fragment.getIntRes(@IntegerRes int: Int): Int {
@ -37,3 +40,16 @@ inline fun <reified T : Any> Fragment.extraNotNull(key: String, default: T? = nu
val value = arguments?.get(key)
requireNotNull(if (value is T) value else default) { key }
}
val NavHostFragment.currentFragment: Fragment?
get() = targetFragment
val FragmentManager.currentNavigationFragment: Fragment?
get() = primaryNavigationFragment?.childFragmentManager?.fragments?.first()
fun AppCompatActivity.currentFragment(navHostId: Int): Fragment? {
val navHostFragment: NavHostFragment =
supportFragmentManager.findFragmentById(navHostId) as NavHostFragment
navHostFragment.targetFragment
return navHostFragment?.childFragmentManager?.fragments?.first()
}

View file

@ -24,13 +24,15 @@ class LibraryViewModel(
private val _playlist = MutableLiveData<List<Playlist>>()
private val _genre = MutableLiveData<List<Genre>>()
private val _homeSections = MutableLiveData<List<Home>>()
private val _paletteColor = MutableLiveData<Int>()
fun homeSections(): LiveData<List<Home>> = _homeSections
fun allAlbums(): LiveData<List<Album>> = _albums
fun allSongs(): LiveData<List<Song>> = _songs
fun allArtists(): LiveData<List<Artist>> = _artists
fun allPlaylisits(): LiveData<List<Playlist>> = _playlist
fun allGenres(): LiveData<List<Genre>> = _genre
val paletteColor: LiveData<Int> = _paletteColor
val homeSections: LiveData<List<Home>> = _homeSections
val allAlbums: LiveData<List<Album>> = _albums
val allSongs: LiveData<List<Song>> = _songs
val allArtists: LiveData<List<Artist>> = _artists
val allPlaylisits: LiveData<List<Playlist>> = _playlist
val allGenres: LiveData<List<Genre>> = _genre
init {
viewModelScope.launch {

View file

@ -17,7 +17,7 @@ class AlbumsFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allAlbums()
mainActivity.libraryViewModel.allAlbums
.observe(viewLifecycleOwner, Observer { albums ->
if (albums.isNotEmpty())
adapter?.swapDataSet(albums)

View file

@ -16,8 +16,8 @@ class ArtistsFragment :
MainActivityFragmentCallbacks {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allArtists().observe(
viewLifecycleOwner, Observer { artists ->
mainActivity.libraryViewModel.allArtists
.observe(viewLifecycleOwner, Observer { artists ->
if (artists.isNotEmpty()) {
adapter?.swapDataSet(artists)
} else {

View file

@ -12,7 +12,7 @@
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.fragments.mainactivity;
package code.name.monkey.retromusic.fragments.folder;
import android.app.Dialog;
import android.content.Context;

View file

@ -28,8 +28,8 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allGenres().observe(
viewLifecycleOwner, Observer { genres ->
mainActivity.libraryViewModel.allGenres
.observe(viewLifecycleOwner, Observer { genres ->
if (genres.isNotEmpty()) {
adapter?.swapDataSet(genres)
} else {

View file

@ -112,7 +112,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
adapter = homeAdapter
}
mainActivity.libraryViewModel.homeSections()
mainActivity.libraryViewModel.homeSections
.observe(viewLifecycleOwner, Observer { sections ->
homeAdapter.swapData(sections)
})

View file

@ -0,0 +1,18 @@
package code.name.monkey.retromusic.fragments.main
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
class MainFragment : AbsMusicServiceFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_main, container, false)
}
}

View file

@ -0,0 +1,16 @@
package code.name.monkey.retromusic.fragments.player
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil
class MainPlayerFragment : Fragment(R.layout.fragment_main_player) {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
when (PreferenceUtil.nowPlayingScreen) {
else -> findNavController().navigate(R.id.action_mainPlayerFragment_to_adaptiveFragment)
}
}
}

View file

@ -50,7 +50,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
val metrics = resources.displayMetrics
val ratio = metrics.heightPixels.toFloat() / metrics.widthPixels.toFloat()
if (nps == Full || nps == Classic || nps == Fit || nps == Gradient) {
if (nps == Full || nps == Classic || nps == Fit || nps == Gradient || nps == Peak) {
viewPager.offscreenPageLimit = 2
} else if (PreferenceUtil.isCarouselEffect) {
viewPager.clipToPadding = false

View file

@ -18,7 +18,7 @@ class PlaylistsFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allPlaylisits()
mainActivity.libraryViewModel.allPlaylisits
.observe(viewLifecycleOwner, Observer { playlists ->
if (playlists.isNotEmpty()) {
adapter?.swapDataSet(playlists)

View file

@ -21,6 +21,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
@ -33,29 +34,14 @@ import kotlinx.android.synthetic.main.fragment_main_settings.*
class MainSettingsFragment : Fragment(), View.OnClickListener {
override fun onClick(view: View) {
when (view.id) {
R.id.generalSettings -> inflateFragment(
ThemeSettingsFragment(),
R.string.general_settings_title
)
R.id.audioSettings -> inflateFragment(AudioSettings(), R.string.pref_header_audio)
R.id.nowPlayingSettings -> inflateFragment(
NowPlayingSettingsFragment(),
R.string.now_playing
)
R.id.personalizeSettings -> inflateFragment(
PersonalizeSettingsFragment(),
R.string.personalize
)
R.id.imageSettings -> inflateFragment(
ImageSettingFragment(),
R.string.pref_header_images
)
R.id.notificationSettings -> inflateFragment(
NotificationSettingsFragment(),
R.string.notification
)
R.id.otherSettings -> inflateFragment(OtherSettingsFragment(), R.string.others)
R.id.generalSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_themeSettingsFragment)
R.id.audioSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_audioSettings)
R.id.personalizeSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_personalizeSettingsFragment)
R.id.imageSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_imageSettingFragment)
R.id.notificationSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_notificationSettingsFragment)
R.id.otherSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_otherSettingsFragment)
R.id.aboutSettings -> NavigationUtil.goToAbout(requireActivity())
R.id.nowPlayingSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_nowPlayingSettingsFragment)
}
}

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.fragments.songs
import android.os.Bundle
import android.view.View
import androidx.annotation.LayoutRes
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
@ -17,8 +18,8 @@ class SongsFragment :
MainActivityFragmentCallbacks {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allSongs()
.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
mainActivity.libraryViewModel.allSongs
.observe(viewLifecycleOwner, Observer {
if (it.isNotEmpty()) {
adapter?.swapDataSet(it)
} else {

View file

@ -170,6 +170,7 @@ public class MusicService extends Service implements
private AppWidgetSmall appWidgetSmall = AppWidgetSmall.Companion.getInstance();
private AppWidgetText appWidgetText = AppWidgetText.Companion.getInstance();
private final BroadcastReceiver widgetIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {

View file

@ -13,7 +13,7 @@ import code.name.monkey.retromusic.extensions.getIntRes
import code.name.monkey.retromusic.extensions.getStringOrDefault
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment
import code.name.monkey.retromusic.fragments.folder.FoldersFragment
import code.name.monkey.retromusic.helper.SortOrder.*
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.transform.*

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<alpha
android:fromAlpha="0"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="66"
android:duration="50"/>
<scale
android:fromXScale="1.1"
android:toXScale="1"
android:fromYScale="1.1"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300"/>
</set>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha
android:fromAlpha="1"
android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="66"
android:duration="50"/>
<scale
android:fromXScale="1"
android:toXScale="0.9"
android:fromYScale="1"
android:toYScale="0.9"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300"/>
</set>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="150" />

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="150"
/>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--Taken from https://googleplex-android.googlesource.com/platform/frameworks/base/+/HEAD/core/res/res/interpolator/decelerate_quad.xml-->
<decelerateInterpolator/>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:shareInterpolator="false">
<alpha
android:duration="50"
android:fillAfter="true"
android:fillBefore="true"
android:fillEnabled="true"
android:fromAlpha="0"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="35"
android:toAlpha="1.0" />
<scale
android:duration="300"
android:fillAfter="true"
android:fillBefore="true"
android:fillEnabled="true"
android:fromXScale="0.85"
android:fromYScale="0.85"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1"
android:toYScale="1"
tools:targetApi="lollipop" />
</set>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<!-- Fade out, over a black surface, which simulates a black scrim -->
<alpha
android:fromAlpha="1"
android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="35"
android:duration="50"/>
<scale
android:fromXScale="1"
android:toXScale="1.15"
android:fromYScale="1"
android:toYScale="1.15"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300"/>
</set>

View file

@ -23,10 +23,13 @@
android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/contentFrame"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:defaultNavHost="true"
app:navGraph="@navigation/settings_graph" />
</androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorSurface"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar" />
</FrameLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
app:popupTheme="?attr/toolbarPopupTheme"
app:title="@string/app_name"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal.Library"
app:titleTextColor="?attr/colorControlNormal"
tools:ignore="UnusedAttribute" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height" />
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:name="code.name.monkey.retromusic.fragments.main.MainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
app:navGraph="@navigation/retro_graph" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -28,12 +28,12 @@
app:behavior_peekHeight="0dp"
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/playerFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
<androidx.fragment.app.FragmentContainerView
android:id="@+id/miniPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
android:layout_width="match_parent"

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/now_playing"
app:startDestination="@id/mainPlayerFragment">
<fragment
android:id="@+id/playerFragment"
android:name="code.name.monkey.retromusic.fragments.player.normal.PlayerFragment"
android:label="PlayerFragment" />
<fragment
android:id="@+id/adaptiveFragment"
android:name="code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment"
android:label="AdaptiveFragment" />
<fragment
android:id="@+id/blurPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment"
android:label="BlurPlayerFragment" />
<fragment
android:id="@+id/cardBlurFragment"
android:name="code.name.monkey.retromusic.fragments.player.cardblur.CardBlurFragment"
android:label="CardBlurFragment" />
<fragment
android:id="@+id/cardFragment"
android:name="code.name.monkey.retromusic.fragments.player.card.CardFragment"
android:label="CardFragment" />
<fragment
android:id="@+id/circlePlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.circle.CirclePlayerFragment"
android:label="CirclePlayerFragment" />
<fragment
android:id="@+id/classicPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.classic.ClassicPlayerFragment"
android:label="ClassicPlayerFragment" />
<fragment
android:id="@+id/colorFragment"
android:name="code.name.monkey.retromusic.fragments.player.color.ColorFragment"
android:label="ColorFragment" />
<fragment
android:id="@+id/fitFragment"
android:name="code.name.monkey.retromusic.fragments.player.fit.FitFragment"
android:label="FitFragment" />
<fragment
android:id="@+id/flatPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.flat.FlatPlayerFragment"
android:label="FlatPlayerFragment" />
<fragment
android:id="@+id/fullPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.full.FullPlayerFragment"
android:label="FullPlayerFragment" />
<fragment
android:id="@+id/gradientPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.gradient.GradientPlayerFragment"
android:label="GradientPlayerFragment" />
<fragment
android:id="@+id/materialFragment"
android:name="code.name.monkey.retromusic.fragments.player.material.MaterialFragment"
android:label="MaterialFragment" />
<fragment
android:id="@+id/peakPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.peak.PeakPlayerFragment"
android:label="PeakPlayerFragment" />
<fragment
android:id="@+id/plainPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment"
android:label="PlainPlayerFragment" />
<fragment
android:id="@+id/simplePlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment"
android:label="SimplePlayerFragment" />
<fragment
android:id="@+id/tinyPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment"
android:label="TinyPlayerFragment" />
<fragment
android:id="@+id/mainPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.MainPlayerFragment"
android:label="MainPlayerFragment">
<action
android:id="@+id/action_mainPlayerFragment_to_adaptiveFragment"
app:destination="@id/adaptiveFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_cardBlurFragment"
app:destination="@id/cardBlurFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_circlePlayerFragment"
app:destination="@id/circlePlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_blurPlayerFragment"
app:destination="@id/blurPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_classicPlayerFragment"
app:destination="@id/classicPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_plainPlayerFragment"
app:destination="@id/plainPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_flatPlayerFragment"
app:destination="@id/flatPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_gradientPlayerFragment"
app:destination="@id/gradientPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_cardFragment"
app:destination="@id/cardFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_fitFragment"
app:destination="@id/fitFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_simplePlayerFragment"
app:destination="@id/simplePlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_fullPlayerFragment"
app:destination="@id/fullPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_colorFragment"
app:destination="@id/colorFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_peakPlayerFragment"
app:destination="@id/peakPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_tinyPlayerFragment"
app:destination="@id/tinyPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_materialFragment"
app:destination="@id/materialFragment" />
<action
android:id="@+id/action_mainPlayer_to_playerFragment"
app:destination="@id/playerFragment" />
</fragment>
</navigation>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/retro_graph"
app:startDestination="@id/mainFragment">
<fragment
android:id="@+id/mainFragment"
android:name="code.name.monkey.retromusic.fragments.main.MainFragment"
android:label="MainFragment"
tools:layout="@layout/fragment_main" />
<fragment
android:id="@+id/albumsFragment"
android:name="code.name.monkey.retromusic.fragments.albums.AlbumsFragment"
android:label="AlbumsFragment" />
<fragment
android:id="@+id/artistsFragment"
android:name="code.name.monkey.retromusic.fragments.artists.ArtistsFragment"
android:label="ArtistsFragment" />
<fragment
android:id="@+id/songsFragment"
android:name="code.name.monkey.retromusic.fragments.songs.SongsFragment"
android:label="SongsFragment" />
<fragment
android:id="@+id/genresFragment"
android:name="code.name.monkey.retromusic.fragments.genres.GenresFragment"
android:label="GenresFragment" />
<fragment
android:id="@+id/playlistsFragment"
android:name="code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment"
android:label="PlaylistsFragment" />
</navigation>

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_graph"
app:startDestination="@id/mainSettingsFragment">
<fragment
android:id="@+id/mainSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.MainSettingsFragment"
android:label="MainSettingsFragment"
tools:layout="@layout/fragment_main_settings">
<action
android:id="@+id/action_mainSettingsFragment_to_themeSettingsFragment"
app:destination="@id/themeSettingsFragment"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
<action
android:id="@+id/action_mainSettingsFragment_to_imageSettingFragment"
app:destination="@id/imageSettingFragment"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
<action
android:id="@+id/action_mainSettingsFragment_to_nowPlayingSettingsFragment"
app:destination="@id/nowPlayingSettingsFragment"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
<action
android:id="@+id/action_mainSettingsFragment_to_audioSettings"
app:destination="@id/audioSettings"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
<action
android:id="@+id/action_mainSettingsFragment_to_otherSettingsFragment"
app:destination="@id/otherSettingsFragment"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
<action
android:id="@+id/action_mainSettingsFragment_to_personalizeSettingsFragment"
app:destination="@id/personalizeSettingsFragment" />
<action
android:id="@+id/action_mainSettingsFragment_to_notificationSettingsFragment"
app:destination="@id/notificationSettingsFragment"
app:enterAnim="@anim/retro_fragment_open_enter"
app:exitAnim="@anim/retro_fragment_open_exit"
app:popEnterAnim="@anim/retro_fragment_close_enter"
app:popExitAnim="@anim/retro_fragment_close_exit" />
</fragment>
<fragment
android:id="@+id/audioSettings"
android:name="code.name.monkey.retromusic.fragments.settings.AudioSettings"
android:label="AudioSettings" />
<fragment
android:id="@+id/imageSettingFragment"
android:name="code.name.monkey.retromusic.fragments.settings.ImageSettingFragment"
android:label="ImageSettingFragment" />
<fragment
android:id="@+id/notificationSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.NotificationSettingsFragment"
android:label="NotificationSettingsFragment" />
<fragment
android:id="@+id/nowPlayingSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.NowPlayingSettingsFragment"
android:label="NowPlayingSettingsFragment" />
<fragment
android:id="@+id/otherSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.OtherSettingsFragment"
android:label="OtherSettingsFragment" />
<fragment
android:id="@+id/personalizeSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.PersonalizeSettingsFragment"
android:label="PersonalizeSettingsFragment" />
<fragment
android:id="@+id/themeSettingsFragment"
android:name="code.name.monkey.retromusic.fragments.settings.ThemeSettingsFragment"
android:label="ThemeSettingsFragment" />
</navigation>

View file

@ -1,6 +1,7 @@
package code.name.monkey.appthemehelper.util
import android.content.res.ColorStateList
import android.graphics.Color
import code.name.monkey.appthemehelper.ThemeStore
import com.google.android.material.button.MaterialButton
import com.google.android.material.textfield.TextInputLayout
@ -36,6 +37,20 @@ object MaterialUtil {
}
}
@JvmOverloads
@JvmStatic
fun tintColor(
button: MaterialButton,
textColor: Int = Color.WHITE,
backgroundColor: Int = Color.BLACK
) {
val backgroundColorStateList = ColorStateList.valueOf(backgroundColor)
val textColorColorStateList = ColorStateList.valueOf(textColor)
button.backgroundTintList = backgroundColorStateList
button.setTextColor(textColorColorStateList)
button.iconTint = textColorColorStateList
}
@JvmOverloads
@JvmStatic
fun setTint(textInputLayout: TextInputLayout, background: Boolean = true) {

View file

@ -14,6 +14,8 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:bundletool:0.9.0'
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.8"
def nav_version = "2.3.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}