Added show empty in home
This commit is contained in:
parent
647e5b2d3f
commit
d2804bdcd4
11 changed files with 77 additions and 55 deletions
|
@ -147,7 +147,7 @@ dependencies {
|
||||||
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0'
|
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0'
|
||||||
|
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
|
||||||
|
|
||||||
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
|
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
|
|
|
@ -17,6 +17,7 @@ import code.name.monkey.retromusic.Constants
|
||||||
import code.name.monkey.retromusic.Constants.USER_BANNER
|
import code.name.monkey.retromusic.Constants.USER_BANNER
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter
|
import code.name.monkey.retromusic.adapter.HomeAdapter
|
||||||
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||||
import code.name.monkey.retromusic.glide.GlideApp
|
import code.name.monkey.retromusic.glide.GlideApp
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
@ -31,7 +32,7 @@ import code.name.monkey.retromusic.mvp.presenter.HomePresenter
|
||||||
import code.name.monkey.retromusic.util.*
|
import code.name.monkey.retromusic.util.*
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.*
|
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||||
|
@ -42,16 +43,12 @@ import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
|
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
|
||||||
override fun showEmpty() {
|
override fun showEmpty() {
|
||||||
|
emptyContainer.show()
|
||||||
|
emptyText.setText(R.string.start_play_music)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var disposable: CompositeDisposable
|
private var disposable: Disposable? = null
|
||||||
private lateinit var homePresenter: HomePresenter
|
private lateinit var homePresenter: HomePresenter
|
||||||
private lateinit var contentContainerView: View
|
|
||||||
private lateinit var lastAdded: View
|
|
||||||
private lateinit var topPlayed: View
|
|
||||||
private lateinit var actionShuffle: View
|
|
||||||
private lateinit var history: View
|
|
||||||
private lateinit var toolbar: Toolbar
|
private lateinit var toolbar: Toolbar
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
@ -59,7 +56,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadImageFromStorage() {
|
private fun loadImageFromStorage() {
|
||||||
disposable.add(Compressor(context!!)
|
if (disposable != null) {
|
||||||
|
disposable?.dispose()
|
||||||
|
}
|
||||||
|
disposable = Compressor(context!!)
|
||||||
.setMaxHeight(300)
|
.setMaxHeight(300)
|
||||||
.setMaxWidth(300)
|
.setMaxWidth(300)
|
||||||
.setQuality(75)
|
.setQuality(75)
|
||||||
|
@ -75,7 +75,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
userImage.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
userImage.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val displayMetrics: DisplayMetrics
|
private val displayMetrics: DisplayMetrics
|
||||||
|
@ -101,30 +101,25 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
if (!PreferenceUtil.getInstance().isHomeBanner)
|
if (!PreferenceUtil.getInstance().isHomeBanner)
|
||||||
setStatusbarColorAuto(view)
|
setStatusbarColorAuto(view)
|
||||||
|
|
||||||
lastAdded = view.findViewById(R.id.lastAdded)
|
|
||||||
lastAdded.setOnClickListener {
|
lastAdded.setOnClickListener {
|
||||||
NavigationUtil.goToPlaylistNew(mainActivity, LastAddedPlaylist(mainActivity))
|
NavigationUtil.goToPlaylistNew(mainActivity, LastAddedPlaylist(mainActivity))
|
||||||
}
|
}
|
||||||
|
|
||||||
topPlayed = view.findViewById(R.id.topPlayed)
|
|
||||||
topPlayed.setOnClickListener {
|
topPlayed.setOnClickListener {
|
||||||
NavigationUtil.goToPlaylistNew(mainActivity, MyTopTracksPlaylist(mainActivity))
|
NavigationUtil.goToPlaylistNew(mainActivity, MyTopTracksPlaylist(mainActivity))
|
||||||
}
|
}
|
||||||
|
|
||||||
actionShuffle = view.findViewById(R.id.actionShuffle)
|
|
||||||
actionShuffle.setOnClickListener {
|
actionShuffle.setOnClickListener {
|
||||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(mainActivity).blockingFirst(), true)
|
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(mainActivity).blockingFirst(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
history = view.findViewById(R.id.history)
|
|
||||||
history.setOnClickListener {
|
history.setOnClickListener {
|
||||||
NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity))
|
NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity))
|
||||||
}
|
}
|
||||||
|
|
||||||
homePresenter = HomePresenter(this)
|
homePresenter = HomePresenter(this)
|
||||||
|
|
||||||
contentContainerView = view.findViewById(R.id.contentContainer)
|
contentContainer.setBackgroundColor(ThemeStore.primaryColor(context!!))
|
||||||
contentContainerView.setBackgroundColor(ThemeStore.primaryColor(context!!))
|
|
||||||
|
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics)
|
homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics)
|
||||||
|
@ -176,13 +171,12 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
disposable = CompositeDisposable()
|
|
||||||
getTimeOfTheDay()
|
getTimeOfTheDay()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
disposable.dispose()
|
disposable?.dispose()
|
||||||
homePresenter.unsubscribe()
|
homePresenter.unsubscribe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,13 +262,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
.into(bannerImage!!)
|
.into(bannerImage!!)
|
||||||
} else {
|
} else {
|
||||||
disposable.add(Compressor(context!!)
|
disposable = Compressor(context!!)
|
||||||
.setQuality(100)
|
.setQuality(100)
|
||||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().bannerImage, USER_BANNER))
|
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().bannerImage, USER_BANNER))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe { bannerImage!!.setImageBitmap(it) })
|
.subscribe { bannerImage?.setImageBitmap(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadImageFromStorage()
|
loadImageFromStorage()
|
||||||
|
|
|
@ -87,11 +87,9 @@ object TopAndRecentlyPlayedTracksLoader {
|
||||||
val songs = SongPlayCountStore.getInstance(context)
|
val songs = SongPlayCountStore.getInstance(context)
|
||||||
.getTopPlayedResults(NUMBER_OF_TOP_TRACKS)
|
.getTopPlayedResults(NUMBER_OF_TOP_TRACKS)
|
||||||
|
|
||||||
try {
|
songs.use { localSongs ->
|
||||||
return makeSortedCursor(context, songs,
|
return makeSortedCursor(context, localSongs,
|
||||||
songs!!.getColumnIndex(SongPlayCountStore.SongPlayCountColumns.ID))
|
localSongs.getColumnIndex(SongPlayCountStore.SongPlayCountColumns.ID))
|
||||||
} finally {
|
|
||||||
songs?.close()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
package code.name.monkey.retromusic.mvp.presenter
|
package code.name.monkey.retromusic.mvp.presenter
|
||||||
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.model.Home
|
|
||||||
import code.name.monkey.retromusic.mvp.Presenter
|
|
||||||
import code.name.monkey.retromusic.mvp.contract.HomeContract
|
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.GENRES
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.GENRES
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.PLAYLISTS
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.PLAYLISTS
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.RECENT_ALBUMS
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.RECENT_ALBUMS
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.RECENT_ARTISTS
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.RECENT_ARTISTS
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.TOP_ALBUMS
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.TOP_ALBUMS
|
||||||
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.TOP_ARTISTS
|
import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.TOP_ARTISTS
|
||||||
|
import code.name.monkey.retromusic.model.Home
|
||||||
|
import code.name.monkey.retromusic.mvp.Presenter
|
||||||
|
import code.name.monkey.retromusic.mvp.contract.HomeContract
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
|
@ -55,7 +55,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadRecentArtists() {
|
private fun loadRecentArtists() {
|
||||||
disposable += repository.recentArtists
|
disposable += repository.recentArtists
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(0, R.string.recent_artists, 0, it, RECENT_ARTISTS, R.drawable.ic_artist_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(0, R.string.recent_artists, 0, it, RECENT_ARTISTS, R.drawable.ic_artist_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
@ -66,7 +65,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadRecentAlbums() {
|
private fun loadRecentAlbums() {
|
||||||
disposable += repository.recentAlbums
|
disposable += repository.recentAlbums
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(1, R.string.recent_albums, 0, it, RECENT_ALBUMS, R.drawable.ic_album_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(1, R.string.recent_albums, 0, it, RECENT_ALBUMS, R.drawable.ic_album_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
@ -77,7 +75,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadATopAlbums() {
|
private fun loadATopAlbums() {
|
||||||
disposable += repository.topAlbums
|
disposable += repository.topAlbums
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(3, R.string.top_albums, 0, it, TOP_ALBUMS, R.drawable.ic_album_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(3, R.string.top_albums, 0, it, TOP_ALBUMS, R.drawable.ic_album_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
@ -88,7 +85,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadTopArtists() {
|
private fun loadTopArtists() {
|
||||||
disposable += repository.topArtists
|
disposable += repository.topArtists
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(2, R.string.top_artists, 0, it, TOP_ARTISTS, R.drawable.ic_artist_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(2, R.string.top_artists, 0, it, TOP_ARTISTS, R.drawable.ic_artist_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
@ -99,7 +95,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadFavorite() {
|
private fun loadFavorite() {
|
||||||
disposable += repository.favoritePlaylist
|
disposable += repository.favoritePlaylist
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(4, R.string.favorites, 0, it, PLAYLISTS, R.drawable.ic_favorite_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(4, R.string.favorites, 0, it, PLAYLISTS, R.drawable.ic_favorite_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
@ -110,7 +105,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
||||||
|
|
||||||
private fun loadGenre() {
|
private fun loadGenre() {
|
||||||
disposable += repository.allGenres
|
disposable += repository.allGenres
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (it.isNotEmpty()) hashSet.add(Home(6, R.string.genres, 0, it, GENRES, R.drawable.ic_guitar_acoustic_white_24dp))
|
if (it.isNotEmpty()) hashSet.add(Home(6, R.string.genres, 0, it, GENRES, R.drawable.ic_guitar_acoustic_white_24dp))
|
||||||
view.showData(ArrayList(hashSet))
|
view.showData(ArrayList(hashSet))
|
||||||
|
|
|
@ -21,70 +21,110 @@ import code.name.monkey.retromusic.model.*
|
||||||
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
|
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
|
||||||
import code.name.monkey.retromusic.providers.interfaces.Repository
|
import code.name.monkey.retromusic.providers.interfaces.Repository
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
class RepositoryImpl(private val context: Context) : Repository {
|
class RepositoryImpl(private val context: Context) : Repository {
|
||||||
override val favoritePlaylist: Observable<ArrayList<Playlist>>
|
override val favoritePlaylist: Observable<ArrayList<Playlist>>
|
||||||
get() = PlaylistLoader.getFavoritePlaylist(context)
|
get() = PlaylistLoader.getFavoritePlaylist(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
|
|
||||||
override val allSongs: Observable<ArrayList<Song>>
|
override val allSongs: Observable<ArrayList<Song>>
|
||||||
get() = SongLoader.getAllSongs(context)
|
get() = SongLoader.getAllSongs(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val suggestionSongs: Observable<ArrayList<Song>>
|
override val suggestionSongs: Observable<ArrayList<Song>>
|
||||||
get() = SongLoader.suggestSongs(context)
|
get() = SongLoader.suggestSongs(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val allAlbums: Observable<ArrayList<Album>>
|
override val allAlbums: Observable<ArrayList<Album>>
|
||||||
get() = AlbumLoader.getAllAlbums(context)
|
get() = AlbumLoader.getAllAlbums(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val recentAlbums: Observable<ArrayList<Album>>
|
override val recentAlbums: Observable<ArrayList<Album>>
|
||||||
get() = LastAddedSongsLoader.getLastAddedAlbums(context)
|
get() = LastAddedSongsLoader.getLastAddedAlbums(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val topAlbums: Observable<ArrayList<Album>>
|
override val topAlbums: Observable<ArrayList<Album>>
|
||||||
get() = TopAndRecentlyPlayedTracksLoader.getTopAlbums(context)
|
get() = TopAndRecentlyPlayedTracksLoader.getTopAlbums(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val allArtists: Observable<ArrayList<Artist>>
|
override val allArtists: Observable<ArrayList<Artist>>
|
||||||
get() = ArtistLoader.getAllArtists(context)
|
get() = ArtistLoader.getAllArtists(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val recentArtists: Observable<ArrayList<Artist>>
|
override val recentArtists: Observable<ArrayList<Artist>>
|
||||||
get() = LastAddedSongsLoader.getLastAddedArtists(context)
|
get() = LastAddedSongsLoader.getLastAddedArtists(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val topArtists: Observable<ArrayList<Artist>>
|
override val topArtists: Observable<ArrayList<Artist>>
|
||||||
get() = TopAndRecentlyPlayedTracksLoader.getTopArtists(context)
|
get() = TopAndRecentlyPlayedTracksLoader.getTopArtists(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val allPlaylists: Observable<ArrayList<Playlist>>
|
override val allPlaylists: Observable<ArrayList<Playlist>>
|
||||||
get() = PlaylistLoader.getAllPlaylists(context)
|
get() = PlaylistLoader.getAllPlaylists(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val homeList: Observable<ArrayList<Playlist>>
|
override val homeList: Observable<ArrayList<Playlist>>
|
||||||
get() = HomeLoader.getHomeLoader(context)
|
get() = HomeLoader.getHomeLoader(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val allThings: Observable<ArrayList<AbsSmartPlaylist>>
|
override val allThings: Observable<ArrayList<AbsSmartPlaylist>>
|
||||||
get() = HomeLoader.getRecentAndTopThings(context)
|
get() = HomeLoader.getRecentAndTopThings(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override val allGenres: Observable<ArrayList<Genre>>
|
override val allGenres: Observable<ArrayList<Genre>>
|
||||||
get() = GenreLoader.getAllGenres(context)
|
get() = GenreLoader.getAllGenres(context)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|
||||||
override fun getSong(id: Int): Observable<Song> {
|
override fun getSong(id: Int): Observable<Song> {
|
||||||
return SongLoader.getSong(context, id)
|
return SongLoader.getSong(context, id)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAlbum(albumId: Int): Observable<Album> {
|
override fun getAlbum(albumId: Int): Observable<Album> {
|
||||||
return AlbumLoader.getAlbum(context, albumId)
|
return AlbumLoader.getAlbum(context, albumId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getArtistById(artistId: Long): Observable<Artist> {
|
override fun getArtistById(artistId: Long): Observable<Artist> {
|
||||||
return ArtistLoader.getArtist(context, artistId.toInt())
|
return ArtistLoader.getArtist(context, artistId.toInt())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun search(query: String?): Observable<ArrayList<Any>> {
|
override fun search(query: String?): Observable<ArrayList<Any>> {
|
||||||
return SearchLoader.searchAll(context, query)
|
return SearchLoader.searchAll(context, query)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPlaylistSongs(playlist: Playlist): Observable<ArrayList<Song>> {
|
override fun getPlaylistSongs(playlist: Playlist): Observable<ArrayList<Song>> {
|
||||||
return PlaylistSongsLoader.getPlaylistSongList(context, playlist)
|
return PlaylistSongsLoader.getPlaylistSongList(context, playlist)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getGenre(genreId: Int): Observable<ArrayList<Song>> {
|
override fun getGenre(genreId: Int): Observable<ArrayList<Song>> {
|
||||||
return GenreLoader.getSongs(context, genreId)
|
return GenreLoader.getSongs(context, genreId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,12 @@ import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This database tracks the number of play counts for an individual song. This is used to drive
|
* This database tracks the number of play counts for an individual song. This is used to drive
|
||||||
* the top played tracks as well as the playlist images
|
* the top played tracks as well as the playlist images
|
||||||
|
|
|
@ -30,13 +30,14 @@
|
||||||
app:elevation="0dp">
|
app:elevation="0dp">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/toolbarContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
app:cardElevation="6dp"
|
app:strokeColor="@color/black_color"
|
||||||
android:id="@+id/toolbarContainer"
|
|
||||||
app:cardUseCompatPadding="true"
|
app:cardUseCompatPadding="true"
|
||||||
app:layout_scrollFlags="scroll|enterAlways">
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
app:strokeWidth="1dp">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/contentContainer"
|
android:id="@+id/contentContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -40,7 +39,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.IconImageView
|
<code.name.monkey.retromusic.views.IconImageView
|
||||||
android:layout_width="96dp"
|
android:layout_width="96dp"
|
||||||
|
@ -53,7 +53,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="@string/empty"
|
android:text="@string/empty"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary" />
|
||||||
tools:visibility="visible" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -623,4 +623,5 @@
|
||||||
<string name="premium">Get Premium</string>
|
<string name="premium">Get Premium</string>
|
||||||
<string name="pro_summary">Now playing themes, Carousel effect, Color theme and more..</string>
|
<string name="pro_summary">Now playing themes, Carousel effect, Color theme and more..</string>
|
||||||
<string name="action_play_all">Play all</string>
|
<string name="action_play_all">Play all</string>
|
||||||
|
<string name="start_play_music">Start playing music.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -26,9 +26,9 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
|
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
|
||||||
implementation 'com.google.android.material:material:1.1.0-alpha05'
|
implementation 'com.google.android.material:material:1.1.0-alpha07'
|
||||||
implementation 'androidx.preference:preference:1.1.0-alpha05'
|
implementation 'androidx.preference:preference:1.1.0-beta01'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
// Used for the list preference classes
|
// Used for the list preference classes
|
||||||
implementation 'com.afollestad.material-dialogs:core:3.0.0-alpha1'
|
implementation 'com.afollestad.material-dialogs:core:3.0.0-alpha1'
|
||||||
|
|
10
build.gradle
10
build.gradle
|
@ -1,19 +1,13 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.31'
|
ext.kotlin_version = '1.3.40'
|
||||||
ext {
|
|
||||||
supportLibVersion = '1.1.0-alpha05'
|
|
||||||
firebase = "11.8.0"
|
|
||||||
retrofit = "2.3.0"
|
|
||||||
materialDialog = "2.0.0"
|
|
||||||
}
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
classpath 'com.android.tools.build:gradle:3.3.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue