예제 #1
0
        public async void searchContactByEmail(string email, ActivityService ActivityService)
        {
            User user = new User();

            ActivityService.GetInstance.App.Xmpp.Search(email, delegate(object s, Matrix.Xmpp.Client.IqEventArgs eIq)
            {
                var iq = eIq.Iq;
                if (iq.Type == Matrix.Xmpp.IqType.Result)
                {
                    var searchQuery = iq.Query as Matrix.Xmpp.Search.Search;
                    foreach (var sItem in searchQuery.GetItems())
                    {
                        Log.Info("search result: " + sItem.Jid + "\n");
                        user.Jid = sItem.Jid;
                    }
                }
            });
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.callType = this.Intent.GetStringExtra("callType");
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);
            SetContentView(Resource.Layout.Video);
            Layout          = (RelativeLayout)FindViewById(Resource.Id.layout);
            ActivityService = ActivityService.GetInstance;
            if (friend == null)
            {
                if (this.callType.Equals("incoming"))
                {
                    friend          = new AppCore.User();
                    friend.Jid      = this.Intent.GetStringExtra("userChat");
                    friend.username = LegionUtils.GetUserNameClear(friend.Jid);
                }
                else
                {
                    friend = LegionUtils.getUserson(Intent.GetStringExtra("userChat"));
                }
            }

            //ActivityService.GetInstance.App.Xmpp.OnReceiveSessionAccept += (sender, e) => {
            //	Log.Info("Success connection");

            //	//RunOnUiThread(() =>
            //	//		showConnectionVideo(true)
            //	//		 );

            //};



            //Bgconnection = (ImageView)FindViewById(Resource.Id.
            //                                       bgconnection);
            //avatar = (ImageView)FindViewById(Resource.Id.avatarFriend);
            if (friend.Photo != null)
            {
                //Bitmap bitmap = xmppFace.Base64ToBitmap(friend.Photo);
                //var d = new CircleDrawable(bitmap);
                //avatar.SetBackgroundDrawable(d);
            }
            //TxUserName = (TextView)FindViewById(Resource.Id.userNameFriend);
            //TxUserName.Text = friend.username;
            //TxConnection = (TextView)FindViewById(Resource.Id.connect);

            LeaveButton = (ImageButton)FindViewById(Resource.Id.leaveButton);

            // Load native libraries.
            if (!Build.CpuAbi.ToLower().Contains("x86") && !Build.CpuAbi.ToLower().Contains("arm64"))
            {
                Java.Lang.JavaSystem.LoadLibrary("audioprocessing");
                Java.Lang.JavaSystem.LoadLibrary("audioprocessingJNI");
            }
            Java.Lang.JavaSystem.LoadLibrary("opus");
            Java.Lang.JavaSystem.LoadLibrary("opusJNI");
            Java.Lang.JavaSystem.LoadLibrary("vpx");
            Java.Lang.JavaSystem.LoadLibrary("vpxJNI");

            LeaveButton.Click += new EventHandler(LeaveButton_Click);

            Messaging.Log.Debug("VideoActivity adding event handler Xmpp_OnReceiveSessionTerminate");
            //oadXmppConnect(this);
            ActivityService.GetInstance.App.Xmpp.OnReceiveSessionTerminate += Xmpp_OnReceiveSessionTerminate;
            //ActivityService.GetInstance.App.Xmpp.OnReceiveSessionInitiate += Xmpp_OnReceiveSessionInitiate;

            // For demonstration purposes, use the double-tap gesture
            // to switch between the front and rear camera.
            GestureDetector = new GestureDetector(this, new OnGestureListener(ActivityService.GetInstance.App));

            // Preserve a static container across
            // activity destruction/recreation.
            var c = (RelativeLayout)FindViewById(Resource.Id.container);

            if (Container == null)
            {
                Container = c;

                Toast.MakeText(this, "Double tap to switch camera.", ToastLength.Short).Show();
            }
            Layout.RemoveView(c);

            if (!LocalMediaStarted)
            {
                StartLocalMedia();
            }
        }