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

BuddyResultAdapter

open class BuddyResultAdapter : Adapter<ViewHolder!>

Recycler Adapter for Buddy search result For sg.edu.ntu.scse.cz2006.gymbuddies.adapter in Gym Buddies!

Author
Chia Yu

Since
2019-09-28

Property
listBuddies List The list of all searched users

Constructor
Creates a adapter for the Buddy Search Result List RecyclerView

Types

ViewHolder

View Holder to hold references to frequent modified views

open class ViewHolder : ViewHolder, OnClickListener

Constructors

<init>

Constructor to create Recycler Adapter for Buddy search result

BuddyResultAdapter(listBuddies: MutableList<User!>!, favUsers: MutableList<String!>!)

Properties

ACTION_CLICK_ON_FAV_ITEM

unique identifier to specify user click on favoured (heart shape) button of display view

static val ACTION_CLICK_ON_FAV_ITEM: Int

ACTION_CLICK_ON_ITEM_BODY

unique identifier to specify user click on item body of display view

static val ACTION_CLICK_ON_ITEM_BODY: Int

ACTION_CLICK_ON_ITEM_PIC

unique identifier to specify user click on profile picture of display view

static val ACTION_CLICK_ON_ITEM_PIC: Int

ACTION_INVALID

unique identifier to specify undefined action

static val ACTION_INVALID: Int

favUsers

it store list of other user's id, used to denote that other user is current user's buddy

var favUsers: MutableList<String!>!

listBuddies

list that holds user data for displaying

var listBuddies: MutableList<User!>!

listener

interface that allow activity to observe user interaction with RecyclerView

var listener: OnRecyclerViewInteractedListener<ViewHolder!>!

TAG

TAG is unique identifier to for logging purpose

var TAG: String!

Functions

getItemCount

get number of items to be display on recycler view

open fun getItemCount(): Int

onBindViewHolder

get number of items to be display on recycler view

open fun onBindViewHolder(holder: ViewHolder, position: Int): Unit

onCreateViewHolder

render an item view, and assign the view to view holder

open fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder

setOnRecyclerViewClickedListener

Allow other classes to listen to user interaction via OnBuddyClickedListener

open fun setOnRecyclerViewClickedListener(listener: OnRecyclerViewInteractedListener<ViewHolder!>!): Unit