Exemplo n.º 1
0
        /// <inheritdoc />
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            AlbumView.LayoutIfNeeded();
            _cameraView.LayoutIfNeeded();

            var albumDataSource = LazyDataSource(AlbumView, AlbumView.CellSize, MediaTypes);
            var albumDelegate   = LazyDelegate(AlbumView, albumDataSource);

            AlbumDataSource = albumDataSource;
            AlbumDelegate   = albumDelegate;

            var local = AlbumDataSource as LocalFilesDataSource;

            if (local != null)
            {
                local.InitialSelectedImagePath = InitialSelectedImagePath;
            }

            AlbumView.Initialize(AlbumDataSource, AlbumDelegate);
            _cameraView.Initialize(OnImageFinished);

            local?.ShowFirstImage();

            if (HasVideo)
            {
                _videoView.LayoutIfNeeded();
                _videoView.Initialize(OnVideoFinished);
                _videoView.CameraUnauthorized += OnCameraUnauthorized;
            }

            _libraryButton.TouchUpInside += LibraryButtonPressed;
            _menuView.Closed             += CloseButtonPressed;
            _menuView.Done += DoneButtonPressed;
            _cameraButton.TouchUpInside += CameraButtonPressed;
            _videoButton.TouchUpInside  += VideoButtonPressed;

            AlbumDataSource.CameraRollUnauthorized += OnCameraRollUnauthorized;
            _cameraView.CameraUnauthorized         += OnCameraUnauthorized;

            switch (Configuration.ModeOrder)
            {
            case ModeOrder.CameraFirst:
                ChangeMode(Mode.Camera);
                break;

            case ModeOrder.VideoFirst:
                ChangeMode(HasVideo ? Mode.Video : Mode.Library);     // Fallback to Library if the Video is disabled
                break;

            case ModeOrder.LibraryFirst:
                ChangeMode(Mode.Library);
                break;
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override void ItemSelected(
            UICollectionView collectionView, NSIndexPath indexPath)
        {
            UIView.AnimateNotify(0.2, 0.0, UIViewAnimationOptions.CurveEaseOut, () =>
            {
                _albumView.ImageCropView.Scrollable                = true;
                _albumView.ImageCropView.Alpha                     = 1.0f;
                _albumView.MovieView.Alpha                         = 1.0f;
                _albumView.MovieViewConstraintTop.Constant         =
                    _albumView.ImageCropViewConstraintTop.Constant =
                        AlbumView.ImageCropViewOriginalConstraintTop;
                _albumView.CollectionViewConstraintHeight.Constant =
                    _albumView.Frame.Height - AlbumView.ImageCropViewOriginalConstraintTop -
                    _albumView.ImageCropView.Frame.Height;
                _albumView.CollectionViewConstraintTop.Constant = 0;
                _albumView.LayoutIfNeeded();
            },
                                 finished => { });

            _albumView.DragDirection = DragDirection.Up;
            _albumView.CollectionView.ScrollToItem(indexPath, UICollectionViewScrollPosition.Top, true);
        }