Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SingleChat.Instance = this;
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SingleChat);
            this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            database          = new SQLiteRepository();
            messageRepository = new MessageRepository(database);
            contactRepository = new ContactRepository(database);

            service = new Intent(this, typeof(ReceiveService));
            if (!IsMyServiceRunning(service))
            {
                StartService(service);
            }

            extra = Intent.GetStringExtra("MyContact");
            var c = contactRepository.GetContactByPhone(extra);

            nombre      = FindViewById <TextView>(Resource.Id.nombre);
            nombre.Text = c.FirstName + " " + c.LastName;
            _lv         = FindViewById <ListView>(Resource.Id.listView1);
            _adapter    = new MyAdapterSingle(this, Resource.Layout.SingleChatItem, GetChats());
            _lv.Adapter = _adapter;
        }
Esempio n. 2
0
            public override void OnReceive(Context context, Intent intent)
            {
                var _adapter = new MyAdapterSingle(SingleChat.Instance, Resource.Layout.SingleChatItem, SingleChat.Instance.GetChats());
                var _lv      = SingleChat.Instance.FindViewById <ListView>(Resource.Id.listView1);

                _lv.Adapter = _adapter;
            }
Esempio n. 3
0
 public void MensajeEnviado(TLAbsUpdates updates, string fromPhone, string mensaje)
 {
     if (updates != null)
     {
         Chat m = new Chat
         {
             FromTo  = fromPhone,
             Mensaje = mensaje,
             Send    = true,
             Created = DateTime.Now,
             Seen    = true
         };
         messageRepository.InsertMessage(m);
         Vibrator vibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
         vibrator.Vibrate(1000);
         _adapter    = new MyAdapterSingle(this, Resource.Layout.SingleChatItem, GetChats());
         _lv.Adapter = _adapter;
         count       = 0;
         textToSpeak = "Mensaje enviado. ¿Quiere leer desde una fecha, buscar por un mensaje, no hacer nada o volver atrás?";
         toSpeech    = new TextToSpeech(this, this);
     }
     else
     {
         count       = 0;
         textToSpeak = "No se ha podido enviar el mensaje. Inténtelo más tarde. ¿Quiere leer desde una fecha, buscar por un mensaje, no hacer nada o volver atrás?";
         toSpeech    = new TextToSpeech(this, this);
     }
 }