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
package com.danielmalone.podcast | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import kotlinx.android.synthetic.main.activity_main.* | |
import kotlinx.android.synthetic.main.content_main.* | |
class MainActivity : AppCompatActivity() { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/podcastTitle" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" |
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
package com.danielmalone.podcast | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
class PodcastsAdapter : |
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
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PodcastViewHolder { | |
val inflater = LayoutInflater.from(parent.context) | |
return PodcastViewHolder(inflater.inflate(R.layout.podcast_item, parent, false)) | |
} |
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
class PodcastsAdapter : | |
ListAdapter<Podcast, PodcastsAdapter.PodcastViewHolder>(PodcastDiffCallback()) { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PodcastViewHolder { | |
} | |
override fun onBindViewHolder(holder: PodcastViewHolder, position: Int) { | |
} | |
class PodcastViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { |
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
class PodcastsAdapter : ListAdapter<Podcast, PodcastViewHolder>(PodcastDiffCallback()) { | |
class PodcastViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |
fun bind() { | |
} | |
} | |
} |
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
class PodcastDiffCallback : DiffUtil.ItemCallback<Podcast>() { | |
override fun areItemsTheSame(oldItem: Podcast, newItem: Podcast): Boolean { | |
return true | |
} | |
override fun areContentsTheSame(oldItem: Podcast, newItem: Podcast): Boolean { | |
return true | |
} | |
} |
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
package com.danielmalone.podcast | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
class PodcastsAdapter : ListAdapter<Podcast, PodcastViewHolder>(PodcastDiffCallback()) { | |
} | |
class PodcastDiffCallback : DiffUtil.ItemCallback<Podcast>() { | |
} |
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
package com.danielmalone.podcast | |
data class Podcast( | |
val title: String, | |
val duration: 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
package com.danielmalone.podcast | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import kotlinx.android.synthetic.main.activity_main.* | |
import kotlinx.android.synthetic.main.content_main.* | |
class MainActivity : AppCompatActivity() { |