Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionView - Recycle DataTemplates when using template selector #12011

Merged
merged 24 commits into from
May 15, 2023

Commits on Dec 10, 2022

  1. [Android] Use different view types per item template

    Previously we were returning a single view type id for all 'items' in collectionview, which meant if you were using a template selector, and had a variety of returned different DataTemplates, each would share the same recycled item.  When a recycled item is reused for a different template, it causes the view for that template to be recreated to be correct for the template selected.
    
    This change returns a unique item id per DataTemplate.Type, so that recycled items should always have the correct DataTemplate.Type and not need to be recreated with a different view hierarchy.
    Redth committed Dec 10, 2022
    Configuration menu
    Copy the full SHA
    22443a6 View commit details
    Browse the repository at this point in the history
  2. [iOS] Distinct Cell reuse id's for different DataTemplates

    Like on Android, we were using a single cell reuse identifier for iOS "items" regardless of if they had different DataTemplates.  If you were using a data template selector, and returned different data templates, whenever a recycled cell's data template didn't match the data template it needed to display for the new/recycled context, the whole view tree of that template would be recreated.
    
    This change ensures we have a unique cell reuse id for every different DataTemplate.Type that might be returned by the template selector so that when a cell is recycled it should always be reused for the same Data Template it was created for, and so the view hierarchy won't be recreated.
    
    This does require the DetermineCellReuseId to know the indexpath we're getting it for, so a new method was introduced, internal for NET7, protected for NET8+, and in NET8+ the old method is obsoleted.
    Redth committed Dec 10, 2022
    Configuration menu
    Copy the full SHA
    2e0bfba View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2023

  1. Configuration menu
    Copy the full SHA
    4c411fe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    21ec9a8 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2023

  1. Configuration menu
    Copy the full SHA
    3401e73 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c3b3643 View commit details
    Browse the repository at this point in the history
  3. Api changes (overrides)

    Redth committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    44a9196 View commit details
    Browse the repository at this point in the history
  4. Improve sample

    Redth committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    5874aa0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    846db59 View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2023

  1. Configuration menu
    Copy the full SHA
    cfe3cc1 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2023

  1. Update src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsVie…

    …wAdapter.cs
    
    Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>
    Redth and hartez committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    d518d52 View commit details
    Browse the repository at this point in the history
  2. Update src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsVie…

    …wAdapter.cs
    
    Co-authored-by: Rui Marinho <me@ruimarinho.net>
    Redth and rmarinho committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    6b7efed View commit details
    Browse the repository at this point in the history
  3. Update src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsVie…

    …wAdapter.cs
    
    Co-authored-by: Rui Marinho <me@ruimarinho.net>
    Redth and rmarinho committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    354f909 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7447e65 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2e24c68 View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2023

  1. Configuration menu
    Copy the full SHA
    81f9e10 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2023

  1. Configuration menu
    Copy the full SHA
    847ae79 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    42b34e6 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2023

  1. Configuration menu
    Copy the full SHA
    f3e27f7 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2023

  1. Configuration menu
    Copy the full SHA
    9448f74 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2023

  1. Configuration menu
    Copy the full SHA
    9038032 View commit details
    Browse the repository at this point in the history

Commits on May 10, 2023

  1. Configuration menu
    Copy the full SHA
    63cdae2 View commit details
    Browse the repository at this point in the history

Commits on May 12, 2023

  1. Configuration menu
    Copy the full SHA
    8fc33f7 View commit details
    Browse the repository at this point in the history

Commits on May 15, 2023

  1. Calculate correct position for carousel adapter

    The `CarouselViewAdapter` loops by basically returning a very large value for item count of its adapter/source which means the recyclerview is going to ask for view types with a position value that does not actually exist.
    
    Previously this was ok because we returned only a single item view type ever, however now that we want to return a different type for template selector scenarios where there are potentially multiple template types, we need to override also the `GetItemViewType` and pass in the calculated position in the list properly (as we do in `OnBindViewHolder` here already) since the base `ItemsViewAdapter` class now calls `ItemsSource.GetItem(position)` in its `GetItemViewType()` call.
    Redth committed May 15, 2023
    Configuration menu
    Copy the full SHA
    c67d36f View commit details
    Browse the repository at this point in the history