Example #1
0
            public bool SwitchToMicrophoneMode()
            {
                ScrollToBottom();
                string[] perms = { Android.Manifest.Permission.RecordAudio, Android.Manifest.Permission.WriteExternalStorage };

                if (!EasyPermissions.HasPermissions(currentActivity, perms))
                {
                    EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_record_voice), RC_RECORD_VOICE, perms);
                }
                return(true);
            }
Example #2
0
            public bool SwitchToGalleryMode()
            {
                ScrollToBottom();
                string[] perms = { Android.Manifest.Permission.ReadExternalStorage };

                if (!EasyPermissions.HasPermissions(currentActivity, perms))
                {
                    EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_photo), RC_PHOTO, perms);
                }
                mChatView.GetChatInputView().SelectPhotoView.UpdateData();
                return(true);
            }
Example #3
0
            public void OnStartRecord()
            {
                var perms = new string[] { Android.Manifest.Permission.WriteExternalStorage };

                if (!EasyPermissions.HasPermissions(_currentActivity, perms))
                {
                    EasyPermissions.RequestPermissions(_currentActivity, _currentActivity.Resources.GetString(Resource.String.rationale_camera), 0x0002, perms);
                }
                else
                {
                    string path = Android.OS.Environment.ExternalStorageDirectory.Path + "/voice";

                    var file = new Java.IO.File(path);
                    if (!file.Exists())
                    {
                        file.Mkdir();
                    }
                    mChatView.SetRecordVoiceFile(file.Path, DateTime.Now.ToString("yyyy-MM-dd-hhmmss"));
                }
            }
Example #4
0
            public bool SwitchToCameraMode()
            {
                ScrollToBottom();
                string[] perms =
                {
                    Android.Manifest.Permission.WriteExternalStorage,
                    Android.Manifest.Permission.Camera,
                    Android.Manifest.Permission.RecordAudio
                };

                if (!EasyPermissions.HasPermissions(currentActivity, perms))
                {
                    EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_camera), RC_CAMERA, perms);
                }
                else
                {
                    string fileDir = currentActivity.FilesDir.AbsolutePath + "/photo";

                    mChatView.SetCameraCaptureFile(fileDir, DateTime.Now.ToString("yyyyMMddHHmmss"));
                }

                return(true);
            }