Package ai.nexconn.chatui.channel
Class ChannelFragment
-
- All Implemented Interfaces:
-
ai.nexconn.chatui.widget.adapter.IViewProviderListener,ai.nexconn.chatui.widget.pullrefresh.listener.OnLoadMoreListener,ai.nexconn.chatui.widget.pullrefresh.listener.OnRefreshListener,android.content.ComponentCallbacks,android.view.View.OnClickListener,android.view.View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner
public class ChannelFragment extends Fragment implements OnRefreshListener, View.OnClickListener, OnLoadMoreListener, IViewProviderListener<T>
-
-
Field Summary
Fields Modifier and Type Field Description public final static intREQUEST_CODE_FORWARDprotected SmartRefreshLayoutmRefreshLayoutprotected RecyclerViewmListprotected RecyclerView.LayoutManagermLinearLayoutManagerprotected MessageListAdaptermAdapterprotected ItemExposeManager<UiMessage>mExposeManagerprotected ChannelViewModelmMessageViewModelprotected NCExtensionViewModelmNCExtensionViewModelprotected NCExtensionmNCExtensionprotected TextViewmNewMessageNumprotected TextViewmUnreadHistoryMessageNumprotected TextViewmUnreadMentionMessageNumprotected intactivitySoftInputModeprotected booleanonScrollStopRefreshList
-
Constructor Summary
Constructors Constructor Description ChannelFragment()
-
Method Summary
Modifier and Type Method Description voidinitConversation(String targetId, ChannelType channelType, Bundle bundle)voidonViewClick(int clickType, UiMessage data)booleanonViewLongClick(View view, int clickType, UiMessage data)booleanonViewLongClick(int clickType, UiMessage data)List<MessageLongClickItem>onSetupLongClickItems()Builds the list of long-press menu items. LinearLayoutgetNotificationContainer()Returns the top notification bar container. voidhideNotificationView(View notificationView)Hides the notification view previously shown by showNotificationView. voidshowNotificationView(View notificationView)Displays a view in the notification area. booleanonBackPressed()voidonRefresh(@NonNull() RefreshLayout refreshLayout)NCExtensiongetNCExtension()voidonActivityResult(int requestCode, int resultCode, @Nullable() Intent data)voidonRequestPermissionsResult(int requestCode, @NonNull() Array<String> permissions, @NonNull() Array<int> grantResults)ViewonCreateView(@NonNull() LayoutInflater inflater, @Nullable() ViewGroup container, @Nullable() Bundle savedInstanceState)Find views by ID and bindlisteners. voidonViewCreated(@NonNull() View view, @Nullable() Bundle savedInstanceState)voidonResume()voidonPause()voidonStart()voidonStop()voidonDestroyView()voidonClick(View v)voidonLoadMore(@NonNull() RefreshLayout refreshLayout)voidonWarningDialog(String msg)Warning dialog, e.g. voidnoMoreMessageToFetch()Called when message fetching completes and there are no more messages to fetch. MessageListAdapteronResolveAdapter()Returns the adapter. voidaddHeaderView(View view)voidaddFooterView(View view)voidsetEmptyView(View view)voidsetEmptyView(@LayoutRes() int emptyId)-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onSaveInstanceState, onViewStateRestored, postponeEnterTransition, registerForActivityResult, 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 androidx.lifecycle.HasDefaultViewModelProviderFactory
getDefaultViewModelCreationExtras -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
initConversation
void initConversation(String targetId, ChannelType channelType, Bundle bundle)
-
onViewClick
void onViewClick(int clickType, UiMessage data)
- Parameters:
clickType- identifier to distinguish click eventsdata- the data source
-
onViewLongClick
boolean onViewLongClick(View view, int clickType, UiMessage data)
- Parameters:
view- the view that triggered the long pressclickType- identifier to distinguish click eventsdata- the data source
-
onViewLongClick
boolean onViewLongClick(int clickType, UiMessage data)
- Parameters:
clickType- identifier to distinguish click eventsdata- the data source
-
onSetupLongClickItems
List<MessageLongClickItem> onSetupLongClickItems()
Builds the list of long-press menu items. The List order determines menu display order.
Subclasses can:
// a) Add/remove items on top of the defaults List<MessageLongClickItem> items = super.onSetupLongClickItems(); items.add(new MyItem()); return items; // b) Fully customize List<MessageLongClickItem> items = new ArrayList<>(); items.add(new MessageLongClickCopyItem()); return items;
-
getNotificationContainer
LinearLayout getNotificationContainer()
Returns the top notification bar container.
- Returns:
the notification container
-
hideNotificationView
void hideNotificationView(View notificationView)
Hides the notification view previously shown by showNotificationView.
- Parameters:
notificationView- the notification view to hide
-
showNotificationView
void showNotificationView(View notificationView)
Displays a view in the notification area.
-
onBackPressed
boolean onBackPressed()
-
onRefresh
void onRefresh(@NonNull() RefreshLayout refreshLayout)
-
getNCExtension
NCExtension getNCExtension()
-
onActivityResult
void onActivityResult(int requestCode, int resultCode, @Nullable() Intent data)
-
onRequestPermissionsResult
void onRequestPermissionsResult(int requestCode, @NonNull() Array<String> permissions, @NonNull() Array<int> grantResults)
-
onCreateView
@Nullable() View onCreateView(@NonNull() LayoutInflater inflater, @Nullable() ViewGroup container, @Nullable() Bundle savedInstanceState)
Find views by ID and bindlisteners.
-
onViewCreated
void onViewCreated(@NonNull() View view, @Nullable() Bundle savedInstanceState)
-
onResume
void onResume()
-
onPause
void onPause()
-
onStart
void onStart()
-
onStop
void onStop()
-
onDestroyView
void onDestroyView()
-
onClick
void onClick(View v)
-
onLoadMore
void onLoadMore(@NonNull() RefreshLayout refreshLayout)
-
onWarningDialog
void onWarningDialog(String msg)
Warning dialog, e.g. "Failed to join chatroom". To customize: 1. Create a subclass of ChannelFragment. 2. Override onWarningDialog.
- Parameters:
msg- the dialog message
-
noMoreMessageToFetch
void noMoreMessageToFetch()
Called when message fetching completes and there are no more messages to fetch.
- Since:
5.8.2
-
onResolveAdapter
MessageListAdapter onResolveAdapter()
Returns the adapter. Override this method to provide a custom adapter.
- Returns:
the message list adapter
-
addHeaderView
void addHeaderView(View view)
- Parameters:
view- custom list header view
-
addFooterView
void addFooterView(View view)
- Parameters:
view- custom list footer view
-
setEmptyView
void setEmptyView(View view)
- Parameters:
view- custom empty-state view for the list
-
setEmptyView
void setEmptyView(@LayoutRes() int emptyId)
- Parameters:
emptyId- layout resource ID for the custom empty-state view
-
-
-
-