private static DropdownController <IosImagePickerCameraDevice> SetupCameraDeviceDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown) { var allCameraDevices = new[] { IosImagePickerCameraDevice.Front, IosImagePickerCameraDevice.Rear, }; var valueVisibilityFilter = default(Func <IosImagePickerCameraDevice, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = NativeIosImagePicker.IsCameraDeviceAvailable; } var dropdownController = new DropdownController <IosImagePickerCameraDevice>( allCameraDevices, rowGameObject, dropdown, () => iosImagePicker.CameraDevice, cameraDevice => iosImagePicker.CameraDevice = cameraDevice, valueVisibilityFilter); dropdownController.Setup(); return(dropdownController); }
private static DropdownController <IosImagePickerSourceType> SetupSourceTypeDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown) { var allSourceTypes = new[] { IosImagePickerSourceType.PhotoLibrary, IosImagePickerSourceType.Camera, IosImagePickerSourceType.SavedPhotosAlbum, }; var valueVisibilityFilter = default(Func <IosImagePickerSourceType, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = NativeIosImagePicker.IsSourceTypeAvailable; } var dropdownController = new DropdownController <IosImagePickerSourceType>( allSourceTypes, rowGameObject, dropdown, () => iosImagePicker.SourceType, sourceType => iosImagePicker.SourceType = sourceType, valueVisibilityFilter); dropdownController.Setup(); return(dropdownController); }
private static DropdownController <IosImagePickerVideoQualityType> SetupVideoQualityDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown, ToggleGroupController <string> mediaTypesToggleGroupController) { var allQualityTypes = new[] { IosImagePickerVideoQualityType.High, IosImagePickerVideoQualityType.Medium, IosImagePickerVideoQualityType.Low, IosImagePickerVideoQualityType.VGA640x480, IosImagePickerVideoQualityType.IFrame1280x720, IosImagePickerVideoQualityType.IFrame960x540, }; var valueVisibilityFilter = default(Func <IosImagePickerVideoQualityType, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = qualityType => { var currentMediaTypes = iosImagePicker.MediaTypes; return(currentMediaTypes != null && Array.IndexOf(currentMediaTypes, iosImagePicker.MediaTypeMovie) > -1); }; } var dropdownController = new DropdownController <IosImagePickerVideoQualityType>( allQualityTypes, rowGameObject, dropdown, () => iosImagePicker.VideoQuality, videoQuality => iosImagePicker.VideoQuality = videoQuality, valueVisibilityFilter); dropdownController.Setup(); mediaTypesToggleGroupController.AddDependantController(dropdownController); return(dropdownController); }
private static DropdownController <bool> SetupAllowsEditingDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown) { var allValues = new[] { false, true, }; var dropdownController = new DropdownController <bool>( allValues, rowGameObject, dropdown, () => iosImagePicker.AllowsEditing, allowsEditing => iosImagePicker.AllowsEditing = allowsEditing, null); dropdownController.Setup(); return(dropdownController); }
private static DropdownController <TimeSpan> SetupVideoMaxDurationDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown, ToggleGroupController <string> mediaTypesToggleGroupController) { var allMaxDurations = new[] { TimeSpan.FromSeconds(30.0), TimeSpan.FromSeconds(200.0), TimeSpan.FromSeconds(600.0), }; iosImagePicker.VideoMaximumDuration = allMaxDurations[0]; var valueVisibilityFilter = default(Func <TimeSpan, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = maxDuration => { var currentMediaTypes = iosImagePicker.MediaTypes; return(currentMediaTypes != null && Array.IndexOf(currentMediaTypes, iosImagePicker.MediaTypeMovie) > -1); }; } var dropdownController = new DropdownController <TimeSpan>( allMaxDurations, rowGameObject, dropdown, () => iosImagePicker.VideoMaximumDuration, maxDuration => iosImagePicker.VideoMaximumDuration = maxDuration, valueVisibilityFilter); dropdownController.Setup(); mediaTypesToggleGroupController.AddDependantController(dropdownController); return(dropdownController); }
private static DropdownController <IosImagePickerCameraFlashMode> SetupCameraFlashModeDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown, DropdownController <IosImagePickerCameraDevice> cameraDeviceDropdownController) { var allFlashModes = new[] { IosImagePickerCameraFlashMode.Auto, IosImagePickerCameraFlashMode.On, IosImagePickerCameraFlashMode.Off, }; var valueVisibilityFilter = default(Func <IosImagePickerCameraFlashMode, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = flashMode => { var currentCameraDevice = iosImagePicker.CameraDevice; return(flashMode != IosImagePickerCameraFlashMode.On || NativeIosImagePicker.IsFlashAvailableForCameraDevice(currentCameraDevice)); }; } var dropdownController = new DropdownController <IosImagePickerCameraFlashMode>( allFlashModes, rowGameObject, dropdown, () => iosImagePicker.CameraFlashMode, flashMode => iosImagePicker.CameraFlashMode = flashMode, valueVisibilityFilter); dropdownController.Setup(); cameraDeviceDropdownController.AddDependantController(dropdownController); return(dropdownController); }
private static DropdownController <IosImagePickerCameraCaptureMode> SetupCameraCaptureModeDropdown( IIosImagePicker iosImagePicker, GameObject rowGameObject, Dropdown dropdown, DropdownController <IosImagePickerCameraDevice> cameraDeviceDropdownController) { var allCaptureModes = new[] { IosImagePickerCameraCaptureMode.Photo, IosImagePickerCameraCaptureMode.Video, }; var valueVisibilityFilter = default(Func <IosImagePickerCameraCaptureMode, bool>); if (iosImagePicker is NativeIosImagePicker) { valueVisibilityFilter = captureMode => { var currentCameraDevice = iosImagePicker.CameraDevice; var availableCaptureModes = NativeIosImagePicker.AvailableCaptureModesForCameraDevice(currentCameraDevice); return(availableCaptureModes != null && Array.IndexOf(availableCaptureModes, captureMode) > -1); }; } var dropdownController = new DropdownController <IosImagePickerCameraCaptureMode>( allCaptureModes, rowGameObject, dropdown, () => iosImagePicker.CameraCaptureMode, captureMode => iosImagePicker.CameraCaptureMode = captureMode, valueVisibilityFilter); dropdownController.Setup(); cameraDeviceDropdownController.AddDependantController(dropdownController); return(dropdownController); }