Added Permission Screen
This commit is contained in:
parent
cc494edbbf
commit
10f56e9e6d
27 changed files with 334 additions and 89 deletions
|
@ -74,6 +74,7 @@ class LibraryViewModel(
|
|||
}
|
||||
|
||||
fun getHome(): LiveData<List<Home>> {
|
||||
fetchHomeSections()
|
||||
return home
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
|
|||
toolbar.title = " "
|
||||
postponeEnterTransition()
|
||||
detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer {
|
||||
println(Thread.currentThread().name)
|
||||
startPostponedEnterTransition()
|
||||
showAlbum(it)
|
||||
})
|
||||
|
|
|
@ -12,23 +12,23 @@ import code.name.monkey.retromusic.repository.RealRepository
|
|||
import kotlinx.coroutines.Dispatchers.IO
|
||||
|
||||
class AlbumDetailsViewModel(
|
||||
private val realRepository: RealRepository,
|
||||
private val repository: RealRepository,
|
||||
private val albumId: Int
|
||||
) : ViewModel(), MusicServiceEventListener {
|
||||
|
||||
fun getAlbum(): LiveData<Album> = liveData(IO) {
|
||||
val album = realRepository.albumByIdAsync(albumId)
|
||||
val album = repository.albumByIdAsync(albumId)
|
||||
emit(album)
|
||||
}
|
||||
|
||||
fun getArtist(artistId: Int): LiveData<Artist> = liveData(IO) {
|
||||
val artist = realRepository.artistById(artistId)
|
||||
val artist = repository.artistById(artistId)
|
||||
emit(artist)
|
||||
}
|
||||
|
||||
fun getAlbumInfo(album: Album): LiveData<Result<LastFmAlbum>> = liveData {
|
||||
emit(Result.Loading)
|
||||
emit( realRepository.albumInfo(album.artistName ?: "-", album.title ?: "-"))
|
||||
emit(repository.albumInfo(album.artistName ?: "-", album.title ?: "-"))
|
||||
}
|
||||
|
||||
fun getMoreAlbums(artist: Artist): LiveData<List<Album>> = liveData(IO) {
|
||||
|
|
|
@ -78,8 +78,7 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
|
|||
return String(Character.toChars(unicode))
|
||||
}
|
||||
|
||||
private fun checkIsEmpty() {
|
||||
emptyEmoji.text = getEmojiByUnicode(0x1F631)
|
||||
private fun checkIsEmpty() {
|
||||
emptyText.setText(emptyMessage)
|
||||
empty.visibility = if (adapter!!.itemCount == 0) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
|
|
@ -114,15 +114,10 @@ class PlaylistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playli
|
|||
|
||||
private fun checkIsEmpty() {
|
||||
checkForPadding()
|
||||
emptyEmoji.text = getEmojiByUnicode(0x1F631)
|
||||
empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
|
||||
emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
private fun getEmojiByUnicode(unicode: Int): String {
|
||||
return String(Character.toChars(unicode))
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
if (recyclerViewDragDropManager != null) {
|
||||
recyclerViewDragDropManager!!.cancelDrag()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue