Added navigation graph for settings
This commit is contained in:
parent
0ebcbd9434
commit
373befcd83
39 changed files with 713 additions and 114 deletions
|
@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: "ru.cleverpumpkin.proguard-dictionaries-generator"
|
apply plugin: "ru.cleverpumpkin.proguard-dictionaries-generator"
|
||||||
|
apply plugin: "androidx.navigation.safeargs.kotlin"
|
||||||
|
|
||||||
proguardDictionaries {
|
proguardDictionaries {
|
||||||
dictionaryNames = [
|
dictionaryNames = [
|
||||||
|
@ -111,7 +112,7 @@ dependencies {
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
implementation 'androidx.annotation:annotation:1.1.0'
|
implementation 'androidx.annotation:annotation:1.1.0'
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
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.fragment:fragment-ktx:1.2.5'
|
||||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||||
|
|
||||||
|
@ -168,4 +169,9 @@ dependencies {
|
||||||
implementation "org.koin:koin-core:$koin_version"
|
implementation "org.koin:koin-core:$koin_version"
|
||||||
implementation "org.koin:koin-android:$koin_version"
|
implementation "org.koin:koin-android:$koin_version"
|
||||||
implementation "org.koin:koin-android-viewmodel:$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"
|
||||||
|
|
||||||
}
|
}
|
|
@ -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.albums.AlbumsFragment
|
||||||
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment
|
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
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.genres.GenresFragment
|
||||||
import code.name.monkey.retromusic.fragments.home.BannerHomeFragment
|
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.playlists.PlaylistsFragment
|
||||||
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment
|
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment
|
||||||
import code.name.monkey.retromusic.fragments.songs.SongsFragment
|
import code.name.monkey.retromusic.fragments.songs.SongsFragment
|
||||||
|
|
|
@ -10,7 +10,6 @@ import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
||||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||||
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
|
|
||||||
import com.afollestad.materialdialogs.color.ColorChooserDialog
|
import com.afollestad.materialdialogs.color.ColorChooserDialog
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import kotlinx.android.synthetic.main.activity_settings.*
|
||||||
|
|
||||||
|
@ -26,11 +25,6 @@ class SettingsActivity : AbsBaseActivity(), ColorChooserDialog.ColorCallback {
|
||||||
setNavigationbarColorAuto()
|
setNavigationbarColorAuto()
|
||||||
setLightNavigationBar(true)
|
setLightNavigationBar(true)
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
|
||||||
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment())
|
|
||||||
.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun setupToolbar() {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.SubMenu
|
import android.view.SubMenu
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
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.AddToPlaylistDialog
|
||||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
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.show
|
||||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||||
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
|
@ -73,7 +71,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
}
|
}
|
||||||
private lateinit var simpleSongAdapter: SimpleSongAdapter
|
private lateinit var simpleSongAdapter: SimpleSongAdapter
|
||||||
private lateinit var album: Album
|
private lateinit var album: Album
|
||||||
private lateinit var artistImage: ImageView
|
|
||||||
private var cab: MaterialCab? = null
|
private var cab: MaterialCab? = null
|
||||||
private val savedSortOrder: String
|
private val savedSortOrder: String
|
||||||
get() = PreferenceUtil.albumDetailSongSortOrder
|
get() = PreferenceUtil.albumDetailSongSortOrder
|
||||||
|
@ -101,24 +98,25 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
setBottomBarVisibility(View.GONE)
|
setBottomBarVisibility(View.GONE)
|
||||||
window.sharedElementsUseOverlay = true
|
window.sharedElementsUseOverlay = true
|
||||||
windowEnterTransition()
|
windowEnterTransition()
|
||||||
|
toolbar.setBackgroundColor(surfaceColor())
|
||||||
|
|
||||||
addMusicServiceEventListener(detailsViewModel)
|
addMusicServiceEventListener(detailsViewModel)
|
||||||
ActivityCompat.postponeEnterTransition(this)
|
ActivityCompat.postponeEnterTransition(this)
|
||||||
//val viewModelFactory = AlbumDetailsViewModelFactory(application, albumId)
|
|
||||||
//viewModel = ViewModelProvider(this, viewModelFactory).get(AlbumDetailsViewModel::class.java)
|
|
||||||
|
|
||||||
detailsViewModel.getAlbum().observe(this, androidx.lifecycle.Observer {
|
detailsViewModel.getAlbum().observe(this, androidx.lifecycle.Observer {
|
||||||
ActivityCompat.startPostponedEnterTransition(this@AlbumDetailsActivity)
|
ActivityCompat.startPostponedEnterTransition(this@AlbumDetailsActivity)
|
||||||
album(it)
|
showAlbum(it)
|
||||||
})
|
})
|
||||||
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
|
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
|
||||||
loadArtistImage(it)
|
loadArtistImage(it)
|
||||||
})
|
})
|
||||||
|
detailsViewModel.getMoreAlbums().observe(this, androidx.lifecycle.Observer {
|
||||||
|
moreAlbums(it)
|
||||||
|
})
|
||||||
detailsViewModel.getAlbumInfo().observe(this, androidx.lifecycle.Observer {
|
detailsViewModel.getAlbumInfo().observe(this, androidx.lifecycle.Observer {
|
||||||
aboutAlbum(it)
|
aboutAlbum(it)
|
||||||
})
|
})
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
artistImage = findViewById(R.id.artistImage)
|
|
||||||
artistImage.setOnClickListener {
|
artistImage.setOnClickListener {
|
||||||
val artistPairs = ActivityOptions.makeSceneTransitionAnimation(
|
val artistPairs = ActivityOptions.makeSceneTransitionAnimation(
|
||||||
this,
|
this,
|
||||||
|
@ -155,12 +153,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun complete() {
|
private fun showAlbum(album: Album) {
|
||||||
ActivityCompat.startPostponedEnterTransition(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun album(album: Album) {
|
|
||||||
complete()
|
|
||||||
if (album.songs!!.isEmpty()) {
|
if (album.songs!!.isEmpty()) {
|
||||||
finish()
|
finish()
|
||||||
return
|
return
|
||||||
|
@ -196,7 +189,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
detailsViewModel.loadAlbumInfo(album)
|
detailsViewModel.loadAlbumInfo(album)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun moreAlbums(albums: List<Album>) {
|
private fun moreAlbums(albums: List<Album>) {
|
||||||
moreTitle.show()
|
moreTitle.show()
|
||||||
moreRecyclerView.show()
|
moreRecyclerView.show()
|
||||||
moreTitle.text = String.format(getString(R.string.label_more_from), album.artistName)
|
moreTitle.text = String.format(getString(R.string.label_more_from), album.artistName)
|
||||||
|
@ -211,7 +204,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
moreRecyclerView.adapter = albumAdapter
|
moreRecyclerView.adapter = albumAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
|
private fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
|
||||||
if (lastFmAlbum.album != null) {
|
if (lastFmAlbum.album != null) {
|
||||||
if (lastFmAlbum.album.wiki != null) {
|
if (lastFmAlbum.album.wiki != null) {
|
||||||
aboutAlbumText.show()
|
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)
|
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
|
||||||
.generatePalette(this)
|
.generatePalette(this)
|
||||||
.build()
|
.build()
|
||||||
|
@ -260,15 +253,17 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setColors(color: MediaNotificationProcessor) {
|
private fun setColors(color: MediaNotificationProcessor) {
|
||||||
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
|
MaterialUtil.tintColor(
|
||||||
color.backgroundColor.ripAlpha()
|
button = shuffleAction,
|
||||||
else
|
textColor = color.primaryTextColor,
|
||||||
ATHUtil.resolveColor(this, R.attr.colorSurface)
|
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)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.title = null
|
supportActionBar?.title = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import androidx.lifecycle.viewModelScope
|
||||||
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
|
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
|
||||||
import code.name.monkey.retromusic.model.Album
|
import code.name.monkey.retromusic.model.Album
|
||||||
import code.name.monkey.retromusic.model.Artist
|
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.network.model.LastFmAlbum
|
||||||
|
import code.name.monkey.retromusic.providers.RepositoryImpl
|
||||||
import kotlinx.coroutines.Deferred
|
import kotlinx.coroutines.Deferred
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
|
@ -22,10 +22,12 @@ class AlbumDetailsViewModel(
|
||||||
private val _album = MutableLiveData<Album>()
|
private val _album = MutableLiveData<Album>()
|
||||||
private val _artist = MutableLiveData<Artist>()
|
private val _artist = MutableLiveData<Artist>()
|
||||||
private val _lastFmAlbum = MutableLiveData<LastFmAlbum>()
|
private val _lastFmAlbum = MutableLiveData<LastFmAlbum>()
|
||||||
|
private val _moreAlbums = MutableLiveData<List<Album>>()
|
||||||
|
|
||||||
fun getAlbum(): LiveData<Album> = _album
|
fun getAlbum(): LiveData<Album> = _album
|
||||||
fun getArtist(): LiveData<Artist> = _artist
|
fun getArtist(): LiveData<Artist> = _artist
|
||||||
fun getAlbumInfo(): LiveData<LastFmAlbum> = _lastFmAlbum
|
fun getAlbumInfo(): LiveData<LastFmAlbum> = _lastFmAlbum
|
||||||
|
fun getMoreAlbums(): LiveData<List<Album>> = _moreAlbums;
|
||||||
|
|
||||||
init {
|
init {
|
||||||
loadAlbumDetails()
|
loadAlbumDetails()
|
||||||
|
@ -44,6 +46,10 @@ class AlbumDetailsViewModel(
|
||||||
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
|
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
|
||||||
val artist = repository.artistById(artistId)
|
val artist = repository.artistById(artistId)
|
||||||
_artist.postValue(artist)
|
_artist.postValue(artist)
|
||||||
|
|
||||||
|
artist.albums?.filter { item -> item.id != albumId }?.let { albums ->
|
||||||
|
if (albums.isNotEmpty()) _moreAlbums.postValue(albums)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val loadAlbumAsync: Deferred<Album?>
|
private val loadAlbumAsync: Deferred<Album?>
|
||||||
|
|
|
@ -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.adapter.song.SimpleSongAdapter
|
||||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||||
import code.name.monkey.retromusic.extensions.extraNotNull
|
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.show
|
||||||
import code.name.monkey.retromusic.extensions.surfaceColor
|
import code.name.monkey.retromusic.extensions.surfaceColor
|
||||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
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.interfaces.CabHolder
|
||||||
import code.name.monkey.retromusic.model.Artist
|
import code.name.monkey.retromusic.model.Artist
|
||||||
import code.name.monkey.retromusic.network.model.LastFmArtist
|
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 code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
@ -95,8 +97,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
setBottomBarVisibility(View.GONE)
|
setBottomBarVisibility(View.GONE)
|
||||||
window.sharedElementsUseOverlay = true
|
window.sharedElementsUseOverlay = true
|
||||||
windowEnterTransition()
|
windowEnterTransition()
|
||||||
ActivityCompat.postponeEnterTransition(this)
|
toolbar.setBackgroundColor(surfaceColor())
|
||||||
|
|
||||||
addMusicServiceEventListener(detailsViewModel)
|
addMusicServiceEventListener(detailsViewModel)
|
||||||
|
|
||||||
|
ActivityCompat.postponeEnterTransition(this)
|
||||||
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
|
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
|
||||||
ActivityCompat.startPostponedEnterTransition(this@ArtistDetailActivity)
|
ActivityCompat.startPostponedEnterTransition(this@ArtistDetailActivity)
|
||||||
artist(it)
|
artist(it)
|
||||||
|
@ -150,18 +155,12 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun complete() {
|
|
||||||
ActivityCompat.startPostponedEnterTransition(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun artist(artist: Artist) {
|
fun artist(artist: Artist) {
|
||||||
complete()
|
if (artist.songs.isEmpty()) {
|
||||||
if (artist.songCount <= 0) {
|
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
this.artist = artist
|
this.artist = artist
|
||||||
loadArtistImage()
|
loadArtistImage(artist)
|
||||||
|
|
||||||
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
|
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
|
||||||
loadBiography(artist.name)
|
loadBiography(artist.name)
|
||||||
}
|
}
|
||||||
|
@ -186,7 +185,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
songTitle.text = songText
|
songTitle.text = songText
|
||||||
albumTitle.text = albumText
|
albumTitle.text = albumText
|
||||||
songAdapter.swapDataSet(artist.songs)
|
songAdapter.swapDataSet(artist.songs)
|
||||||
albumAdapter.swapDataSet(artist.albums!!)
|
artist.albums?.let { albumAdapter.swapDataSet(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBiography(
|
private fun loadBiography(
|
||||||
|
@ -198,7 +197,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
detailsViewModel.loadBiography(name, lang, null)
|
detailsViewModel.loadBiography(name, lang, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun artistInfo(lastFmArtist: LastFmArtist?) {
|
private fun artistInfo(lastFmArtist: LastFmArtist?) {
|
||||||
if (lastFmArtist != null && lastFmArtist.artist != null) {
|
if (lastFmArtist != null && lastFmArtist.artist != null) {
|
||||||
val bioContent = lastFmArtist.artist.bio.content
|
val bioContent = lastFmArtist.artist.bio.content
|
||||||
if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) {
|
if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) {
|
||||||
|
@ -211,7 +210,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
listenersLabel.show()
|
listenersLabel.show()
|
||||||
scrobbles.show()
|
scrobbles.show()
|
||||||
scrobblesLabel.show()
|
scrobblesLabel.show()
|
||||||
|
|
||||||
listeners.text =
|
listeners.text =
|
||||||
RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
|
RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
|
||||||
scrobbles.text =
|
scrobbles.text =
|
||||||
|
@ -228,8 +226,9 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
|
|
||||||
private var lang: String? = null
|
private var lang: String? = null
|
||||||
|
|
||||||
private fun loadArtistImage() {
|
private fun loadArtistImage(artist: Artist) {
|
||||||
ArtistGlideRequest.Builder.from(Glide.with(this), artist).generatePalette(this).build()
|
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
|
||||||
|
.generatePalette(this).build()
|
||||||
.dontAnimate().into(object : RetroMusicColoredTarget(image) {
|
.dontAnimate().into(object : RetroMusicColoredTarget(image) {
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColors(colors)
|
setColors(colors)
|
||||||
|
@ -238,16 +237,16 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setColors(color: MediaNotificationProcessor) {
|
private fun setColors(color: MediaNotificationProcessor) {
|
||||||
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
|
MaterialUtil.tintColor(
|
||||||
color.backgroundColor.ripAlpha()
|
button = shuffleAction,
|
||||||
else
|
textColor = color.primaryTextColor,
|
||||||
ATHUtil.resolveColor(this, R.attr.colorSurface)
|
backgroundColor = color.backgroundColor
|
||||||
|
)
|
||||||
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
|
MaterialUtil.tintColor(
|
||||||
MaterialUtil.setTint(button = playAction, color = buttonColor)
|
button = playAction,
|
||||||
|
textColor = color.primaryTextColor,
|
||||||
|
backgroundColor = color.backgroundColor
|
||||||
toolbar.setBackgroundColor(surfaceColor())
|
)
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.title = null
|
supportActionBar?.title = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package code.name.monkey.retromusic.adapter.album
|
||||||
import android.app.ActivityOptions
|
import android.app.ActivityOptions
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -106,10 +105,6 @@ open class AlbumAdapter(
|
||||||
.generatePalette(activity)
|
.generatePalette(activity)
|
||||||
.build()
|
.build()
|
||||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
|
||||||
super.onLoadCleared(placeholder)
|
|
||||||
//setColors(defaultFooterColor, holder)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColors(colors, holder)
|
setColors(colors, holder)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
|
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.bumptech.glide.Glide
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class AlbumCoverPagerAdapter(
|
||||||
|
|
||||||
class AlbumCoverFragment : Fragment() {
|
class AlbumCoverFragment : Fragment() {
|
||||||
|
|
||||||
lateinit var albumCover: ImageView
|
private lateinit var albumCover: ImageView
|
||||||
private var isColorReady: Boolean = false
|
private var isColorReady: Boolean = false
|
||||||
private lateinit var color: MediaNotificationProcessor
|
private lateinit var color: MediaNotificationProcessor
|
||||||
private lateinit var song: Song
|
private lateinit var song: Song
|
||||||
|
@ -96,7 +96,7 @@ class AlbumCoverPagerAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showLyricsDialog() {
|
private fun showLyricsDialog() {
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val data = MusicUtil.getLyrics(song)
|
val data = MusicUtil.getLyrics(song)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
MaterialAlertDialogBuilder(
|
MaterialAlertDialogBuilder(
|
||||||
|
@ -116,7 +116,7 @@ class AlbumCoverPagerAdapter(
|
||||||
|
|
||||||
private fun getLayoutWithPlayerTheme(): Int {
|
private fun getLayoutWithPlayerTheme(): Int {
|
||||||
return when (PreferenceUtil.nowPlayingScreen) {
|
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 -> {
|
else -> {
|
||||||
if (PreferenceUtil.isCarouselEffect) {
|
if (PreferenceUtil.isCarouselEffect) {
|
||||||
R.layout.fragment_album_carousel_cover
|
R.layout.fragment_album_carousel_cover
|
||||||
|
|
|
@ -4,7 +4,10 @@ import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import androidx.annotation.IntegerRes
|
import androidx.annotation.IntegerRes
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
|
||||||
fun Fragment.getIntRes(@IntegerRes int: Int): Int {
|
fun Fragment.getIntRes(@IntegerRes int: Int): Int {
|
||||||
|
@ -36,4 +39,17 @@ inline fun <reified T : Any> Fragment.extra(key: String, default: T? = null) = l
|
||||||
inline fun <reified T : Any> Fragment.extraNotNull(key: String, default: T? = null) = lazy {
|
inline fun <reified T : Any> Fragment.extraNotNull(key: String, default: T? = null) = lazy {
|
||||||
val value = arguments?.get(key)
|
val value = arguments?.get(key)
|
||||||
requireNotNull(if (value is T) value else default) { 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()
|
||||||
|
}
|
||||||
|
|
|
@ -24,13 +24,15 @@ class LibraryViewModel(
|
||||||
private val _playlist = MutableLiveData<List<Playlist>>()
|
private val _playlist = MutableLiveData<List<Playlist>>()
|
||||||
private val _genre = MutableLiveData<List<Genre>>()
|
private val _genre = MutableLiveData<List<Genre>>()
|
||||||
private val _homeSections = MutableLiveData<List<Home>>()
|
private val _homeSections = MutableLiveData<List<Home>>()
|
||||||
|
private val _paletteColor = MutableLiveData<Int>()
|
||||||
|
|
||||||
fun homeSections(): LiveData<List<Home>> = _homeSections
|
val paletteColor: LiveData<Int> = _paletteColor
|
||||||
fun allAlbums(): LiveData<List<Album>> = _albums
|
val homeSections: LiveData<List<Home>> = _homeSections
|
||||||
fun allSongs(): LiveData<List<Song>> = _songs
|
val allAlbums: LiveData<List<Album>> = _albums
|
||||||
fun allArtists(): LiveData<List<Artist>> = _artists
|
val allSongs: LiveData<List<Song>> = _songs
|
||||||
fun allPlaylisits(): LiveData<List<Playlist>> = _playlist
|
val allArtists: LiveData<List<Artist>> = _artists
|
||||||
fun allGenres(): LiveData<List<Genre>> = _genre
|
val allPlaylisits: LiveData<List<Playlist>> = _playlist
|
||||||
|
val allGenres: LiveData<List<Genre>> = _genre
|
||||||
|
|
||||||
init {
|
init {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|
|
@ -17,7 +17,7 @@ class AlbumsFragment :
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allAlbums()
|
mainActivity.libraryViewModel.allAlbums
|
||||||
.observe(viewLifecycleOwner, Observer { albums ->
|
.observe(viewLifecycleOwner, Observer { albums ->
|
||||||
if (albums.isNotEmpty())
|
if (albums.isNotEmpty())
|
||||||
adapter?.swapDataSet(albums)
|
adapter?.swapDataSet(albums)
|
||||||
|
|
|
@ -16,8 +16,8 @@ class ArtistsFragment :
|
||||||
MainActivityFragmentCallbacks {
|
MainActivityFragmentCallbacks {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allArtists().observe(
|
mainActivity.libraryViewModel.allArtists
|
||||||
viewLifecycleOwner, Observer { artists ->
|
.observe(viewLifecycleOwner, Observer { artists ->
|
||||||
if (artists.isNotEmpty()) {
|
if (artists.isNotEmpty()) {
|
||||||
adapter?.swapDataSet(artists)
|
adapter?.swapDataSet(artists)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* 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.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -28,8 +28,8 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allGenres().observe(
|
mainActivity.libraryViewModel.allGenres
|
||||||
viewLifecycleOwner, Observer { genres ->
|
.observe(viewLifecycleOwner, Observer { genres ->
|
||||||
if (genres.isNotEmpty()) {
|
if (genres.isNotEmpty()) {
|
||||||
adapter?.swapDataSet(genres)
|
adapter?.swapDataSet(genres)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -112,7 +112,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
adapter = homeAdapter
|
adapter = homeAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
mainActivity.libraryViewModel.homeSections()
|
mainActivity.libraryViewModel.homeSections
|
||||||
.observe(viewLifecycleOwner, Observer { sections ->
|
.observe(viewLifecycleOwner, Observer { sections ->
|
||||||
homeAdapter.swapData(sections)
|
homeAdapter.swapData(sections)
|
||||||
})
|
})
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,7 +50,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
||||||
val metrics = resources.displayMetrics
|
val metrics = resources.displayMetrics
|
||||||
val ratio = metrics.heightPixels.toFloat() / metrics.widthPixels.toFloat()
|
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
|
viewPager.offscreenPageLimit = 2
|
||||||
} else if (PreferenceUtil.isCarouselEffect) {
|
} else if (PreferenceUtil.isCarouselEffect) {
|
||||||
viewPager.clipToPadding = false
|
viewPager.clipToPadding = false
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PlaylistsFragment :
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allPlaylisits()
|
mainActivity.libraryViewModel.allPlaylisits
|
||||||
.observe(viewLifecycleOwner, Observer { playlists ->
|
.observe(viewLifecycleOwner, Observer { playlists ->
|
||||||
if (playlists.isNotEmpty()) {
|
if (playlists.isNotEmpty()) {
|
||||||
adapter?.swapDataSet(playlists)
|
adapter?.swapDataSet(playlists)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
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
|
||||||
|
@ -33,29 +34,14 @@ import kotlinx.android.synthetic.main.fragment_main_settings.*
|
||||||
class MainSettingsFragment : Fragment(), View.OnClickListener {
|
class MainSettingsFragment : Fragment(), View.OnClickListener {
|
||||||
override fun onClick(view: View) {
|
override fun onClick(view: View) {
|
||||||
when (view.id) {
|
when (view.id) {
|
||||||
R.id.generalSettings -> inflateFragment(
|
R.id.generalSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_themeSettingsFragment)
|
||||||
ThemeSettingsFragment(),
|
R.id.audioSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_audioSettings)
|
||||||
R.string.general_settings_title
|
R.id.personalizeSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_personalizeSettingsFragment)
|
||||||
)
|
R.id.imageSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_imageSettingFragment)
|
||||||
R.id.audioSettings -> inflateFragment(AudioSettings(), R.string.pref_header_audio)
|
R.id.notificationSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_notificationSettingsFragment)
|
||||||
R.id.nowPlayingSettings -> inflateFragment(
|
R.id.otherSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_otherSettingsFragment)
|
||||||
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.aboutSettings -> NavigationUtil.goToAbout(requireActivity())
|
R.id.aboutSettings -> NavigationUtil.goToAbout(requireActivity())
|
||||||
|
R.id.nowPlayingSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_nowPlayingSettingsFragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package code.name.monkey.retromusic.fragments.songs
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
|
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
|
||||||
|
@ -17,8 +18,8 @@ class SongsFragment :
|
||||||
MainActivityFragmentCallbacks {
|
MainActivityFragmentCallbacks {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allSongs()
|
mainActivity.libraryViewModel.allSongs
|
||||||
.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
|
.observe(viewLifecycleOwner, Observer {
|
||||||
if (it.isNotEmpty()) {
|
if (it.isNotEmpty()) {
|
||||||
adapter?.swapDataSet(it)
|
adapter?.swapDataSet(it)
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,7 +74,7 @@ class SongsFragment :
|
||||||
override fun setGridSize(gridSize: Int) {
|
override fun setGridSize(gridSize: Int) {
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadSortOrder(): String {
|
override fun loadSortOrder(): String {
|
||||||
return PreferenceUtil.songSortOrder
|
return PreferenceUtil.songSortOrder
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ public class MusicService extends Service implements
|
||||||
private AppWidgetSmall appWidgetSmall = AppWidgetSmall.Companion.getInstance();
|
private AppWidgetSmall appWidgetSmall = AppWidgetSmall.Companion.getInstance();
|
||||||
|
|
||||||
private AppWidgetText appWidgetText = AppWidgetText.Companion.getInstance();
|
private AppWidgetText appWidgetText = AppWidgetText.Companion.getInstance();
|
||||||
|
|
||||||
private final BroadcastReceiver widgetIntentReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver widgetIntentReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
public void onReceive(final Context context, final Intent intent) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.extensions.getIntRes
|
||||||
import code.name.monkey.retromusic.extensions.getStringOrDefault
|
import code.name.monkey.retromusic.extensions.getStringOrDefault
|
||||||
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
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.helper.SortOrder.*
|
||||||
import code.name.monkey.retromusic.model.CategoryInfo
|
import code.name.monkey.retromusic.model.CategoryInfo
|
||||||
import code.name.monkey.retromusic.transform.*
|
import code.name.monkey.retromusic.transform.*
|
||||||
|
|
40
app/src/main/res/anim/retro_fragment_close_enter.xml
Normal file
40
app/src/main/res/anim/retro_fragment_close_enter.xml
Normal 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>
|
41
app/src/main/res/anim/retro_fragment_close_exit.xml
Normal file
41
app/src/main/res/anim/retro_fragment_close_exit.xml
Normal 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>
|
20
app/src/main/res/anim/retro_fragment_fade_enter.xml
Normal file
20
app/src/main/res/anim/retro_fragment_fade_enter.xml
Normal 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" />
|
22
app/src/main/res/anim/retro_fragment_fade_exit.xml
Normal file
22
app/src/main/res/anim/retro_fragment_fade_exit.xml
Normal 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"
|
||||||
|
/>
|
|
@ -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/>
|
41
app/src/main/res/anim/retro_fragment_open_enter.xml
Normal file
41
app/src/main/res/anim/retro_fragment_open_enter.xml
Normal 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>
|
41
app/src/main/res/anim/retro_fragment_open_exit.xml
Normal file
41
app/src/main/res/anim/retro_fragment_open_exit.xml
Normal 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>
|
|
@ -23,10 +23,13 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
<FrameLayout
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/contentFrame"
|
android:id="@+id/contentFrame"
|
||||||
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="match_parent"
|
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>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|
63
app/src/main/res/layout/fragment_main.xml
Normal file
63
app/src/main/res/layout/fragment_main.xml
Normal 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>
|
6
app/src/main/res/layout/fragment_main_player.xml
Normal file
6
app/src/main/res/layout/fragment_main_player.xml
Normal 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>
|
|
@ -28,12 +28,12 @@
|
||||||
app:behavior_peekHeight="0dp"
|
app:behavior_peekHeight="0dp"
|
||||||
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
|
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
|
||||||
|
|
||||||
<FrameLayout
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/playerFragmentContainer"
|
android:id="@+id/playerFragmentContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<fragment
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/miniPlayerFragment"
|
android:id="@+id/miniPlayerFragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
|
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
131
app/src/main/res/navigation/now_playing.xml
Normal file
131
app/src/main/res/navigation/now_playing.xml
Normal 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>
|
33
app/src/main/res/navigation/retro_graph.xml
Normal file
33
app/src/main/res/navigation/retro_graph.xml
Normal 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>
|
88
app/src/main/res/navigation/settings_graph.xml
Normal file
88
app/src/main/res/navigation/settings_graph.xml
Normal 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>
|
|
@ -1,6 +1,7 @@
|
||||||
package code.name.monkey.appthemehelper.util
|
package code.name.monkey.appthemehelper.util
|
||||||
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Color
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
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
|
@JvmOverloads
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setTint(textInputLayout: TextInputLayout, background: Boolean = true) {
|
fun setTint(textInputLayout: TextInputLayout, background: Boolean = true) {
|
||||||
|
|
|
@ -14,6 +14,8 @@ buildscript {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'com.android.tools.build:bundletool:0.9.0'
|
classpath 'com.android.tools.build:bundletool:0.9.0'
|
||||||
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.8"
|
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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue