Class NewsfeedListFragment<A extends NewsfeedListAdapter,V extends NewsfeedListView,P extends NewsfeedListPresenter<V>>
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V,P>
-
- com.cheetahdigital.uikit.architecture.lce.LceFragmentView<V,P>
-
- com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView<V,P>
-
- com.cheetahdigital.uikit.widget.list.ListFragmentView<V,P>
-
- com.cheetahdigital.uikit.widget.list.EndlessListFragmentView<A,V,P>
-
- com.cheetahdigital.newsfeed.ui.list.NewsfeedListFragment<A,V,P>
-
- All Implemented Interfaces:
android.content.ComponentCallbacks,android.view.View.OnCreateContextMenuListener,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener,AnalyticsManager.AnalyticsScreen,NewsfeedListView,PostClickListener,LceView,MvpLceView,MvpView,RefreshableView,FacebookHelper.FacebookShareCallBack,EndlessListView,ListView
public class NewsfeedListFragment<A extends NewsfeedListAdapter,V extends NewsfeedListView,P extends NewsfeedListPresenter<V>> extends EndlessListFragmentView<A,V,P> implements NewsfeedListView, FacebookHelper.FacebookShareCallBack, PostClickListener
The fragment class for showing a list ofPostCan receive the following extras:IntentKey.PRIMARY_PARAMS- use this key to pass any changes in query parameters of list ofPostIntentKey.SECONDARY_PARAMS- use this key to pass any changes in query parameters of flagsIntentKey.PRIMARY_ID- name of the category of the newsfeedPUBLIC_PROFILE_CLICKABLE- boolean key to allow clicking of member avatar/name in a post to show their profile
onActivityResult(int, int, Intent)NewsfeedDetailsActivity.KEY_POST_ID- id of the post to refresh
DETAILS_ACTIVITY_REQUEST- Request code when usingListFragmentView.startActivityForResult(Intent, int)forNewsfeedDetailsActivity.POST_CODE- Request code when usingListFragmentView.startActivityForResult(Intent, int)forNewsfeedPostActivity.
-
-
Field Summary
Fields Modifier and Type Field Description static intDETAILS_ACTIVITY_REQUESTstatic intPOST_CODEstatic java.lang.StringPUBLIC_PROFILE_CLICKABLE-
Fields inherited from class com.cheetahdigital.uikit.widget.list.EndlessListFragmentView
mEndlessRecyclerOnScrollListener
-
Fields inherited from class com.cheetahdigital.uikit.widget.list.ListFragmentView
mLinearLayoutManager, mListView, mSelectedPosition
-
Fields inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView
mSwipeRefreshLayout
-
Fields inherited from class com.cheetahdigital.uikit.architecture.lce.LceFragmentView
mContentView, mErrorView, mInitialLoad, mLoadingView
-
-
Constructor Summary
Constructors Constructor Description NewsfeedListFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendNews(Post pinnedPost, java.util.List<Post> newsfeed, int totalEntries, boolean isUserAllowedToPost, boolean isUserAllowedToComment)Notifies the view to append list ofPostto the existing post list.protected NewsfeedListAdaptercreateAdapter()Create the adapter used in current RecycleView present.protected androidx.recyclerview.widget.RecyclerView.ItemDecorationcreateItemDecoration()Create the item decoration used in the RecyclerView.protected PcreatePresenter()InstantiateMvpFragmentView.mPresenterto be used for thisMvpActivityViewvoiddeletePost(Post post)Notifies the view to delete the post from the list.protected intgetContentLayoutId()Provide the Content Layout ID which is of a Layout Resource Reference of AndroidintgetScreenName()voidonActivityResult(int requestCode, int resultCode, android.content.Intent data)voidonCommentClick(Post post)Method to handle clicking of comment viewvoidonCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater)android.view.ViewonCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)voidonDeletePost(int postId)Method to handle deleting of postvoidonFacebookShareCancelled()voidonFacebookShareError(com.facebook.FacebookException e)voidonFacebookShareSuccess(com.facebook.share.Sharer.Result result)voidonFlagNews(int postId, java.lang.String flag)Method to handle clicking of flag viewvoidonLikePost(boolean isAttempToLike, int postId)Method to handle liking of PostvoidonLinkPreviewClick(Post post)Method to handle clicking of link previewvoidonNewsLaunchProfile(Owner owner)Method to handle launching of Owner's profilebooleanonOptionsItemSelected(android.view.MenuItem item)voidonPostClick(Post post)Method to handle clicking of postvoidonPrepareOptionsMenu(android.view.Menu menu)voidonShareUrl(android.net.Uri uri)Method to handle sharing of urlvoidonViewUrl(android.net.Uri uri)Method to handle viewing of urlvoidrevertChanges(int postId)Notifies the view to revert any changes made to the post.voidshowErrorDialog(java.lang.String error)Notifies the view to show a dialog with the provided error messagevoidshowNewsfeedList(Post pinnedPost, java.util.List<Post> newsfeed, java.util.List<Flag> flags, int totalEntries, boolean isUserAllowedToPost, boolean isUserAllowedToComment)Notifies the view to show the list ofPost.voidupdatePost(Post post)Notifies the view to update the Post.-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListFragmentView
onFinishLoadMore, onFinishRefresh, onLoadMoreFailed, setListTotalEntries
-
Methods inherited from class com.cheetahdigital.uikit.widget.list.ListFragmentView
getLayoutManager, isListAnimationEnabled, onAttach, setExitTransition, showContent, startActivity, startActivityForResult
-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView
onRefresh, onRefreshFailed, reloadData, showError, showLoading, startRefresh
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LceFragmentView
onLoadFailed, onLoadSuccess, onViewCreated, setErrorViewClickListener
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
captureSharedElementValues, getPresenter, getSharedElementViews, initSharedElementValues, isSharedAnimationEnabled, onDestroyView
-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.cheetahdigital.uikit.widget.list.EndlessListView
onFinishLoadMore, onLoadMoreFailed
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.lce.LceView
onLoadFailed, onLoadSuccess, setErrorViewClickListener
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.lce.MvpLceView
showContent, showError, showLoading
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.refreshable.RefreshableView
onFinishRefresh, onRefreshFailed
-
-
-
-
Field Detail
-
DETAILS_ACTIVITY_REQUEST
public static final int DETAILS_ACTIVITY_REQUEST
- See Also:
- Constant Field Values
-
POST_CODE
public static final int POST_CODE
- See Also:
- Constant Field Values
-
PUBLIC_PROFILE_CLICKABLE
public static final java.lang.String PUBLIC_PROFILE_CLICKABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
onCreateView
@Nullable public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)- Overrides:
onCreateViewin classEndlessListFragmentView<A extends NewsfeedListAdapter,V extends NewsfeedListView,P extends NewsfeedListPresenter<V>>
-
onActivityResult
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data)- Overrides:
onActivityResultin classandroidx.fragment.app.Fragment
-
onCreateOptionsMenu
public void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater)- Overrides:
onCreateOptionsMenuin classandroidx.fragment.app.Fragment
-
onPrepareOptionsMenu
public void onPrepareOptionsMenu(@NonNull android.view.Menu menu)- Overrides:
onPrepareOptionsMenuin classandroidx.fragment.app.Fragment
-
onOptionsItemSelected
public boolean onOptionsItemSelected(android.view.MenuItem item)
- Overrides:
onOptionsItemSelectedin classandroidx.fragment.app.Fragment
-
getScreenName
public int getScreenName()
- Specified by:
getScreenNamein interfaceAnalyticsManager.AnalyticsScreen- Overrides:
getScreenNamein classMvpFragmentView<V extends NewsfeedListView,P extends NewsfeedListPresenter<V>>
-
getContentLayoutId
protected int getContentLayoutId()
Description copied from class:MvpFragmentViewProvide the Content Layout ID which is of a Layout Resource Reference of Android- Specified by:
getContentLayoutIdin classMvpFragmentView<V extends NewsfeedListView,P extends NewsfeedListPresenter<V>>- Returns:
- id of the content layout
-
createPresenter
protected P createPresenter()
Description copied from class:MvpFragmentViewInstantiateMvpFragmentView.mPresenterto be used for thisMvpActivityView- Specified by:
createPresenterin classMvpFragmentView<V extends NewsfeedListView,P extends NewsfeedListPresenter<V>>- Returns:
- return the
MvpBasePresenter
-
showNewsfeedList
public void showNewsfeedList(Post pinnedPost, java.util.List<Post> newsfeed, java.util.List<Flag> flags, int totalEntries, boolean isUserAllowedToPost, boolean isUserAllowedToComment)
Description copied from interface:NewsfeedListViewNotifies the view to show the list ofPost. This also means the GET newsfeed API was successful.- Specified by:
showNewsfeedListin interfaceNewsfeedListView- Parameters:
pinnedPost- pinned post in the feednewsfeed- list ofPostobjectsflags- list ofFlagobjectstotalEntries- total number of posts regardless of paginationisUserAllowedToPost- member posting is allowed or not allowedisUserAllowedToComment- member commenting is allowed or not allowed
-
appendNews
public void appendNews(Post pinnedPost, java.util.List<Post> newsfeed, int totalEntries, boolean isUserAllowedToPost, boolean isUserAllowedToComment)
Description copied from interface:NewsfeedListViewNotifies the view to append list ofPostto the existing post list. This also means that the GET newsfeed API with pagination was successful- Specified by:
appendNewsin interfaceNewsfeedListView- Parameters:
pinnedPost- pinned post in the feednewsfeed- list ofPostobjectstotalEntries- total number of posts regardless of paginationisUserAllowedToPost- member posting is allowed or not allowedisUserAllowedToComment- member commenting is allowed or not allowed
-
deletePost
public void deletePost(Post post)
Description copied from interface:NewsfeedListViewNotifies the view to delete the post from the list. This also means delete post API was successful.- Specified by:
deletePostin interfaceNewsfeedListView- Parameters:
post- deletedPost
-
showErrorDialog
public void showErrorDialog(java.lang.String error)
Description copied from interface:NewsfeedListViewNotifies the view to show a dialog with the provided error message- Specified by:
showErrorDialogin interfaceNewsfeedListView- Parameters:
error- error message
-
revertChanges
public void revertChanges(int postId)
Description copied from interface:NewsfeedListViewNotifies the view to revert any changes made to the post. This also means that Like/Unlike and Flag/Unflag of Post API failed- Specified by:
revertChangesin interfaceNewsfeedListView- Parameters:
postId- id of the post to revert
-
updatePost
public void updatePost(Post post)
Description copied from interface:NewsfeedListViewNotifies the view to update the Post. This also means that the GET post API with clearing of cache was successful.- Specified by:
updatePostin interfaceNewsfeedListView- Parameters:
post- updatedPost
-
onFacebookShareSuccess
public void onFacebookShareSuccess(com.facebook.share.Sharer.Result result)
- Specified by:
onFacebookShareSuccessin interfaceFacebookHelper.FacebookShareCallBack
-
onFacebookShareCancelled
public void onFacebookShareCancelled()
- Specified by:
onFacebookShareCancelledin interfaceFacebookHelper.FacebookShareCallBack
-
onFacebookShareError
public void onFacebookShareError(com.facebook.FacebookException e)
- Specified by:
onFacebookShareErrorin interfaceFacebookHelper.FacebookShareCallBack
-
createAdapter
protected NewsfeedListAdapter createAdapter()
Create the adapter used in current RecycleView present. This is commonly used when overriding theNewsfeedListAdapter- Returns:
- instance of
NewsfeedListAdapter
-
onDeletePost
public void onDeletePost(int postId)
Description copied from interface:PostClickListenerMethod to handle deleting of post- Specified by:
onDeletePostin interfacePostClickListener- Parameters:
postId- id of post
-
onPostClick
public void onPostClick(Post post)
Description copied from interface:PostClickListenerMethod to handle clicking of post- Specified by:
onPostClickin interfacePostClickListener- Parameters:
post-Post
-
onLikePost
public void onLikePost(boolean isAttempToLike, int postId)Description copied from interface:PostClickListenerMethod to handle liking of Post- Specified by:
onLikePostin interfacePostClickListener- Parameters:
isAttempToLike- status if post is liked/unlikedpostId- id of post
-
onCommentClick
public void onCommentClick(Post post)
Description copied from interface:PostClickListenerMethod to handle clicking of comment view- Specified by:
onCommentClickin interfacePostClickListener- Parameters:
post-Post
-
onFlagNews
public void onFlagNews(int postId, java.lang.String flag)Description copied from interface:PostClickListenerMethod to handle clicking of flag view- Specified by:
onFlagNewsin interfacePostClickListener- Parameters:
postId- id of postflag- key attribute of the selected flag fromFlag
-
onViewUrl
public void onViewUrl(android.net.Uri uri)
Description copied from interface:PostClickListenerMethod to handle viewing of url- Specified by:
onViewUrlin interfacePostClickListener- Parameters:
uri- uri to view
-
onShareUrl
public void onShareUrl(android.net.Uri uri)
Description copied from interface:PostClickListenerMethod to handle sharing of url- Specified by:
onShareUrlin interfacePostClickListener- Parameters:
uri- uri for sharing
-
onNewsLaunchProfile
public void onNewsLaunchProfile(Owner owner)
Description copied from interface:PostClickListenerMethod to handle launching of Owner's profile- Specified by:
onNewsLaunchProfilein interfacePostClickListener- Parameters:
owner-Owner
-
onLinkPreviewClick
public void onLinkPreviewClick(Post post)
Description copied from interface:PostClickListenerMethod to handle clicking of link preview- Specified by:
onLinkPreviewClickin interfacePostClickListener- Parameters:
post-Post
-
createItemDecoration
protected androidx.recyclerview.widget.RecyclerView.ItemDecoration createItemDecoration()
Create the item decoration used in the RecyclerView. This invoked when initializing the list for the first time- Returns:
- instance of
RecyclerView.ItemDecorationfor the RecyclerView
-
-