Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var id = Intent.GetLongExtra(RecipientId, 0);

            viewModel = new ConversationViewModel(id);

            messagesListView = FindViewById <ListView>(Resource.Id.messages_list_view);

            //TODO: use RecycleView
            var adapter = new ObservableAdapaterBase <MessageViewModel>(ApplicationContext, viewModel.Messages,
                                                                        OnMessageTemplate,
                                                                        OnMessageViewCreate);

            adapter.AssignListView(messagesListView);

            sendButton   = FindViewById <ImageButton>(Resource.Id.send_button);
            attachButton = FindViewById <ImageButton>(Resource.Id.attach_button);
            typingText   = FindViewById <TextView>(Resource.Id.typing_text);
            inputText    = FindViewById <EditText>(Resource.Id.input_text);
            inputText.AfterTextChanged += InputTextChanged;

            sendButton.Click          += OnSendClick;
            attachButton.Click        += OnAttachClick;
            viewModel.PropertyChanged += ViewModel_PropertyChanged;
            viewModel.ExecuteLoadMessagesCommand();
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                toolbar.SetBackgroundResource(Settings.AppTheme == AppTheme.Red ? Resource.Drawable.red_gradient : Resource.Drawable.blue_gradient);
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            var id = Intent.GetLongExtra(RecipientId, 0);

            viewModel = new ConversationViewModel(id);

            messagesListView = FindViewById <ListView>(Resource.Id.messages_list_view);

            //TODO: use RecycleView
            var adapter = new ObservableAdapaterBase <MessageViewModel>(ApplicationContext, viewModel.Messages,
                                                                        OnMessageTemplate,
                                                                        OnMessageViewCreate);

            adapter.AssignListView(messagesListView);

            sendButton = FindViewById <ImageButton>(Resource.Id.send_button);
            typingText = FindViewById <TextView>(Resource.Id.typing_text);
            inputText  = FindViewById <EditText>(Resource.Id.input_text);
            inputText.AfterTextChanged += InputTextChanged;

            sendButton.Click          += OnSendClick;
            viewModel.PropertyChanged += ViewModel_PropertyChanged;
            viewModel.ExecuteLoadMessagesCommand();
        }