├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ └── styles.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── layout │ │ │ ├── item_trending_view_type.xml │ │ │ ├── item_topics_header.xml │ │ │ ├── item_news.xml │ │ │ ├── activity_home.xml │ │ │ └── item_trending.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── kotlin │ │ └── erikjhordanrey │ │ │ └── github │ │ │ └── io │ │ │ ├── domain │ │ │ ├── News.kt │ │ │ └── Trending.kt │ │ │ ├── ui │ │ │ ├── adapter │ │ │ │ ├── NewsDiffCallback.kt │ │ │ │ ├── TrendingViewTypeViewHolder.kt │ │ │ │ ├── TrendingDiffCallback.kt │ │ │ │ ├── NewsViewHolder.kt │ │ │ │ ├── TopicsHeaderViewHolder.kt │ │ │ │ ├── TrendingViewHolder.kt │ │ │ │ ├── NewsAdapter.kt │ │ │ │ ├── TopicsHeaderAdapter.kt │ │ │ │ └── TrendingAdapter.kt │ │ │ └── HomeActivity.kt │ │ │ └── data │ │ │ └── DataProvider.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── art └── Screenshot.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='RecyclerView-MergeAdapter' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /art/Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/art/Screenshot.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/domain/News.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.domain 2 | 3 | data class News(val title: String, val dateCategory: String) 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikjhordan-rey/RecyclerView-ConcatAdapter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/domain/Trending.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.domain 2 | 3 | data class Trending(val id: String, val title: String, val viewsCounter: String) 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RecyclerView-ConcatAdapter 3 | Topics Header 4 | Trending ViewType 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 27 22:55:03 CDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | .idea 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #263238 4 | #000a12 5 | #03DAC5 6 | 7 | #ff5c8d 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12sp 4 | 14sp 5 | 16sp 6 | 7 | 8 | 0dp 9 | 8dp 10 | 16dp 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/ui/adapter/NewsDiffCallback.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.ui.adapter 2 | 3 | import androidx.recyclerview.widget.DiffUtil 4 | import erikjhordanrey.github.io.domain.News 5 | 6 | class NewsDiffCallback : DiffUtil.ItemCallback() { 7 | 8 | override fun areItemsTheSame(oldItem: News, newItem: News) = 9 | oldItem.title == newItem.title && oldItem.dateCategory == newItem.dateCategory 10 | 11 | override fun areContentsTheSame(oldItem: News, newItem: News) = oldItem == newItem 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/ui/adapter/TrendingViewTypeViewHolder.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.ui.adapter 2 | 3 | import androidx.recyclerview.widget.RecyclerView 4 | import erikjhordanrey.github.io.databinding.ItemTrendingViewTypeBinding 5 | 6 | class TrendingViewTypeViewHolder(private val binding: ItemTrendingViewTypeBinding, private val onSeeMoreListener: ((String) -> Unit)?) : 7 | RecyclerView.ViewHolder(binding.root) { 8 | 9 | fun bind() { 10 | itemView.setOnClickListener { onSeeMoreListener?.invoke(binding.titleTextView.text.toString()) } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/ui/adapter/TrendingDiffCallback.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.ui.adapter 2 | 3 | import androidx.recyclerview.widget.DiffUtil 4 | import erikjhordanrey.github.io.domain.Trending 5 | 6 | class TrendingDiffCallback : DiffUtil.ItemCallback() { 7 | 8 | override fun areItemsTheSame(oldItem: Trending, newItem: Trending) = 9 | oldItem.id == newItem.id && oldItem.title == newItem.title && oldItem.viewsCounter == newItem.viewsCounter 10 | 11 | override fun areContentsTheSame(oldItem: Trending, newItem: Trending) = oldItem == newItem 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/kotlin/erikjhordanrey/github/io/ui/adapter/NewsViewHolder.kt: -------------------------------------------------------------------------------- 1 | package erikjhordanrey.github.io.ui.adapter 2 | 3 | import androidx.recyclerview.widget.RecyclerView 4 | import erikjhordanrey.github.io.databinding.ItemNewsBinding 5 | import erikjhordanrey.github.io.domain.News 6 | 7 | class NewsViewHolder(private val binding: ItemNewsBinding, 8 | private val onNewsListener: ((News) -> Unit)?) : RecyclerView.ViewHolder(binding.root) { 9 | 10 | fun bind(news: News) = news.run { 11 | binding.dateCategoryTextView.text = dateCategory 12 | binding.titleTextView.text = title 13 | itemView.setOnClickListener { onNewsListener?.invoke(this) } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 |