private void InitializeUI()
 {
     try
     {
         lv_messages = FindViewById <ListView>(Resource.Id.lv_messages);
         List <string> items = new List <string>();
         adapter             = new MessagesAdapter(this, Resource.Layout.Simple_Item_Template, items);
         lv_messages.Adapter = adapter;
         adapter.NotifyDataSetChanged();
         et_content      = FindViewById <EditText>(Resource.Id.et_instruction);
         btn_send        = FindViewById <Button>(Resource.Id.btn_send);
         btn_send.Click += (sender, args) =>
         {
             string message = et_content.Text;
             if (string.IsNullOrWhiteSpace(message) == false)
             {
                 loungeProxy.Invoke <string>("pingHello", message);
                 et_content.Text = "";
             }
         };
     }
     catch (Exception ex)
     {
         ex.ToString();
     }
 }
Exemplo n.º 2
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = Mail.CurrentFolder.FullName;

            SetContentView(Resource.Layout.MessagesLayout);

            listView = FindViewById <ListView> (Resource.Id.listView);

            adapter          = new MessagesAdapter(this);
            listView.Adapter = adapter;

            listView.ItemClick += async(sender, e) => {
                var summary = adapter [e.Position];

                var msg = await Mail.CurrentFolder.GetMessageAsync(summary.UniqueId.Value);

                Mail.CurrentMessage = msg;

                StartActivity(typeof(ViewMessageActivity));
            };

            await Reload();
        }
Exemplo n.º 3
0
 private void Init()
 {
     lvMessages         = FindViewById <ListView>(Resource.Id.lvChats);
     Messages           = new List <Models.Message>();
     adapter            = new MessagesAdapter(this, Messages);
     lvMessages.Adapter = adapter;
 }
Exemplo n.º 4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mainView = inflater.Inflate(Resource.Layout.screen_messages, container, false);

            contentContainer = mainView.FindViewById <RecyclerView>(Resource.Id.message_maincontainer);

            contentContainer.SetLayoutManager(new LinearLayoutManager(Activity));
            messagesAdapter = new MessagesAdapter(contents, FragmentManager);
            contentContainer.SetAdapter(messagesAdapter);
            return(mainView);
        }
Exemplo n.º 5
0
        public void ChangeChannel(string channelId)
        {
            if (activeChat != null)
            {
                if (activeChat.Id.Equals(channelId))
                {
                    return;
                }

                activeChat.Hide();
            }

            if (chats.ContainsKey(channelId))
            {
                chats[channelId].Show();
                activeChat = chats[channelId];
            }
            else
            {
                MessagesAdapter adapter = null;
                switch (channelId[0])
                {
                case 'D':
                    adapter = new DirectMessageAdapter(Client.DirectMessages.Find((c) => c.id == channelId), this, Client);
                    break;

                case 'C':
                    adapter = new ChannelAdapter(Client.ChannelLookup[channelId], this, Client);
                    break;

                case 'G':
                    adapter = new GroupAdapter(Client.GroupLookup[channelId], this, Client);
                    break;
                }

                if (adapter != null)
                {
                    activeChat          = new ChatInterface(adapter, this);
                    activeChat.Location = new Point(220, 0);
                    activeChat.Width    = Width - 220;
                    activeChat.Height   = Height;
                    activeChat.Anchor   = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top;
                    chats.Add(channelId, activeChat);
                    Controls.Add(activeChat);
                }
                else if (activeChat != null)
                {
                    activeChat.Show();
                }
            }
        }
Exemplo n.º 6
0
        public ChatInterface(MessagesAdapter adapter, ConnectedInterface connected)
        {
            this.connected = connected;
            this.adapter   = adapter;
            entries        = new List <MessageEntry>();
            Id             = adapter.GetId();

            messages   = new Font(CustomFonts.Fonts.Families[1], 11);
            timestamps = new Font(CustomFonts.Fonts.Families[1], 9);

            InitializeComponent();

            uploadFile.Font = new Font(CustomFonts.Fonts.Families[0], 18);
            textInput.Font  = new Font(CustomFonts.Fonts.Families[1], 11);

            string title = adapter.GetTitle();
            string topic = adapter.GetTopic();

            Label titleLabel = new Label();

            titleLabel.Text      = title;
            titleLabel.Location  = new Point(24, 0);
            titleLabel.Font      = new Font(CustomFonts.Fonts.Families[1], 16, FontStyle.Bold);
            titleLabel.Size      = new Size(titleLabel.PreferredWidth, 53);
            titleLabel.TextAlign = ContentAlignment.MiddleLeft;
            channelTitle.Controls.Add(titleLabel);

            sizes = new Dictionary <int, int>();

            MessageHistory history = adapter.GetMessages(null, null, null);

            lastTimeStamp = history.latest;

            bool firstFetch = lastMessage == null;

            foreach (SlackAPI.Message message in history.messages.Reverse())
            {
                AddMessage(message);
            }

            connected.Client.BindCallback <NewMessage>(Client_OnMessageReceived);
            //BeginInvoke(new Action(() => chatContent.AutoScrollPosition = new Point(lastMessage.Left, chatContent.DisplayRectangle.Height)));
        }
        private void Init()
        {
            Messages = new List <Models.Message>();

            lvMessages            = FindViewById <ListView>(Resource.Id.lvChats);
            adapter               = new MessagesAdapter(this, Messages);
            lvMessages.Adapter    = adapter;
            lvMessages.ItemClick += OnListItemClick;

            pref        = PreferenceManager.GetDefaultSharedPreferences(this);
            CurrentUser = JsonConvert.DeserializeObject <User>(pref.GetString(Constants.PREF_USER_TAG, ""));

            InitilizeRegions();

            _beaconManager = new BeaconManager(this);

            _beaconManager.SetForegroundScanPeriod(1500, 2000);

            _beaconManager.Ranging += OnRanging;

            _beaconManager.ExitedRegion += OnExitedRegion;
        }