Fix suggestion dismissing when underlying data changes
When a suggestion is dismissed from the NewTabPage using the 'Remove' context menu item, the content that it refers to cannot be looked up from the corresponding ViewHolder, as onBindViewHolder may be called while the context menu is still open (which would result in the wrong suggestion being dismissed). Instead, store the referenced suggestion in the listener for the context menu items. This requires some additional refactorings. When the 'Remove' item is clicked for a suggestion that has been removed for other reasons (section became unavailable, suggestion was invalidated) in the meantime, ignore the call. When it is clicked for a suggestion that as moved out of the visible view, skip the animation and just dismiss it from the underlying data model directly. BUG=641313 Review-Url: https://codereview.chromium.org/2285833002 Cr-Commit-Position: refs/heads/master@{#415597}
Showing
Please register or sign in to comment