Status Update
Comments
cl...@google.com <cl...@google.com>
ma...@google.com <ma...@google.com> #2
Hello, can you please attach a sample that reproduces your error?
jo...@google.com <jo...@google.com> #3
I’ve attached two screen recordings demonstrating the mediator's behavior during the first and second launches after installation. Additionally,
br...@cfacorp.com <br...@cfacorp.com> #4
Based on first_launch_after_installation.mp4
, your paging state is indeed showing null
for nextKey, so it makes sense that Paging concluded there are no more items to load.
So I think the question is why the PagingState
contains only an empty page and null
values. My guess is either
- RemoteMediator REFRESH actually returned empty data - what is the returned
allNewsItems
value on initial REFRESH? - RemoteMediator REFRESH successfully loaded data and inserted it into database, but Paging hasn't processed that yet by the time Append is triggered, so PagingState is empty.
The second case doesn't seem likely though.
If you attach an executable app, I can look into this further.
Otherwise, you may gain more insight through Paging logs with adb shell setprop log.tag.Paging VERBOSE
. You can also try implementing RemoteKeys
in this
Description
API Request
Expose the
height
, oroffsetFromBottom
of the bottomSheet as part of thebottomSheetState
API.UseCase
Placing content at a certain margin from the top of the bottom sheet. For an example, see the attached screen recording from Google Maps running on an Android emulator. The "Directions" button is placed at a certain margin from the top of the bottom sheet.
Description
BottomSheetState
extendsSwipeableState
and hence we have access to theoffset
property ofSwipeableState
. Theoffset
say:When you have a bottom sheet you often want to place some content above the sheet itself (i.e., with a Y coordinate that is less than the offset of the bottom sheet).
Modifier.offsetPx
is not very convenient because it requires you to take the height of the button into account.A cleaner and easier way to achieve the same result would be to place the "Directions" button at an offset from the bottom of the screen. There are multiple ways to achieve this depending on how the screen is being built (for example a
ConstraintLayout
, or simply using aColumn
adding aSpacer
after the "Directions" button etc). However all of these require you to know the height of the bottom sheet (or its offset from the bottom).There exist 2 work-arounds:
Modifier.onGloballyPositioned
to keep track of the bottom sheet height ourselvesHowever both of these are work-arounds. The BottomSheet already maintains its own height and it would make the consumer code much simpler if this was exposed as part of the API.