-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Spanish, Add Featured On in Artist Page, Add some thing new in Ho…
…me Page
- Loading branch information
1 parent
3dde931
commit 3dc1714
Showing
31 changed files
with
736 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/src/main/java/com/maxrave/simpmusic/adapter/artist/FeaturedOnAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.maxrave.simpmusic.adapter.artist | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import coil.load | ||
import com.maxrave.simpmusic.data.model.browse.artist.ResultPlaylist | ||
import com.maxrave.simpmusic.databinding.ItemSinglesBinding | ||
|
||
class FeaturedOnAdapter(private var playlistList: ArrayList<ResultPlaylist>) : | ||
RecyclerView.Adapter<FeaturedOnAdapter.ViewHolder>() { | ||
private lateinit var mListener: OnItemClickListener | ||
|
||
interface OnItemClickListener { | ||
fun onItemClick(position: Int, type: String = "playlist") | ||
} | ||
|
||
fun setOnClickListener(listener: OnItemClickListener) { | ||
mListener = listener | ||
} | ||
|
||
|
||
inner class ViewHolder(val binding: ItemSinglesBinding, listener: OnItemClickListener) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
init { | ||
binding.root.setOnClickListener { | ||
listener.onItemClick(bindingAdapterPosition) | ||
} | ||
} | ||
} | ||
|
||
fun updateList(newList: ArrayList<ResultPlaylist>) { | ||
playlistList.clear() | ||
playlistList.addAll(newList) | ||
notifyDataSetChanged() | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
return ViewHolder( | ||
ItemSinglesBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
), mListener | ||
) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return playlistList.size | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
val album = playlistList[position] | ||
with(holder.binding) { | ||
tvAlbumName.text = album.title | ||
tvAlbumYear.text = album.author | ||
ivAlbumArt.load(album.thumbnails.lastOrNull()?.url) | ||
} | ||
} | ||
|
||
fun getItem(position: Int): ResultPlaylist { | ||
return playlistList[position] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/maxrave/simpmusic/data/model/browse/artist/ResultPlaylist.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.maxrave.simpmusic.data.model.browse.artist | ||
|
||
import com.maxrave.simpmusic.data.model.searchResult.songs.Thumbnail | ||
|
||
data class ResultPlaylist( | ||
val id: String, | ||
val author: String, | ||
val thumbnails: List<Thumbnail>, | ||
val title: String, | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.