public void OnParticipantSelectionChanged(AtlasAddressBar addressBar, IList <string> participantIds)
 {
     if (participantIds.Count == 0)
     {
         _activity.SetConversation(null, false);
         return;
     }
     try
     {
         _activity.SetConversation(_activity.GetLayerClient().NewConversation(new ConversationOptions().Distinct(true), participantIds), false);
     }
     catch (LayerConversationException e)
     {
         _activity.SetConversation(e.Conversation, false);
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (App.RouteLogin(this))
            {
                if (!IsFinishing)
                {
                    Finish();
                }
                return;
            }

            mAddressBar = FindViewById <AtlasAddressBar>(Resource.Id.conversation_launcher)
                          .Init(GetLayerClient(), GetParticipantProvider(), GetPicasso())
                          .SetOnConversationClickListener(new AtlasAddressBarOnConversationClickListener(this))
                          .SetOnParticipantSelectionChangeListener(new AtlasAddressBarOnParticipantSelectionChangeListener(this))
                          .AddTextChangedListener(new AtlasAddressBarTextWatcher(this))
                          .SetOnEditorActionListener(new AtlasAddressBarOnEditorActionListener(this));

            mHistoricFetchLayout = FindViewById <AtlasHistoricMessagesFetchLayout>(Resource.Id.historic_sync_layout)
                                   .Init(GetLayerClient())
                                   .SetHistoricMessagesPerFetch(20);

            mMessagesList = FindViewById <AtlasMessagesRecyclerView>(Resource.Id.messages_list)
                            .Init(GetLayerClient(), GetParticipantProvider(), GetPicasso())
                            .AddCellFactories(
                new TextCellFactory(),
                new ThreePartImageCellFactory(this, GetLayerClient(), GetPicasso()),
                new LocationCellFactory(this, GetPicasso()),
                new SinglePartImageCellFactory(this, GetLayerClient(), GetPicasso()),
                new GenericCellFactory())
                            .SetOnMessageSwipeListener(new SwipeableItemOnSwipeListener(this));

            mTypingIndicator = new AtlasTypingIndicator(this)
                               .Init(GetLayerClient())
                               .SetTypingIndicatorFactory(new BubbleTypingIndicatorFactory())
                               .SetTypingActivityListener(new AtlasTypingIndicatorTypingActivityListener(this));

            mMessageComposer = FindViewById <AtlasMessageComposer>(Resource.Id.message_composer)
                               .Init(GetLayerClient(), GetParticipantProvider())
                               .SetTextSender(new TextSender())
                               .AddAttachmentSenders(
                new CameraSender(Resource.String.attachment_menu_camera, Java.Lang.Integer.ValueOf(Resource.Drawable.ic_photo_camera_white_24dp), this),
                new GallerySender(Resource.String.attachment_menu_gallery, Java.Lang.Integer.ValueOf(Resource.Drawable.ic_photo_white_24dp), this),
                new LocationSender(Resource.String.attachment_menu_location, Java.Lang.Integer.ValueOf(Resource.Drawable.ic_place_white_24dp), this));
            mMessageComposer.FocusChange += (sender, args) =>
            {
                if (args.HasFocus)
                {
                    SetUiState(UiState.CONVERSATION_COMPOSER);
                    SetTitle(true);
                }
            };

            // Get or create Conversation from Intent extras
            Conversation conversation = null;
            Intent       intent       = Intent;

            if (intent != null)
            {
                if (intent.HasExtra(PushNotificationReceiver.LAYER_CONVERSATION_KEY))
                {
                    Uri conversationId = intent.GetParcelableExtra(PushNotificationReceiver.LAYER_CONVERSATION_KEY) as Uri;
                    conversation = GetLayerClient().GetConversation(conversationId);
                }
                else if (intent.HasExtra("participantIds"))
                {
                    string[] participantIds = intent.GetStringArrayExtra("participantIds");
                    try {
                        conversation = GetLayerClient().NewConversation(new ConversationOptions().Distinct(true), participantIds);
                    } catch (LayerConversationException e) {
                        conversation = e.Conversation;
                    }
                }
            }
            SetConversation(conversation, conversation != null);
        }
 public void OnConversationClick(AtlasAddressBar addressBar, Conversation conversation)
 {
     _activity.SetConversation(conversation, true);
     _activity.SetTitle(true);
 }