protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     ActivityResult?.Invoke(requestCode, resultCode, data);
     var mediaPickerService = (MultiMediaPickerService)ComponentFactory.Resolve <IMultiMediaPickerService>();
     await mediaPickerService.OnActivityResult(requestCode, resultCode, data);
 }
Exemple #2
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode != (int)Request.Voice)
            {
                return;
            }
            if (resultCode != Result.Ok)
            {
                return;
            }
            var results = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults);

            if (results.Count <= 0)
            {
                return;
            }
            var result = string.Join(" ", results);

            _voiceResultValue = result;
            if (_onVoiceResult != null)
            {
                _onVoiceResult.Start();
            }

            if (ActivityResult != null)
            {
                ActivityResult.Invoke(this, new ActivityResultArgs()
                {
                    RequestCode = requestCode, ResultCode = resultCode, Data = data
                });
            }
        }
Exemple #3
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            //Since we set the request code to 1 for both the camera and photo gallery, that's what we need to check for
            if (requestCode == 0)
            {
                if (resultCode == Result.Ok)
                {
                    ActivityResult?.Invoke(this, new ActivityResultEventArgs {
                        Intent = data
                    });
                    Task.Run(() =>
                    {
                        if (App.ImageIdToSave != null)
                        {
                            var documentsDirectry = ActivityContext.GetExternalFilesDir(Android.OS.Environment.DirectoryPictures);
                            string pngFilename    = System.IO.Path.Combine(documentsDirectry.AbsolutePath, App.ImageIdToSave + "." + FileFormatEnum.JPEG.ToString());

                            if (File.Exists(pngFilename))
                            {
                                Java.IO.File file   = new Java.IO.File(documentsDirectry, App.ImageIdToSave + "." + FileFormatEnum.JPEG.ToString());
                                Android.Net.Uri uri = Android.Net.Uri.FromFile(file);

                                //Read the meta data of the image to determine what orientation the image should be in
                                var originalMetadata = new ExifInterface(pngFilename);
                                int orientation      = GetRotation(originalMetadata);

                                var fileName = App.ImageIdToSave + "." + FileFormatEnum.JPEG.ToString();
                                HandleBitmap(uri, orientation, fileName);
                            }
                        }
                    });
                }
            }
            else if (requestCode == 1)
            {
                if (resultCode == Result.Ok)
                {
                    if (data.Data != null)
                    {
                        //Grab the Uri which is holding the path to the image
                        Android.Net.Uri uri = data.Data;

                        string fileName = null;

                        if (App.ImageIdToSave != null)
                        {
                            fileName = App.ImageIdToSave + "." + FileFormatEnum.JPEG.ToString();
                            var pathToImage      = GetPathToImage(uri);
                            var originalMetadata = new ExifInterface(pathToImage);
                            int orientation      = GetRotation(originalMetadata);

                            HandleBitmap(uri, orientation, fileName);
                        }
                    }
                }
            }
        }
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     ActivityResult?.Invoke(this, new ActivityResultEventArgs()
     {
         RequestCode = requestCode, ResultCode = resultCode, Data = data
     });
     base.OnActivityResult(requestCode, resultCode, data);
 }
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     ActivityResult?.Invoke(requestCode, resultCode, data);
 }
Exemple #6
0
 public virtual void OnActivityResult(Action <int, Result, Intent> baseOnActivityResult, int requestCode, Result resultCode, Intent data)
 {
     baseOnActivityResult(requestCode, resultCode, data);
     ActivityResult?.Invoke(Target, new ActivityResultEventArgs(requestCode, resultCode, data));
 }
Exemple #7
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     ActivityResult?.Invoke(requestCode, resultCode, data);
     MultiMediaPickerService.SharedInstance.OnActivityResult(requestCode, resultCode, data);
 }