app / sg.edu.ntu.scse.cz2006.gymbuddies.adapter / FavGymAdapter

FavGymAdapter

class FavGymAdapter : Adapter<FavViewHolder>

Recycler Adapter for Favourited Gyms For sg.edu.ntu.scse.cz2006.gymbuddies.adapter in Gym Buddies!

Author
Kenneth Soh

Since
2019-10-02

Types

FavViewHolder

Inner class to store the favourited gym data in

inner class FavViewHolder : ViewHolder, OnClickListener

Constructors

<init>

Creates a adapter for the Gym Favourites List RecyclerView

FavGymAdapter(gyms: List<FavGymObject>)

Properties

gymList

List The list of all gyms favourited by the user

var gymList: List<FavGymObject>

onClickListener

OnClickListener? Set this to override the default onClick listener defined in FavGymAdapter.FavViewHolder.onClick

var onClickListener: OnClickListener?

Functions

getItemCount

Gets the number of gyms stored in this adapter

fun getItemCount(): Int

getList

Gets the gym list stored in this adapter

fun getList(): List<FavGymObject>

onBindViewHolder

Internal function to bind the view holder at the current RecyclerView position to a specific data

fun onBindViewHolder(holder: FavViewHolder, position: Int): Unit

onCreateViewHolder

Creates the required View Holder to store the data in

fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FavViewHolder

setOnClickListener

Overrides the default on click listener

fun setOnClickListener(listener: OnClickListener): Unit

updateList

Updates the gym list stored in this adapter

fun updateList(newList: List<FavGymObject>): Unit