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

CarparkAdapter

class CarparkAdapter : Adapter<CarparkViewHolder>

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

Author
Kenneth Soh

Since
2019-10-21

Types

CarparkViewHolder

Inner class to store the carpark in

inner class CarparkViewHolder : ViewHolder, OnClickListener

Constructors

<init>

Creates a adapter for the Gym Favourites List RecyclerView

CarparkAdapter(context: Context, carpark: List<Pair<CarPark, Float>>)

Properties

carparkList

List<Pair<CarPark, Float>> The list of all carparks near gym

var carparkList: List<Pair<CarPark, Float>>

carparkLots

var carparkLots: HashMap<String, Int>

onClickListener

OnClickListener? Set this to override the default onClick listener defined in CarparkAdapter.CarparkViewHolder.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<Pair<CarPark, Float>>

onBindViewHolder

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

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

onCreateViewHolder

Creates the required View Holder to store the data in

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

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<Pair<CarPark, Float>>): Unit