Added music note off for empty view
This commit is contained in:
parent
40ac73e2c9
commit
14a113e73f
10 changed files with 36 additions and 37 deletions
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
|||
|
||||
open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(), AlbumContract.AlbumView {
|
||||
|
||||
private var presenter: AlbumPresenter? = null
|
||||
private lateinit var presenter: AlbumPresenter
|
||||
|
||||
|
||||
override val emptyMessage: Int
|
||||
|
@ -48,7 +48,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
}
|
||||
|
||||
override fun setSortOrder(sortOrder: String) {
|
||||
presenter!!.loadAlbums()
|
||||
presenter.loadAlbums()
|
||||
}
|
||||
|
||||
override fun loadSortOrder(): String {
|
||||
|
@ -87,7 +87,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
}
|
||||
|
||||
override fun onMediaStoreChanged() {
|
||||
presenter!!.loadAlbums()
|
||||
presenter.loadAlbums()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -113,13 +113,13 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.albums)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter!!.subscribe()
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
presenter!!.unsubscribe()
|
||||
presenter.unsubscribe()
|
||||
}
|
||||
|
||||
override fun loading() {}
|
||||
|
@ -136,7 +136,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
|
||||
companion object {
|
||||
|
||||
val TAG = AlbumsFragment::class.java.simpleName
|
||||
val TAG: String = AlbumsFragment::class.java.simpleName
|
||||
|
||||
fun newInstance(): AlbumsFragment {
|
||||
val args = Bundle()
|
||||
|
|
|
@ -12,7 +12,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
|||
import java.util.*
|
||||
|
||||
class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(), ArtistContract.ArtistView {
|
||||
private var presenter: ArtistPresenter? = null
|
||||
private lateinit var presenter: ArtistPresenter
|
||||
|
||||
override val emptyMessage: Int
|
||||
get() = R.string.no_artists
|
||||
|
@ -37,7 +37,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
}
|
||||
|
||||
override fun onMediaStoreChanged() {
|
||||
presenter!!.loadArtists()
|
||||
presenter.loadArtists()
|
||||
}
|
||||
|
||||
override fun loadGridSize(): Int {
|
||||
|
@ -83,7 +83,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
}
|
||||
|
||||
override fun setSortOrder(sortOrder: String) {
|
||||
presenter!!.loadArtists()
|
||||
presenter.loadArtists()
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,13 +103,13 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
libraryFragment.setTitle(
|
||||
if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.artists)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter!!.subscribe()
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
presenter!!.unsubscribe()
|
||||
presenter.unsubscribe()
|
||||
}
|
||||
|
||||
override fun loading() {}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.*
|
|||
|
||||
class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>(), PlaylistContract.PlaylistView {
|
||||
|
||||
private var presenter: PlaylistPresenter? = null
|
||||
private lateinit var presenter: PlaylistPresenter
|
||||
|
||||
override val emptyMessage: Int
|
||||
get() = R.string.no_playlists
|
||||
|
@ -47,18 +47,18 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
|
|||
super.onResume()
|
||||
libraryFragment.setTitle(if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.playlists)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter!!.subscribe()
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
presenter!!.unsubscribe()
|
||||
presenter.unsubscribe()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onMediaStoreChanged() {
|
||||
super.onMediaStoreChanged()
|
||||
presenter!!.loadPlaylists()
|
||||
presenter.loadPlaylists()
|
||||
}
|
||||
|
||||
override fun loading() {
|
||||
|
|
|
@ -83,7 +83,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
super.onResume()
|
||||
libraryFragment.setTitle(if (PreferenceUtil.getInstance().tabTitles()) R.string.library else R.string.songs)
|
||||
if (adapter!!.dataSet.isEmpty()) {
|
||||
presenter!!.subscribe()
|
||||
presenter.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
}
|
||||
|
||||
override fun setSortOrder(sortOrder: String) {
|
||||
presenter!!.loadSongs()
|
||||
presenter.loadSongs()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -42,10 +42,6 @@ import java.util.*
|
|||
import kotlin.collections.ArrayList
|
||||
|
||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
|
||||
override fun showEmpty() {
|
||||
emptyContainer.show()
|
||||
emptyText.setText(R.string.start_play_music)
|
||||
}
|
||||
|
||||
private var disposable: Disposable? = null
|
||||
private lateinit var homePresenter: HomePresenter
|
||||
|
@ -185,7 +181,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
override fun showEmptyView() {
|
||||
|
||||
emptyContainer.show()
|
||||
}
|
||||
|
||||
override fun completed() {
|
||||
|
@ -205,6 +201,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private lateinit var homeAdapter: HomeAdapter
|
||||
|
||||
override fun showData(list: ArrayList<Home>) {
|
||||
if (list.isEmpty()){
|
||||
showEmptyView()
|
||||
return
|
||||
}
|
||||
val finalList = list.sortedWith(compareBy { it.priority })
|
||||
homeAdapter.swapData(finalList)
|
||||
recyclerView.apply {
|
||||
|
|
|
@ -20,12 +20,9 @@ import code.name.monkey.retromusic.mvp.BaseView
|
|||
|
||||
interface HomeContract {
|
||||
|
||||
interface HomeView : BaseView<ArrayList<Home>> {
|
||||
fun showEmpty()
|
||||
}
|
||||
interface HomeView : BaseView<ArrayList<Home>>
|
||||
|
||||
interface HomePresenter : BasePresenter<HomeView> {
|
||||
|
||||
fun homeSections();
|
||||
fun homeSections()
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
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.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
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.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
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.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
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.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
if (it.isNotEmpty()) hashSet.add(Home(4, R.string.favorites, 0, it, PLAYLISTS, R.drawable.ic_favorite_white_24dp))
|
||||
view.showData(ArrayList(hashSet))
|
||||
}, {
|
||||
view.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
|
|||
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.showEmpty()
|
||||
view.showEmptyView()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
app:srcCompat="@drawable/ic_disc_full_black_24dp" />
|
||||
app:srcCompat="@drawable/ic_music_note_off_white_24dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/emptyText"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
<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:id="@+id/contentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,19 +41,20 @@
|
|||
android:layout_gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone">
|
||||
|
||||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
app:srcCompat="@drawable/ic_disc_full_black_24dp" />
|
||||
app:srcCompat="@drawable/ic_music_note_off_white_24dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/emptyText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/empty"
|
||||
android:text="@string/start_play_music"
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
Loading…
Reference in a new issue