Fixed
Status Update
Comments
sh...@google.com <sh...@google.com> #2
Thank you for reporting this issue. For us to further investigate this issue, please provide the following additional information:
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
sh...@google.com <sh...@google.com> #3
I'll provide the full sample project late next week
sh...@google.com <sh...@google.com> #4
I'm sending to you an app project to show the issue. Every one of the four selection tracker's callbacks are logging to logcat. So you can use logcat to track the issue I reported.
Steps to reproduce:
1 - Click at one of the four list items. It will cause the item to be selected;
2 - Click the "Remove first !" float action button. Realizes that none of the selection tracker's callback will be called.
Steps to reproduce:
1 - Click at one of the four list items. It will cause the item to be selected;
2 - Click the "Remove first !" float action button. Realizes that none of the selection tracker's callback will be called.
ap...@google.com <ap...@google.com> #6
Thanks for reporting the issue.
Looks like an oversight where SelectionTracker's AdapterObserver is simply ignoring rangeRemoved events. I'll aim to land a fix for this in the 1.1 stable release (either the initial release, or a fast-follow-on point release).
Looks like an oversight where SelectionTracker's AdapterObserver is simply ignoring rangeRemoved events. I'll aim to land a fix for this in the 1.1 stable release (either the initial release, or a fast-follow-on point release).
sh...@google.com <sh...@google.com>
ch...@gmail.com <ch...@gmail.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 3b4d015eaebacb3ba82f67248cdc5befbffbc3d0
Author: Steve McKay <smckay@google.com>
Date: Mon Aug 10 17:34:07 2020
Fix issue where selection wasn't update when corresponding items removed from adapter.
Add ItemTouchHelper based swipe away support to Fancy demo app to help provide better test bed (for me...debugging :)
Improved organization of code in Fancy demo activity, to help keep concepts clear and separate for readers.
Update DemoAdapter to support removing items (and generally improve organization).
Move selection demos into RecyclerView/Selection/... "folder" of the samples app.
Bug: 138932671
Test: Manual test of demo app + addition of new test coverage in DefaultSelectionTracker.
Change-Id: Ic7924aca017b35aae65195f2c40e49641177471f
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/DefaultSelectionTrackerTest.java
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/testing/TestAdapter.java
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/testing/TestSelectionObserver.java
M recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/DefaultSelectionTracker.java
M recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/ItemKeyProvider.java
M samples/Support7Demos/src/main/AndroidManifest.xml
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoAdapter.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoDetailsLookup.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoHeaderHolder.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/FancySelectionDemoActivity.java
M samples/Support7Demos/src/main/res/layout/selection_demo_layout.xml
M samples/Support7Demos/src/main/res/menu/selection_demo_actions.xml
M samples/Support7Demos/src/main/res/values/strings.xml
https://android-review.googlesource.com/1396972
Branch: androidx-master-dev
commit 3b4d015eaebacb3ba82f67248cdc5befbffbc3d0
Author: Steve McKay <smckay@google.com>
Date: Mon Aug 10 17:34:07 2020
Fix issue where selection wasn't update when corresponding items removed from adapter.
Add ItemTouchHelper based swipe away support to Fancy demo app to help provide better test bed (for me...debugging :)
Improved organization of code in Fancy demo activity, to help keep concepts clear and separate for readers.
Update DemoAdapter to support removing items (and generally improve organization).
Move selection demos into RecyclerView/Selection/... "folder" of the samples app.
Bug: 138932671
Test: Manual test of demo app + addition of new test coverage in DefaultSelectionTracker.
Change-Id: Ic7924aca017b35aae65195f2c40e49641177471f
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/DefaultSelectionTrackerTest.java
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/testing/TestAdapter.java
M recyclerview/recyclerview-selection/src/androidTest/java/androidx/recyclerview/selection/testing/TestSelectionObserver.java
M recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/DefaultSelectionTracker.java
M recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/ItemKeyProvider.java
M samples/Support7Demos/src/main/AndroidManifest.xml
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoAdapter.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoDetailsLookup.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/DemoHeaderHolder.java
M samples/Support7Demos/src/main/java/com/example/android/supportv7/widget/selection/fancy/FancySelectionDemoActivity.java
M samples/Support7Demos/src/main/res/layout/selection_demo_layout.xml
M samples/Support7Demos/src/main/res/menu/selection_demo_actions.xml
M samples/Support7Demos/src/main/res/values/strings.xml
Description
When items are same size as the viewport, and RV is currently laid out such that the viewport shows exactly one complete item, and you remove that item from the dataset, it can't find a reference child that is in the viewport. It defaults to using the first child it found in the hierarchy (
getChild(0)
for regular LTR RVs) as the reference child. But then it doesn't seem to use that child's old position as the anchor position, but just places that child at the start of the viewport.That is a problem if you are looking at the last item (item N) and have two extra items laid out before the visible one. You'd expect that if you remove item N, you will look at item N-1 after that. But, it will actually go to item N-2.
I didn't check the behavior if you're not looking at the last item, but that might be affected as well.