diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/adapters/HomeAdapter.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/adapters/HomeAdapter.kt index 54d966a1..0f1da876 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/adapters/HomeAdapter.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/adapters/HomeAdapter.kt @@ -60,7 +60,10 @@ import com.pennapps.labs.pennmobile.databinding.HomePostCardBinding import com.pennapps.labs.pennmobile.databinding.PollCardBinding import com.pennapps.labs.pennmobile.utils.Utils import com.pennapps.labs.pennmobile.viewholders.HomeBaseHolder +import com.pennapps.labs.pennmobile.viewholders.HomeCalendarHolder +import com.pennapps.labs.pennmobile.viewholders.HomeDiningHolder import com.pennapps.labs.pennmobile.viewholders.HomeGSRHolder +import com.pennapps.labs.pennmobile.viewholders.HomeLaundryHolder import com.pennapps.labs.pennmobile.viewholders.HomeNewsCardHolder import com.pennapps.labs.pennmobile.viewholders.HomePollHolder import com.pennapps.labs.pennmobile.viewholders.HomePostHolder @@ -111,6 +114,21 @@ class HomeAdapter( mActivity = mContext as MainActivity return when (viewType) { + DINING -> { + val itemBinding = HomeBaseCardBinding.inflate(LayoutInflater.from(mContext), parent, false) + return HomeDiningHolder(itemBinding) + } + + CALENDAR -> { + val itemBinding = HomeBaseCardBinding.inflate(LayoutInflater.from(mContext), parent, false) + return HomeCalendarHolder(itemBinding) + } + + LAUNDRY -> { + val itemBinding = HomeBaseCardBinding.inflate(LayoutInflater.from(mContext), parent, false) + return HomeLaundryHolder(itemBinding) + } + NEWS -> { val itemBinding = HomeNewsCardBinding.inflate(LayoutInflater.from(mContext), parent, false) return HomeNewsCardHolder(itemBinding) @@ -155,10 +173,10 @@ class HomeAdapter( ) { val cell = dataModel.getCell(position) when (cell.type) { - "dining" -> bindDiningCell(holder as HomeBaseHolder, cell as DiningCell) - "calendar" -> bindCalendarCell(holder as HomeBaseHolder, cell as CalendarCell) + "dining" -> bindDiningCell(holder as HomeDiningHolder, cell as DiningCell) + "calendar" -> bindCalendarCell(holder as HomeCalendarHolder, cell as CalendarCell) "news" -> bindNewsCard(holder as HomeNewsCardHolder, cell as NewsCell) - "laundry" -> bindLaundryCell(holder as HomeBaseHolder, cell as LaundryCell) + "laundry" -> bindLaundryCell(holder as HomeLaundryHolder, cell as LaundryCell) "post" -> bindPostCell(holder as HomePostHolder, cell as PostCell) "poll" -> bindPollCell(holder as HomePollHolder, position, cell as PollCell) "gsr_booking" -> bindGSRCell(holder as HomeGSRHolder, cell as GSRCell) @@ -212,7 +230,7 @@ class HomeAdapter( } private fun bindLaundryCell( - holder: HomeBaseHolder, + holder: HomeLaundryHolder, cell: LaundryCell, ) { val roomID = cell.roomId @@ -246,7 +264,7 @@ class HomeAdapter( } private fun bindDiningCell( - holder: HomeBaseHolder, + holder: HomeDiningHolder, cell: DiningCell, ) { holder.homeTitle.text = "Favorites" @@ -293,7 +311,7 @@ class HomeAdapter( } private fun bindCalendarCell( - holder: HomeBaseHolder, + holder: HomeCalendarHolder, cell: CalendarCell, ) { val events = cell.events diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeBaseHolder.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeBaseHolder.kt index 3ef2ff4d..4b1a594c 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeBaseHolder.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeBaseHolder.kt @@ -3,7 +3,7 @@ package com.pennapps.labs.pennmobile.viewholders import androidx.recyclerview.widget.RecyclerView import com.pennapps.labs.pennmobile.databinding.HomeBaseCardBinding -class HomeBaseHolder( +open class HomeBaseHolder( val itemBinding: HomeBaseCardBinding, ) : RecyclerView.ViewHolder(itemBinding.root) { var homeTitle = itemBinding.homeCardTitle diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeCalendarHolder.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeCalendarHolder.kt new file mode 100644 index 00000000..9b710da4 --- /dev/null +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeCalendarHolder.kt @@ -0,0 +1,7 @@ +package com.pennapps.labs.pennmobile.viewholders + +import com.pennapps.labs.pennmobile.databinding.HomeBaseCardBinding + +class HomeCalendarHolder( + itemBinding: HomeBaseCardBinding, +) : HomeBaseHolder(itemBinding) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeDiningHolder.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeDiningHolder.kt new file mode 100644 index 00000000..857011d6 --- /dev/null +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeDiningHolder.kt @@ -0,0 +1,7 @@ +package com.pennapps.labs.pennmobile.viewholders + +import com.pennapps.labs.pennmobile.databinding.HomeBaseCardBinding + +class HomeDiningHolder( + itemBinding: HomeBaseCardBinding, +) : HomeBaseHolder(itemBinding) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeLaundryHolder.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeLaundryHolder.kt new file mode 100644 index 00000000..259a1097 --- /dev/null +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeLaundryHolder.kt @@ -0,0 +1,7 @@ +package com.pennapps.labs.pennmobile.viewholders + +import com.pennapps.labs.pennmobile.databinding.HomeBaseCardBinding + +class HomeLaundryHolder( + itemBinding: HomeBaseCardBinding, +) : HomeBaseHolder(itemBinding)