adding a tab for artists

This commit is contained in:
tibbi 2020-09-30 15:35:57 +02:00
parent e0e163e4c8
commit 97db70c4e4
4 changed files with 28 additions and 3 deletions

View file

@ -222,7 +222,7 @@ class MainActivity : SimpleActivity(), MainActivityInterface {
}
)
val tabLabels = arrayOf("PLAYER", "PLAYLISTS")
val tabLabels = arrayOf("PLAYER", "PLAYLISTS", "ARTISTS")
main_tabs_holder.apply {
setTabTextColors(config.backgroundColor.getContrastColor(), getAdjustedPrimaryColor())
setSelectedTabIndicatorColor(getAdjustedPrimaryColor())

View file

@ -24,12 +24,13 @@ class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() {
container.removeView(item as View)
}
override fun getCount() = 2
override fun getCount() = 3
override fun isViewFromObject(view: View, item: Any) = view == item
private fun getFragment(position: Int) = when (position) {
0 -> R.layout.fragment_songs
else -> R.layout.fragment_playlists
1 -> R.layout.fragment_playlists
else -> R.layout.fragment_artists
}
}

View file

@ -0,0 +1,9 @@
package com.simplemobiletools.musicplayer.fragments
import android.content.Context
import android.util.AttributeSet
import com.simplemobiletools.musicplayer.activities.SimpleActivity
class ArtistssFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
override fun setupFragment(activity: SimpleActivity) {}
}

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.musicplayer.fragments.ArtistssFragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/artists_fragment_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/artists_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
</com.simplemobiletools.musicplayer.fragments.ArtistssFragment>