Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] Prototypical Cell Cache for IsEnabled testing; UITest #1153

Merged
merged 1 commit into from
Sep 29, 2017

Conversation

kingces95
Copy link
Contributor

@kingces95 kingces95 commented Sep 21, 2017

Description of Change

Expect checking if a cell is enabled does not always create a new view. Actually, before the stop gap fix, we had been creating a new view, binding, then checking if the view is enabled. As views are checked all the time to see if they are enabled this was a big leak.

The stop gap fix, which this fix replaces, was to create and cache a new view, _enabledCheckCell, and rebind that view to determine if a cell is enabled. That worked fine so long as all cells used the same type of view to render themselves. However, when a DataTemplateSelector is used, then different cells can use different views so its not sufficient to cache a single view.

This fix caches the correct view for a given type of cell which can be repeatedly rebound and checked to see if it's enabled. How the type of a cell is determined depends on the caching strategy.

Bugs Fixed

None; Discovered while fixing iOS caching.

API Changes

None

Behavioral Changes

None

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

@samhouts samhouts changed the title Prototypical Cell Cache for IsEnabled testing; UITest [Android] Prototypical Cell Cache for IsEnabled testing; UITest Sep 26, 2017
@@ -309,6 +311,68 @@ public override AView GetView(int position, AView convertView, ViewGroup parent)
return layout;
}

internal void InvalidatePrototypicalCellCache()
{
_prototypicalCellByTypeOrDataTemplate.Clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Invalidate the cache if the DataTemplateSelector changes. For now, just wanna get this in while I have a CI baseline.

var templatedItems = GetTemplatedItemsListForPath(indexPath);
return templatedItems.UpdateContent(protoCell, indexPath);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will rename indexPath to index and ForPath to ForIndex before merging. For now, leave as is so as not to trigger another test run.

@kingces95 kingces95 requested review from rmarinho and samhouts and removed request for rmarinho September 27, 2017 16:15
@kingces95 kingces95 merged commit 5272dd8 into master Sep 29, 2017
@samhouts samhouts added this to the 2.5.0 milestone May 5, 2018
@StephaneDelcroix StephaneDelcroix deleted the _52487 branch December 19, 2018 15:36
mattleibow pushed a commit that referenced this pull request Jan 28, 2021
Fix to fatal iOS 13 memory leak when using TextToSpeach.SpeekAsync #1112
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants