-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented a recycler view to display information like song name artist name and song cover and also a progress Bar to display visually download progress. Know issue: If you leave the app and reenter the app the application will crash working on a fix but it will probably be a while
- Loading branch information
Showing
13 changed files
with
251 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/example/spotifydownloader/model/recyclerViewAdaptor.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,56 @@ | ||
package com.example.spotifydownloader.model | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.ProgressBar | ||
import android.widget.TextView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import coil.load | ||
import com.example.spotifydownloader.R | ||
|
||
class recyclerViewAdaptor (private val songData: List<songItemData>) | ||
:RecyclerView.Adapter<recyclerViewAdaptor.ViewHolder>() { | ||
|
||
|
||
|
||
|
||
class ViewHolder(ItemView: View):RecyclerView.ViewHolder(ItemView){ | ||
val songCoverImage: ImageView = itemView.findViewById(R.id.songCoverImage) | ||
val songTitle : TextView = itemView.findViewById(R.id.songTitle) | ||
val artistName : TextView = itemView.findViewById(R.id.artistName) | ||
val progressBar : ProgressBar = itemView.findViewById(R.id.progressBar) | ||
|
||
|
||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
val view = LayoutInflater.from(parent.context).inflate(R.layout.song_item,parent,false) | ||
return ViewHolder(view) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return songData.size | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
val recyclerViewAdaptor = songData[position] | ||
|
||
holder.songCoverImage.load(recyclerViewAdaptor.imageUrl) | ||
|
||
|
||
if (recyclerViewAdaptor.songName.length>19) { | ||
holder.songTitle.text = recyclerViewAdaptor.songName.take(17).plus("...") | ||
} | ||
else{ | ||
holder.songTitle.text = recyclerViewAdaptor.songName | ||
} | ||
holder.artistName.text = recyclerViewAdaptor.artistName | ||
holder.progressBar.progress = recyclerViewAdaptor.progress | ||
|
||
|
||
} | ||
|
||
|
||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/example/spotifydownloader/model/songItemData.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,8 @@ | ||
package com.example.spotifydownloader.model | ||
|
||
import android.graphics.Bitmap | ||
|
||
data class songItemData(val imageUrl : String, | ||
val songName: String, | ||
val artistName:String, | ||
var progress:Int) |
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.