code clean
This commit is contained in:
parent
6845f75ea0
commit
1b08b775ac
10 changed files with 37 additions and 48 deletions
|
@ -239,15 +239,17 @@ class HomeAdapter(
|
|||
val clickableArea: ViewGroup = itemView.findViewById(R.id.clickable_area)
|
||||
}
|
||||
|
||||
fun artistsAdapter(artists: List<Artist>) =
|
||||
private fun artistsAdapter(artists: List<Artist>) =
|
||||
ArtistAdapter(activity, artists, PreferenceUtil.homeArtistGridStyle, null, this)
|
||||
|
||||
fun albumAdapter(albums: List<Album>) =
|
||||
private fun albumAdapter(albums: List<Album>) =
|
||||
AlbumAdapter(activity, albums, PreferenceUtil.homeAlbumGridStyle, null, this)
|
||||
|
||||
fun gridLayoutManager() = GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
|
||||
private fun gridLayoutManager() =
|
||||
GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
|
||||
|
||||
fun linearLayoutManager() = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||
private fun linearLayoutManager() =
|
||||
LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
override fun onArtist(artistId: Long, view: View) {
|
||||
activity.findNavController(R.id.fragment_container).navigate(
|
||||
|
|
|
@ -42,10 +42,10 @@ class SongFileAdapter(
|
|||
private val activity: AppCompatActivity,
|
||||
private var dataSet: List<File>,
|
||||
private val itemLayoutRes: Int,
|
||||
private val ICallbacks: ICallbacks?,
|
||||
ICabHolder: ICabHolder?
|
||||
private val iCallbacks: ICallbacks?,
|
||||
iCabHolder: ICabHolder?
|
||||
) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(
|
||||
activity, ICabHolder, R.menu.menu_media_selection
|
||||
activity, iCabHolder, R.menu.menu_media_selection
|
||||
), PopupTextProvider {
|
||||
|
||||
init {
|
||||
|
@ -135,8 +135,8 @@ class SongFileAdapter(
|
|||
}
|
||||
|
||||
override fun onMultipleItemAction(menuItem: MenuItem, selection: List<File>) {
|
||||
if (ICallbacks == null) return
|
||||
ICallbacks.onMultipleItemAction(menuItem, selection as ArrayList<File>)
|
||||
if (iCallbacks == null) return
|
||||
iCallbacks.onMultipleItemAction(menuItem, selection as ArrayList<File>)
|
||||
}
|
||||
|
||||
override fun getPopupText(position: Int): String {
|
||||
|
@ -150,11 +150,11 @@ class SongFileAdapter(
|
|||
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
|
||||
|
||||
init {
|
||||
if (menu != null && ICallbacks != null) {
|
||||
if (menu != null && iCallbacks != null) {
|
||||
menu?.setOnClickListener { v ->
|
||||
val position = layoutPosition
|
||||
if (isPositionInRange(position)) {
|
||||
ICallbacks.onFileMenuClicked(dataSet[position], v)
|
||||
iCallbacks.onFileMenuClicked(dataSet[position], v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class SongFileAdapter(
|
|||
if (isInQuickSelectMode) {
|
||||
toggleChecked(position)
|
||||
} else {
|
||||
ICallbacks?.onFileSelected(dataSet[position])
|
||||
iCallbacks?.onFileSelected(dataSet[position])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class ArtistAdapter(
|
|||
loadArtistImage(artist, holder)
|
||||
}
|
||||
|
||||
fun setColors(processor: MediaNotificationProcessor, holder: ViewHolder) {
|
||||
private fun setColors(processor: MediaNotificationProcessor, holder: ViewHolder) {
|
||||
holder.mask?.backgroundTintList = ColorStateList.valueOf(processor.primaryTextColor)
|
||||
if (holder.paletteColorContainer != null) {
|
||||
holder.paletteColorContainer?.setBackgroundColor(processor.backgroundColor)
|
||||
|
|
|
@ -24,13 +24,13 @@ import code.name.monkey.retromusic.dialogs.RemoveSongFromPlaylistDialog
|
|||
import code.name.monkey.retromusic.interfaces.ICabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
||||
open class PlaylistSongAdapter(
|
||||
class PlaylistSongAdapter(
|
||||
private val playlist: PlaylistEntity,
|
||||
activity: FragmentActivity,
|
||||
dataSet: MutableList<Song>,
|
||||
itemLayoutRes: Int,
|
||||
ICabHolder: ICabHolder?
|
||||
) : SongAdapter(activity, dataSet, itemLayoutRes, ICabHolder) {
|
||||
iCabHolder: ICabHolder?
|
||||
) : SongAdapter(activity, dataSet, itemLayoutRes, iCabHolder) {
|
||||
|
||||
init {
|
||||
this.setMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue