android / android/codelab-android-paging

List blinking when I restore state in fragment

未关闭
#167 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Kotlin
星标
509
派生
268
PR 合并指标
30 天内没有已合并 PR

描述

I have two fragments and bottom navigation. Every fragment contain list with paging. I use RemoteMediator to get data from api.
If I use launch in fragment then I always recreate list if I navigate between first and second fragment.
```
lifecycleScope.launch {
viewModel.items.collectLatest {
adapter?.submitData(it)
}
}
```

If I use launchWhenCreated or launchWhenStarted then list save it state, but when I navigate between first and second fragment it show blank list for maybe 1 second and it's create visual blinking.
How can I save paging 3 list state and show list immediately on fragment created?

贡献指南

打开贡献指南

调研方向

从 issue 中展示的 fragment 生命周期收集和由 RemoteMediator 支持的 Paging 设置开始。复现两个 fragment 之间的导航,然后确定恢复的列表是否会立即渲染,期间没有空白间隔或视觉闪烁。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, kotlin
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。