Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
vi...@google.com <vi...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 16278c75a09262bfc2b1e230730f79ec5a4d4918
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Tue May 25 18:25:16 2021
Do not reset initial scroll position in LazyColumn/Row when items are loaded asynchronously
If the initial scroll position(or restored scroll position) is not 0 this value will be immediately overridden by 0 if there were no items yet provided for LazyColumn/Row.
It is easily reproducible with Paging where we start loading asynchronously and there is always a first frame when we don't have any items.
Fixes: 177245496
Test: new tests for LazyColumn and LazyRow
Change-Id: I95e374fb06dc480aab7b56b8b3cacb92ca1188a9
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
https://android-review.googlesource.com/1717757
Branch: androidx-main
commit 16278c75a09262bfc2b1e230730f79ec5a4d4918
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Tue May 25 18:25:16 2021
Do not reset initial scroll position in LazyColumn/Row when items are loaded asynchronously
If the initial scroll position(or restored scroll position) is not 0 this value will be immediately overridden by 0 if there were no items yet provided for LazyColumn/Row.
It is easily reproducible with Paging where we start loading asynchronously and there is always a first frame when we don't have any items.
Fixes: 177245496
Test: new tests for LazyColumn and LazyRow
Change-Id: I95e374fb06dc480aab7b56b8b3cacb92ca1188a9
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
km...@gmail.com <km...@gmail.com> #3
I think this issue still exists. The fix could break easily when you add a header item to LazyColumn.
vi...@google.com <vi...@google.com> #4
Yes, we basically just changed the default behavior for the empty case for now. Please track this bug
km...@gmail.com <km...@gmail.com> #5
Also, the itemCount always started from 0 when navigated back. I can't identify whether it is really empty or just a temporary state. Especially if I need to show an empty UI, it will flash shortly then display the paging data.
My workaround currently is to keep `LazyPagingItems` object in `ViewModel`, so that `itemCount` and other state will be the same when navigated back.
My workaround currently is to keep `LazyPagingItems` object in `ViewModel`, so that `itemCount` and other state will be the same when navigated back.
vi...@google.com <vi...@google.com> #6
yes, it is expected as the paging is starting loading asynchronously and there is always at least one frame when there is no items yet
km...@gmail.com <km...@gmail.com> #7
But we need a mechanism to display an empty UI when there is really no data. Blink screen is definitely not good for UX.
km...@gmail.com <km...@gmail.com> #8
As it is not really related to the initial issue described in this bug don't you mind filing a separate bug here
https://issuetracker.google.com/issues/new?component=413106&template=1096385
so we can discuss this separately.
Thanks!
so we can discuss this separately.
Thanks!
vi...@google.com <vi...@google.com> #9
Where can I find the new bug? this issue affect me as well.
km...@gmail.com <km...@gmail.com> #10
>My workaround currently is to keep `LazyPagingItems` object in `ViewModel`, so that `itemCount` and other state will be the same when navigated back.
Can you provide an example? In my case stored `LazyPagingItems` object does not want to load data
upd: No longer needed. In my case the issue with LazyVerticalGrid. For myself I found solution - I made copy of LazyPagingItems to make counstructor public and create LazyPagingItems inside ViewModel, so reloading does not occur when navigating backwards
Can you provide an example? In my case stored `LazyPagingItems` object does not want to load data
upd: No longer needed. In my case the issue with LazyVerticalGrid. For myself I found solution - I made copy of LazyPagingItems to make counstructor public and create LazyPagingItems inside ViewModel, so reloading does not occur when navigating backwards
Description
According to the documentationhttps://developer.android.com/training/data-storage/manage-all-files#operations-allowed-manage-external-storage , MANAGE_EXTERNAL_STORAGE permission grant access to root directory of the USB (OTG) drive.
The above code returns 'true' for primary_storage and SDCARD. For USB drive, cannot access with MANAGE_EXTERNAL_STORAGE permission.