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 ofBaseData
NewsfeedDetailsAdapter(java.util.List<com.cheetahdigital.corekit.models.data.BaseData> dataList, PostDetailsClickListener postClickListener, CommentClickListener commentClickListener)
Constructor of the Adapter that accepts list ofBaseData
and 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 ofBaseData
and post, comment, and attachment click listeners
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bindNormalViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
Abstract method to bind the normal view holder.protected androidx.recyclerview.widget.RecyclerView.ViewHolder
createNormalViewHolder(android.view.ViewGroup parent, int viewType)
Abstract method to create normal view holder.int
getItemViewType(int position)
Checker if item type is VIEW_TYPE_HEADER or VIEW_TYPE_NORMALvoid
removeComment(int commentId)
Removes comment from the listvoid
revertCommentChanges(int commentId)
Revert changes made in the commentvoid
revertPostChanges()
Revert changes made in the postvoid
setFlags(java.util.List<Flag> flags)
Set the list of flags displayed when using Flag view inSocialWidget
void
setIsProfileClickable(boolean isProfileClickable)
Allows clicking of member avatar/name to show their profilevoid
setIsUserAllowedToComment(boolean isUserAllowedToComment)
Set the visibility of comment view inSocialWidget
void
setIsUserAllowedToPost(boolean isUserAllowedToPost)
Set the visibility of flag view inSocialWidget
void
updateComment(Comment updatedComment)
Updates theComment
by callingListAdapter.replaceItemAt(int, BaseData)
void
updatePost(Post post)
UpdatesPost
by 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 ofBaseData
and post and comment click listeners- Parameters:
dataList
- the list ofBaseData
which includesPost
object and list ofComment
postClickListener
- thePostDetailsClickListener
for handling clicks on the postcommentClickListener
- theCommentClickListener
for 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 ofBaseData
and post, comment, and attachment click listeners- Parameters:
dataList
- the list ofBaseData
which includesPost
object and list ofComment
postClickListener
- thePostDetailsClickListener
for handling clicks on the postcommentClickListener
- theCommentClickListener
for handling clicks on the commentsattachmentClickListener
- thisOnAttachmentClickListener
for 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.ListAdapter
Checker if item type is VIEW_TYPE_HEADER or VIEW_TYPE_NORMAL- Overrides:
getItemViewType
in 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.ListAdapter
Abstract method to create normal view holder.- Specified by:
createNormalViewHolder
in 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.ListAdapter
Abstract method to bind the normal view holder.- Specified by:
bindNormalViewHolder
in 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 theComment
by callingListAdapter.replaceItemAt(int, BaseData)
- Parameters:
updatedComment
- UpdatedComment
-
revertPostChanges
public void revertPostChanges()
Revert changes made in the post
-
-