public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.SendBirdFragmentChannelList, container, false); InitUIComponents(rootView); mChannelListQuery = SendBirdSDK.QueryChannelList(); mChannelListQuery.OnResult += (sender, e) => { mAdapter.AddAll(e.Channels); }; mChannelListQuery.Next(); // actually query to get channel list via API Client ShowChannelList(); return(rootView); }
void OpenChannelList(int limit = 30) { mEventProcessor.QueueEvent(new Action(() => { channelPanel.SetActive(true); })); mChannelListQuery = SendBirdSDK.QueryChannelList(); mChannelListQuery.SetLimit(limit); mChannelListQuery.OnResult += (sender, e) => { if (e.Exception != null) { Debug.Log(e.Exception.StackTrace); } else { OnQueryChannelList(e.Channels); } }; mChannelListQuery.Next(); }
private void Search(string keyword) { if (keyword == null || keyword.Length <= 0) { ShowChannelList(); return; } ShowSearchList(); mChannelListSearchQuery = SendBirdSDK.QueryChannelList(keyword); mChannelListSearchQuery.OnResult += (sender, e) => { mSearchAdapter.Clear(); mSearchAdapter.AddAll(e.Channels); mSearchAdapter.NotifyDataSetChanged(); if (e.Channels.Count <= 0) { Toast.MakeText(this.Activity, "No channels were found.", ToastLength.Short).Show(); } }; mChannelListSearchQuery.Next(); }