Class MessagesViewHolder


  • public class MessagesViewHolder
    extends androidx.recyclerview.widget.RecyclerView.ViewHolder
    The View Holder for the list of Messages Contains all the views to be displayed on each list item
    • Field Summary

      Fields 
      Modifier and Type Field Description
      android.widget.ImageView mChevron  
      android.widget.ImageButton mDeleteButton  
      android.widget.TextView mDescription  
      android.widget.ImageView mIcon  
      android.view.View mRootView  
      android.widget.TextView mTimestamp  
      android.widget.TextView mTitle  
      • Fields inherited from class androidx.recyclerview.widget.RecyclerView.ViewHolder

        itemView
    • Constructor Summary

      Constructors 
      Constructor Description
      MessagesViewHolder​(android.view.View itemView)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(Message message)
      Populates the details of the current view using the passed Message
      int getMessageAdapterPosition()
      Returns the Adapter position of the item represented by this ViewHolder.
      void setImagePlaceholder​(int placeholder)
      Set a default placeholder for message image view
      • Methods inherited from class androidx.recyclerview.widget.RecyclerView.ViewHolder

        getAdapterPosition, getItemId, getItemViewType, getLayoutPosition, getOldPosition, getPosition, isRecyclable, setIsRecyclable, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • mRootView

        public android.view.View mRootView
      • mIcon

        public android.widget.ImageView mIcon
      • mTitle

        public android.widget.TextView mTitle
      • mDescription

        public android.widget.TextView mDescription
      • mTimestamp

        public android.widget.TextView mTimestamp
      • mDeleteButton

        public android.widget.ImageButton mDeleteButton
      • mChevron

        public android.widget.ImageView mChevron
    • Constructor Detail

      • MessagesViewHolder

        public MessagesViewHolder​(android.view.View itemView)
    • Method Detail

      • bind

        public void bind​(Message message)
        Populates the details of the current view using the passed Message
        Parameters:
        message - instance of Message used to populate the item
      • setImagePlaceholder

        public void setImagePlaceholder​(@DrawableRes
                                        int placeholder)
        Set a default placeholder for message image view
        Parameters:
        placeholder - id of the drawable resource
      • getMessageAdapterPosition

        public int getMessageAdapterPosition()
        Returns the Adapter position of the item represented by this ViewHolder.
        Returns:
        The adapter position of the item if it still exists in the adapter