Example #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();
        }
        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 ();
        }
        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 ();
        }
Example #4
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();
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			viewModel = new ConversationViewModel (RecipientId);

			/**
		     *  You MUST set your senderId and display name
		     */
			SenderId = Settings.MyId.ToString();
			SenderDisplayName = Settings.NickName;

			this.CollectionView.CollectionViewLayout.SpringinessEnabled = false;

			/**
		     *  Load up our fake data for the demo
		     */
			CollectionView.CollectionViewLayout.IncomingAvatarViewSize = CoreGraphics.CGSize.Empty;
			CollectionView.CollectionViewLayout.OutgoingAvatarViewSize = CoreGraphics.CGSize.Empty;
			CollectionView.CollectionViewLayout.MessageBubbleFont = Theme.Current.MessageFont;


			ShowLoadEarlierMessagesHeader = false;

			this.InputToolbar.ContentView.TextView.PlaceHolder = "Type a message here";
			this.InputToolbar.ContentView.RightBarButtonItem.SetImage (UIImage.FromBundle ("sendTextIcon"), UIControlState.Normal);
			this.InputToolbar.ContentView.RightBarButtonItem.SetTitle("", UIControlState.Normal);
			this.InputToolbar.ContentView.LeftBarButtonItem = null;
			/*NavigationItem.RightBarButtonItem = new UIBarButtonItem (
				BubbleImageFromBundleWithName ("typing"), UIBarButtonItemStyle.Bordered, ReceiveMessagePressed);*/
		}