From 19b4c98e2b81fb2f544729c260f69fcf723e3623 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Oct 2020 20:44:26 +0200 Subject: [PATCH] rename SongAdapter to OldSongAdapter, create a new one --- .../adapters/{SongAdapter.kt => OldSongAdapter.kt} | 8 ++++---- .../musicplayer/fragments/SongsFragment.kt | 8 ++++---- .../main/res/layout/{item_song.xml => item_old_song.xml} | 0 3 files changed, 8 insertions(+), 8 deletions(-) rename app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/{SongAdapter.kt => OldSongAdapter.kt} (97%) rename app/src/main/res/layout/{item_song.xml => item_old_song.xml} (100%) diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt similarity index 97% rename from app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt rename to app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt index d2f56256..eacc76e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt @@ -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, val listener: SongListListener, val transparentView: View, - recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) : +class OldSongAdapter(activity: SimpleActivity, var songs: ArrayList, 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, 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) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/SongsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/SongsFragment.kt index c4784d96..2e5c6349 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/SongsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/SongsFragment.kt @@ -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 { diff --git a/app/src/main/res/layout/item_song.xml b/app/src/main/res/layout/item_old_song.xml similarity index 100% rename from app/src/main/res/layout/item_song.xml rename to app/src/main/res/layout/item_old_song.xml