protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.IndeterminateProgress);

            // Load contact infos
            string normalizedPhone = Intent.GetStringExtra("normalizedPhone");
            string message         = Intent.GetStringExtra("message");

            Contact contact = Contact.GetContactByPhone(normalizedPhone, this);

            // Get database instance
            Database = Manager.SharedInstance.GetDatabase(Tag.ToLower());

            var smsManager = new SMSManager(Database);
            var sms        = new SMS(normalizedPhone, message);

            // Create conversation document if not exist
            initConversation(sms);

            // If message comes from notification, add it to db
            string source = (string)Intent.GetStringExtra("source");

            if (source == "server")
            {
                sms.Source = source;
                smsManager.AddMessage(sms);
            }

            // Get previous messages
            // TODO : Filer messages to get only those from current conversation
            Query            = smsManager.GetQuery(sms.Target);
            Query.Completed += (sender, e) =>
                               Log.Verbose(Tag, e.ErrorInfo.ToString() ?? e.Rows.ToString());
            LiveQuery = Query.ToLiveQuery();

            SetContentView(Resource.Layout.Conversation);

            // Activate Back button in Action Bar
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            // Rethrive layout fields
            TextView             newMessageText    = FindViewById <TextView> (Resource.Id.txtMessageBox);
            FloatingActionButton sendMessageButton = FindViewById <FloatingActionButton> (Resource.Id.btnSendMessage);
            LinearLayout         layout            = FindViewById <LinearLayout> (Resource.Id.mainLinearLayout);
            ListView             listView          = FindViewById <ListView>(Resource.Id.listViewMessages);

            // Set ActionBar to contact name
            this.Title = contact.DisplayName + " " + contact.NormalizedNumber;

            sendMessageButton.Click += (sender, e) => {
                sms.Message = newMessageText.Text;
                sms.Source  = "app";
                Background(sms);

                newMessageText.Text = "";
            };

            Database.Changed += (sender, e) => {
                var changes = e.Changes.ToList();
                foreach (DocumentChange change in changes)
                {
                    Log.Verbose(Tag, "Document " + change.DocumentId + " changed");
                }
            };

            // Bind listview adapyer to liveQuery
            listView.Adapter = new ListLiveQueryAdapter(this, LiveQuery);
        }
 public MySimpleOnGestureListener(FloatingActionButton bu)
 {
     b = bu;
 }
Example #3
0
 public MyAnimatorListenerAdapter(FloatingActionButton bu)
 {
     b = bu;
 }
 public MyAnimatorListenerAdapter(FloatingActionButton bu)
 {
     b = bu;
 }
Example #5
0
 public MySimpleOnGestureListener(FloatingActionButton bu)
 {
     b = bu;
 }