Beispiel #1
0
        protected bool ChooseFile(IValueCallback filePathCallback, Intent intent, string title)
        {
            if (_activity == null)
            {
                return(false);
            }

            Action <Result, Intent> callback = (resultCode, intentData) =>
            {
                if (filePathCallback == null)
                {
                    return;
                }

                Android.Net.Uri[] result = ParseResult(resultCode, intentData);
                filePathCallback.OnReceiveValue(result);
            };

            _requestCodes = _requestCodes ?? new List <int>();

            int newRequestCode = WeavyActivityResultCallbackRegistry.RegisterActivityResultCallback(callback);

            _requestCodes.Add(newRequestCode);

            _activity.StartActivityForResult(Intent.CreateChooser(intent, title), newRequestCode);

            return(true);
        }
Beispiel #2
0
 public static void HandleActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
 {
     WeavyActivityResultCallbackRegistry.InvokeCallback(requestCode, resultCode, data);
 }