Class NewsfeedDetailsAdapter
- java.lang.Object
 - 
- androidx.recyclerview.widget.RecyclerView.Adapter<VH>
 - 
- com.cheetahdigital.uikit.widget.list.ListAdapter<D,VH>
 - 
- com.cheetahdigital.uikit.widget.list.EndlessListAdapter<com.cheetahdigital.corekit.models.data.BaseData,androidx.recyclerview.widget.RecyclerView.ViewHolder>
 - 
- com.cheetahdigital.newsfeed.ui.details.NewsfeedDetailsAdapter
 
 
 
 
 
- 
public class NewsfeedDetailsAdapter extends com.cheetahdigital.uikit.widget.list.EndlessListAdapter<com.cheetahdigital.corekit.models.data.BaseData,androidx.recyclerview.widget.RecyclerView.ViewHolder>The adapter forNewsfeedDetailsActivity 
- 
- 
Constructor Summary
Constructors Constructor Description NewsfeedDetailsAdapter(java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList)Constructor of adapter that accepts list ofBaseDataNewsfeedDetailsAdapter(java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList, PostDetailsClickListener postClickListener, CommentClickListener commentClickListener)Constructor of the Adapter that accepts list ofBaseDataand post and comment click listenersNewsfeedDetailsAdapter(java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList, PostDetailsClickListener postClickListener, CommentClickListener commentClickListener, OnAttachmentClickListener attachmentClickListener)Constructor of the Adapter that accepts list ofBaseDataand post, comment, and attachment click listeners 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbindNormalViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)Abstract method to bind the normal view holder.protected androidx.recyclerview.widget.RecyclerView.ViewHoldercreateNormalViewHolder(android.view.ViewGroup parent, int viewType)Abstract method to create normal view holder.intgetItemViewType(int position)Checker if item type is VIEW_TYPE_HEADER or VIEW_TYPE_NORMALvoidremoveComment(int commentId)Removes comment from the listvoidrevertCommentChanges(int commentId)Revert changes made in the commentvoidrevertPostChanges()Revert changes made in the postvoidsetFlags(java.util.List<Flag> flags)Set the list of flags displayed when using Flag view inSocialWidgetvoidsetIsProfileClickable(boolean isProfileClickable)Allows clicking of member avatar/name to show their profilevoidsetIsUserAllowedToComment(boolean isUserAllowedToComment)Set the visibility of comment view inSocialWidgetvoidsetIsUserAllowedToPost(boolean isUserAllowedToPost)Set the visibility of flag view inSocialWidgetvoidupdateComment(Comment updatedComment)Updates theCommentby callingListAdapter.replaceItemAt(int, BaseData)voidupdatePost(Post post)UpdatesPostby calling replaceItemAt position 0.- 
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListAdapter
getItemCount, getReload, isAppending, onBindViewHolder, onCreateViewHolder, setIsAppending, setReload 
- 
Methods inherited from class com.cheetahdigital.uikit.widget.list.ListAdapter
addAll, addItem, addItem, clear, getDataList, getItemAt, getPlaceHolderResource, insertItems, isListEmpty, removeItem, replaceItemAt, setCustomEmptyMessageResource, setPlaceHolderResource, sort 
- 
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
NewsfeedDetailsAdapter
public NewsfeedDetailsAdapter(@NonNull java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList)Constructor of adapter that accepts list ofBaseData- Parameters:
 dataList- list used for this adapter instance
 
- 
NewsfeedDetailsAdapter
public NewsfeedDetailsAdapter(@NonNull java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList, @NonNull PostDetailsClickListener postClickListener, @NonNull CommentClickListener commentClickListener)Constructor of the Adapter that accepts list ofBaseDataand post and comment click listeners- Parameters:
 dataList- the list ofBaseDatawhich includesPostobject and list ofCommentpostClickListener- thePostDetailsClickListenerfor handling clicks on the postcommentClickListener- theCommentClickListenerfor handling clicks on the comments
 
- 
NewsfeedDetailsAdapter
public NewsfeedDetailsAdapter(@NonNull java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList, @NonNull PostDetailsClickListener postClickListener, @NonNull CommentClickListener commentClickListener, @NonNull OnAttachmentClickListener attachmentClickListener)Constructor of the Adapter that accepts list ofBaseDataand post, comment, and attachment click listeners- Parameters:
 dataList- the list ofBaseDatawhich includesPostobject and list ofCommentpostClickListener- thePostDetailsClickListenerfor handling clicks on the postcommentClickListener- theCommentClickListenerfor handling clicks on the commentsattachmentClickListener- thisOnAttachmentClickListenerfor handling clicks on the attachments (image or video) in aPost
 
 - 
 
- 
Method Detail
- 
setIsUserAllowedToComment
public void setIsUserAllowedToComment(boolean isUserAllowedToComment)
Set the visibility of comment view inSocialWidget- Parameters:
 isUserAllowedToComment- true to show comment, false to hide comment
 
- 
setIsUserAllowedToPost
public void setIsUserAllowedToPost(boolean isUserAllowedToPost)
Set the visibility of flag view inSocialWidget- Parameters:
 isUserAllowedToPost- true to show flag, false to hide flag
 
- 
setFlags
public void setFlags(java.util.List<Flag> flags)
Set the list of flags displayed when using Flag view inSocialWidget- Parameters:
 flags- list of flags used for display
 
- 
setIsProfileClickable
public void setIsProfileClickable(boolean isProfileClickable)
Allows clicking of member avatar/name to show their profile- Parameters:
 isProfileClickable- true - to allow clicking and showing of profile, false - to disable clicking and showing of profile
 
- 
getItemViewType
public int getItemViewType(int position)
Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapterChecker if item type is VIEW_TYPE_HEADER or VIEW_TYPE_NORMAL- Overrides:
 getItemViewTypein classcom.cheetahdigital.uikit.widget.list.EndlessListAdapter<com.cheetahdigital.corekit.models.data.BaseData,androidx.recyclerview.widget.RecyclerView.ViewHolder>- Parameters:
 position- index of the item- Returns:
 - view type in integer format
 
 
- 
createNormalViewHolder
protected androidx.recyclerview.widget.RecyclerView.ViewHolder createNormalViewHolder(android.view.ViewGroup parent, int viewType)Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapterAbstract method to create normal view holder.- Specified by:
 createNormalViewHolderin classcom.cheetahdigital.uikit.widget.list.ListAdapter<com.cheetahdigital.corekit.models.data.BaseData,androidx.recyclerview.widget.RecyclerView.ViewHolder>- Parameters:
 parent- used to get resourceviewType- type of view- Returns:
 - view holder for non special items
 
 
- 
bindNormalViewHolder
protected void bindNormalViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapterAbstract method to bind the normal view holder.- Specified by:
 bindNormalViewHolderin classcom.cheetahdigital.uikit.widget.list.ListAdapter<com.cheetahdigital.corekit.models.data.BaseData,androidx.recyclerview.widget.RecyclerView.ViewHolder>- Parameters:
 holder- view holder to vindSposition- index of the item
 
- 
removeComment
public void removeComment(int commentId)
Removes comment from the list- Parameters:
 commentId- id of comment
 
- 
revertCommentChanges
public void revertCommentChanges(int commentId)
Revert changes made in the comment- Parameters:
 commentId- id of comment
 
- 
updateComment
public void updateComment(Comment updatedComment)
Updates theCommentby callingListAdapter.replaceItemAt(int, BaseData)- Parameters:
 updatedComment- UpdatedComment
 
- 
revertPostChanges
public void revertPostChanges()
Revert changes made in the post 
 - 
 
 -