Exemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.MessagesFragment, container, false);

            mListAdapter = new MessagesListAdapter(Activity);

            Button clearButton = view.FindViewById <Button>(Resource.Id.clearButton);

            clearButton.Click += delegate {
                ClearMessages();
            };

            Spinner filterSpinner = view.FindViewById <Spinner>(Resource.Id.filterSpinner);
            var     arrayAdapter  = ArrayAdapter.CreateFromResource(Activity, Resource.Array.filterChoices, Android.Resource.Layout.SimpleSpinnerItem);

            arrayAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            filterSpinner.Adapter = arrayAdapter;
            filterSpinner.SetSelection(Ares.Settings.Settings.Instance.MessageFilterLevel);
            filterSpinner.ItemSelected += delegate(object sender, AdapterView.ItemSelectedEventArgs e) {
                ChangeFilter(e.Position);
            };

            mListView         = view.FindViewById <ListView>(Resource.Id.messagesList);
            mListView.Adapter = mListAdapter;

            return(view);
        }
        public LobbyChatViewModel(LobbyChatActivity activity, ChatService chatService)
        {
            _messagesListView         = activity.FindViewById <ListView>(Resource.Id.MessagesListView);
            _messageEditText          = activity.FindViewById <EditText>(Resource.Id.MesssageEditText);
            _sendButton               = activity.FindViewById <Button>(Resource.Id.SendButton);
            _adapter                  = new MessagesListAdapter(activity);
            _messagesListView.Adapter = _adapter;

            _sendButton.Click += SendMessage;

            _chatService = chatService;
            _chatService.ReceiveCallback = AddMessage;
        }
Exemplo n.º 3
0
        private void InitAdapter()
        {
            MessageHolders holders = new MessageHolders()
                                     .RegisterContentType(
                (sbyte)CONTENT_TYPE_VOICE,
                Class.FromType(typeof(IncomingVoiceMessageViewHolder)),
                Resource.Layout.item_custom_incoming_voice_message,
                Class.FromType(typeof(OutcomingVoiceMessageViewHolder)),
                Resource.Layout.item_custom_outcoming_voice_message,
                this);


            messagesAdapter = new MessagesListAdapter(base.senderId, holders, base.imageLoader);
            base.messagesAdapter.EnableSelectionMode(this);
            base.messagesAdapter.SetLoadMoreListener(this);
            this.messagesList.SetAdapter(base.messagesAdapter);
        }