rename SongAdapter to OldSongAdapter, create a new one

This commit is contained in:
tibbi 2020-10-01 20:44:26 +02:00
parent 63f8a0f2d1
commit 19b4c98e2b
3 changed files with 8 additions and 8 deletions

View file

@ -25,10 +25,10 @@ import com.simplemobiletools.musicplayer.interfaces.SongListListener
import com.simplemobiletools.musicplayer.models.Song import com.simplemobiletools.musicplayer.models.Song
import com.simplemobiletools.musicplayer.services.MusicService import com.simplemobiletools.musicplayer.services.MusicService
import kotlinx.android.synthetic.main.item_navigation.view.* import kotlinx.android.synthetic.main.item_navigation.view.*
import kotlinx.android.synthetic.main.item_song.view.* import kotlinx.android.synthetic.main.item_old_song.view.*
class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val listener: SongListListener, val transparentView: View, class OldSongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val listener: SongListListener, val transparentView: View,
recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) : recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private val VIEW_TYPE_TRANSPARENT = 0 private val VIEW_TYPE_TRANSPARENT = 0
@ -63,7 +63,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
return when (viewType) { return when (viewType) {
VIEW_TYPE_TRANSPARENT -> getTransparentViewHolder() VIEW_TYPE_TRANSPARENT -> getTransparentViewHolder()
VIEW_TYPE_NAVIGATION -> getNavigationViewHolder() VIEW_TYPE_NAVIGATION -> getNavigationViewHolder()
else -> createViewHolder(R.layout.item_song, parent) else -> createViewHolder(R.layout.item_old_song, parent)
} }
} }

View file

@ -15,7 +15,7 @@ import com.simplemobiletools.commons.interfaces.RecyclerScrollCallback
import com.simplemobiletools.commons.views.MyLinearLayoutManager import com.simplemobiletools.commons.views.MyLinearLayoutManager
import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.SimpleActivity import com.simplemobiletools.musicplayer.activities.SimpleActivity
import com.simplemobiletools.musicplayer.adapters.SongAdapter import com.simplemobiletools.musicplayer.adapters.OldSongAdapter
import com.simplemobiletools.musicplayer.extensions.config import com.simplemobiletools.musicplayer.extensions.config
import com.simplemobiletools.musicplayer.extensions.getActionBarHeight import com.simplemobiletools.musicplayer.extensions.getActionBarHeight
import com.simplemobiletools.musicplayer.extensions.sendIntent import com.simplemobiletools.musicplayer.extensions.sendIntent
@ -248,7 +248,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
} }
if (currAdapter == null) { if (currAdapter == null) {
SongAdapter(activity, songs, this, artView!!, songs_list, songs_fastscroller) { OldSongAdapter(activity, songs, this, artView!!, songs_list, songs_fastscroller) {
songPicked(getSongIndex(it as Song)) songPicked(getSongIndex(it as Song))
}.apply { }.apply {
isThirdPartyIntent = activityInterface.getIsThirdPartyIntent() isThirdPartyIntent = activityInterface.getIsThirdPartyIntent()
@ -256,7 +256,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
} }
} else { } else {
val state = (songs_list.layoutManager as MyLinearLayoutManager).onSaveInstanceState() val state = (songs_list.layoutManager as MyLinearLayoutManager).onSaveInstanceState()
(currAdapter as SongAdapter).apply { (currAdapter as OldSongAdapter).apply {
isThirdPartyIntent = activityInterface.getIsThirdPartyIntent() isThirdPartyIntent = activityInterface.getIsThirdPartyIntent()
updateSongs(songs) updateSongs(songs)
} }
@ -312,7 +312,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
private fun getSongIndex(song: Song) = songs.indexOfFirstOrNull { it == song } ?: 0 private fun getSongIndex(song: Song) = songs.indexOfFirstOrNull { it == song } ?: 0
fun getSongsAdapter() = songs_list.adapter as? SongAdapter fun getSongsAdapter() = songs_list.adapter as? OldSongAdapter
private fun initSeekbarChangeListener() { private fun initSeekbarChangeListener() {
song_progressbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { song_progressbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {