jamesmontemagno / MediaPlugin

Take & Pick Photos and Video Plugin for Xamarin and Windows
MIT License
713 stars 358 forks source link

Image Picker Order (Android only) #907

Open shailensukul opened 3 years ago

shailensukul commented 3 years ago

Bug Information

Version Number of Plugin: 5.0.1 Device Tested On: Pixel 3a Simulator Tested On: Pixel 2 Pie 9.0 (Android 9.0 - API 28) Version of VS: 2019 16.7.7 Version of Xamarin: 16.7.000.463

Steps to reproduce the Behavior

  1. Open app
  2. Go to image picker
  3. Pick multiple images in order
  4. Check the files returned by the picker
  5. They are not in the order selected

Expected Behavior

Files should be returned in the order selected

Actual Behavior

Files seem to be in random order

Code snippet

private async Task<StockGalleryPickerSet> PickImagesAsync(CancellationToken cancellation)
        {
            await CrossMedia.Current.Initialize();
            if (CrossMedia.Current.IsPickPhotoSupported)
            {
                var mediaOption = new PickMediaOptions
                {
                    PhotoSize = PhotoSize.MaxWidthHeight,
                    CompressionQuality = 92,
                    MaxWidthHeight = 1920
                };

                var multiPickOptions = new MultiPickerOptions 
                { 
                    MaximumImagesCount = 100
                };

                var files = await CrossMedia.Current.PickPhotosAsync(mediaOption, multiPickOptions, cancellation);
                if (files != null)
                {

                    var mapped = from file in files
                                 select new StockGalleryPickerMediaFile(file.Path, file.GetStreamWithImageRotatedForExternalStorage);
                    var results = new StockGalleryPickerSet()
                    {
                        Items = mapped.ToList()
                    };

                    return results;
                }
            }

            return null;
        } 

Screenshots

image

178884875 commented 2 years ago

This is just multiple selection without sequence, or the sequence is the sequence of pictures rather than the sequence of selection. For example, the disordered effect of realizing the sequence of pictures with selection serial numbers rather than checklists should be realized manually.