rename SongAdapter to OldSongAdapter, create a new one
This commit is contained in:
parent
63f8a0f2d1
commit
19b4c98e2b
3 changed files with 8 additions and 8 deletions
|
@ -25,10 +25,10 @@ import com.simplemobiletools.musicplayer.interfaces.SongListListener
|
|||
import com.simplemobiletools.musicplayer.models.Song
|
||||
import com.simplemobiletools.musicplayer.services.MusicService
|
||||
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,
|
||||
recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) :
|
||||
class OldSongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val listener: SongListListener, val transparentView: View,
|
||||
recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) :
|
||||
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
||||
|
||||
private val VIEW_TYPE_TRANSPARENT = 0
|
||||
|
@ -63,7 +63,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
|
|||
return when (viewType) {
|
||||
VIEW_TYPE_TRANSPARENT -> getTransparentViewHolder()
|
||||
VIEW_TYPE_NAVIGATION -> getNavigationViewHolder()
|
||||
else -> createViewHolder(R.layout.item_song, parent)
|
||||
else -> createViewHolder(R.layout.item_old_song, parent)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ import com.simplemobiletools.commons.interfaces.RecyclerScrollCallback
|
|||
import com.simplemobiletools.commons.views.MyLinearLayoutManager
|
||||
import com.simplemobiletools.musicplayer.R
|
||||
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.getActionBarHeight
|
||||
import com.simplemobiletools.musicplayer.extensions.sendIntent
|
||||
|
@ -248,7 +248,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||
}
|
||||
|
||||
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))
|
||||
}.apply {
|
||||
isThirdPartyIntent = activityInterface.getIsThirdPartyIntent()
|
||||
|
@ -256,7 +256,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||
}
|
||||
} else {
|
||||
val state = (songs_list.layoutManager as MyLinearLayoutManager).onSaveInstanceState()
|
||||
(currAdapter as SongAdapter).apply {
|
||||
(currAdapter as OldSongAdapter).apply {
|
||||
isThirdPartyIntent = activityInterface.getIsThirdPartyIntent()
|
||||
updateSongs(songs)
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ class SongsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||
|
||||
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() {
|
||||
song_progressbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
||||
|
|
Loading…
Reference in a new issue