protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Chat); user1 = ParseUser.CurrentUser.Username; user2 = Intent.GetStringExtra("contactUsername") ?? "Data not available"; setUserAlphabeticalOrder(); this.Title = user2; random = new Random(); msg_edittext = (EditText)FindViewById(Resource.Id.messageEditText); msgListView = (ListView)FindViewById(Resource.Id.msgListView); ImageButton sendButton = (ImageButton)FindViewById(Resource.Id.sendMessageButton); sendButton.Click += delegate { sendTextMessage(); }; ImageButton attachButton = (ImageButton)FindViewById(Resource.Id.attachmentButton); attachButton.Click += ButtonOnClick; msgListView.TranscriptMode = TranscriptMode.AlwaysScroll; msgListView.StackFromBottom = true; chatlist = new List <ChatMessage>(); chatAdapter = new ChatAdapter(this, chatlist); msgListView.Adapter = chatAdapter; loadPreviousChatsAsync(); }
// 初始化组件 public void InitComponent() { chatTypeObj = GameObject.Find("ChatType"); emojiTypeObj = GameObject.Find("EmojiType"); chatLogTypeObj = GameObject.Find("ChatLogType"); chatObj = GameObject.Find("Chat"); emojiObj = GameObject.Find("Emoji"); chatLogObj = GameObject.Find("ChatLog"); mChatAdapter = chatObj.GetComponent <ChatAdapter>(); mChatAdapter.SetControler(mGameControler.selfInfo.Pos, mButtonControler); mEmojiAdapter = emojiObj.GetComponent <EmojiAdapter>(); mEmojiAdapter.SetControler(mGameControler.selfInfo.Pos, mButtonControler); mChatLogAdapter = chatLogObj.GetComponent <ChatLogAdapter>(); HideAll(); Show(chatTypeObj, chatObj); chatTypeObj.GetComponent <Button>().onClick.AddListener(() => { HideAll(); Show(chatTypeObj, chatObj); }); emojiTypeObj.GetComponent <Button>().onClick.AddListener(() => { HideAll(); Show(emojiTypeObj, emojiObj); }); chatLogTypeObj.GetComponent <Button>().onClick.AddListener(() => { HideAll(); Show(chatLogTypeObj, chatLogObj); }); }
private async void SetResources(bool setClick) { int id = await core.Chat(); List <Manboss_chat_mensaje> messages = null; if (id != 0) { messages = await core.Conversation(); } chat = view.FindViewById <ListView>(Resource.Id.chat); chat.Divider = null; chat.DividerHeight = 0; send = view.FindViewById <Button>(Resource.Id.btn_send); message = view.FindViewById <EditText>(Resource.Id.chat_mensaje); if (setClick) { send.Click += SendMessage; } send.Visibility = ViewStates.Visible; if (messages != null) { adapter = new ChatAdapter(mAct, messages); chat.Adapter = adapter; } }
private void InitViews() { UserMessage = FindViewById <EditText>(Resource.Id.main_inputmessage_edittext); SendButton = FindViewById <Button>(Resource.Id.main_send_floatingactionbutton); MessagesRecycler = FindViewById <RecyclerView>(Resource.Id.main_message_listview); TextInputLayout = FindViewById <RelativeLayout>(Resource.Id.main_textinput_layout); ButtonsInputLayout = FindViewById <HorizontalScrollView>(Resource.Id.main_buttoninput_layout); InputArea = FindViewById <LinearLayout>(Resource.Id.main_inputmessage_layout); Adapter = new ChatAdapter(MessagesList); var layoutManager = new LinearLayoutManager(this); layoutManager.ReverseLayout = true; layoutManager.StackFromEnd = true; MessagesRecycler.SetLayoutManager(layoutManager); MessagesRecycler.SetAdapter(Adapter); SendButton.Enabled = false; SetInputLayout(true); var activity = new Microsoft.Bot.Connector.DirectLine.Activity("message", text: "Hey, my name is Thuan, I'll help you get this claim sorted out in no time...", fromProperty: new Microsoft.Bot.Connector.DirectLine.ChannelAccount { Id = BotConnector.BotId }); AddMessageToList(activity); }
private void BindData() { _eventButtonsAdapter = new EventButtonsAdapter(Context, ViewModel.ActionPlans); _eventButtons.SetAdapter(_eventButtonsAdapter); _eventButtons.HasFixedSize = true; if (ViewModel.CurrentActionPlan != null) { _eventButtonsAdapter.SelectedPosition = ViewModel.ActionPlans.IndexOf(ViewModel.CurrentActionPlan); } _chatAdapter = new ChatAdapter(Context, ViewModel.ChatMessages) { Initials = ViewModel.Initials, ProfileImageUri = ViewModel.ProfileImageUri, Email = ViewModel.Email }; _chatMessages.AddItemDecoration(new SpaceItemDecoration(Activity.Resources.GetDimensionPixelSize(Resource.Dimension.chat_item_spacing))); _chatMessages.SetAdapter(_chatAdapter); if (Activity is MainActivity act) { act.BottomSheetBehaviour.NestedScrollingViewIds.Add(Resource.Id.chat_area); } else if (Activity is EventDetailActivity act1) { act1.BottomSheetBehaviour.NestedScrollingViewIds.Add(Resource.Id.chat_area); } }
public ChatController(ChatAdapter Adapter, ChatView ChatView, Player Player) { _Adapter = Adapter; _ChatView = ChatView; _ChatView.OnTextSubmitted += HandleSendMessage; _Player = Player; }
public ChatFragment(string username, Socket socket, AlertDialog alert) { this.username = username; this.socket = socket; this.adapter = new ChatAdapter(chatItems); AttachSocketEvents(alert); }
private void InitData() { parent = ParentFragment as PreOrderFragment; var adapter = new ChatAdapter(parent.commentList); messageList.SetAdapter(adapter); messageList.SmoothScrollToPosition(adapter.ItemCount); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _email = this.Arguments.GetString("Email"); _username = _email.Split('@')[0]; _adapter = new ChatAdapter(this, new Message[0]); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _gimmickId = this.Arguments.GetInt("GimmickId"); _userId = AppController.Settings.LastLoginUserIdUsed; _issue = this.Arguments.GetObject <Issue>("Issue"); _adapter = new ChatAdapter(this, new Model.Message[0]); }
public Friend(SteamID steamId) { this.steamId = steamId; this.name = Unknown; this.avatar = Unknown; adapter = new ChatAdapter(this, SteamAlerts.GetContext()); SteamService.GetClient().AddHandler(this); }
private void SetupListView() { _listView = _view.FindViewById <ListView>(Resource.Id.chat_listview); _editText = _view.FindViewById <EditText>(Resource.Id.chat_edittext_msg); if (_conversation == null) { throw new Exception("Conversation not found!"); } _adapter = new ChatAdapter(Activity, _conversation, _listView); _listView.Adapter = _adapter; }
private void OnSuccessOperationResponseEvent(OperationCode operationCode, SubCode subCode, OperationResponse response) { if (operationCode != OperationCode.Chat) { return; } switch (subCode) { case SubCode.Chat_Record: if (response.Parameters.TryGetParameter(ParameterKeys.CHAT_RECORD_RESPONSE, out ChatRecordResponseModel model) && model != null && model.Records?.Count > 0) { AddToConsole("请求聊天记录成功", false); RunOnUiThread(() => { mChatAdapter = new ChatAdapter(mActivity, Resource.Layout.ChatItem, model.Records); mChatListView.Adapter = mChatAdapter; }); } else { AddToConsole("请求聊天记录为空", false); RunOnUiThread(() => { mChatAdapter = new ChatAdapter(mActivity, Resource.Layout.ChatItem, new List <Chat>()); mChatListView.Adapter = mChatAdapter; }); } break; case SubCode.Chat_Message: if (response.Parameters.TryGetParameter(ParameterKeys.CHAT_INFO, out Chat chat) && chat != null) { AddToConsole("消息发送成功", false); mChatAdapter?.Add(chat); RunOnUiThread(() => { mChatAdapter?.NotifyDataSetChanged(); }); } else { AddToConsole("消息发送失败", false); } break; } }
private void LoadMessages(IEnumerable <Model.Message> messages) { if (messages == null) { return; } // Sort desc by creation date messages = messages.OrderBy(x => x.PostDate); if (_adapter == null) { _adapter = new ChatAdapter(this, messages); this.MessageList.SetAdapter(_adapter); } else { _adapter.Refresh(messages); this.MessageList.ReloadData(); } }
private void SetupAdapter() { adapter = new ChatAdapter(messages, this, userName); chatMessageListView.Adapter = adapter; }
public GrpcSetUp(ChatAdapter chatAdapter, LoginMemberAdapter loginMemberAdapter) { this.chatAdapter = chatAdapter; this.loginMemberAdapter = loginMemberAdapter; }
public ChatImpl(ChatAdapter chatAdapter) { this.chatAdapter = chatAdapter; }
public async void OnResults(Bundle results) { var matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition); if (matches != null && matches.Count > 0) { if (isRight) { ChatModel textModel = new ChatModel(); textModel.ChatMessage = matches[0]; textModel.IsSend = true; list_chat.Add(textModel); ChatModel translatedTextModel = new ChatModel(); string s = Translate(matches[0], leftSelectedLanguageTransCode); translatedTextModel.ChatMessage = s; translatedTextModel.IsSend = true; list_translated_chat.Add(translatedTextModel); ChatAdapter adapter = new ChatAdapter(this.list_chat, this.list_translated_chat, this.BaseContext); this.list_of_message.Adapter = adapter; try { //await CrossTextToSpeech.Current.Speak(s); //TextToSpeech textToSpeech = new TextToSpeech(this, new Plugin.TextToSpeech.) //Speak(s); /*if (!string.IsNullOrEmpty(s)) * textToSpeech.Speak(s, QueueMode.Flush, null);*/ } catch (Exception e) { ShowToast(e.Message + "\n" + e.ToString()); } } else if (isLeft) { ChatModel textModel = new ChatModel(); textModel.ChatMessage = matches[0]; textModel.IsSend = false; list_chat.Add(textModel); ChatModel translatedTextModel = new ChatModel(); string s = Translate(matches[0], rightSelectedLanguageTransCode); translatedTextModel.ChatMessage = s; translatedTextModel.IsSend = false; list_translated_chat.Add(translatedTextModel); ChatAdapter adapter = new ChatAdapter(this.list_chat, this.list_translated_chat, this.BaseContext); this.list_of_message.Adapter = adapter; try { /*if (!string.IsNullOrEmpty(s)) * textToSpeech.Speak(s, QueueMode.Flush, null);*/ //tts.Speak(s, QueueMode.Add, null); //await CrossTextToSpeech.Current.Speak(s); //Speak(s); } catch (Exception e) { ShowToast(e.Message + "\n" + e.ToString()); } } //Label.Text = matches[0]; } }