Skip to content

refactor: img view UI#1316

Merged
lisonge merged 11 commits intogkd-kit:mainfrom
cjy0812:pr-preView
Apr 3, 2026
Merged

refactor: img view UI#1316
lisonge merged 11 commits intogkd-kit:mainfrom
cjy0812:pr-preView

Conversation

@cjy0812
Copy link
Copy Markdown
Contributor

@cjy0812 cjy0812 commented Mar 29, 2026

目前图片查看加阴影还是存在图片色与字色相似难以分辨问题

如图

Screenshot_20260329_085433

具体做了

  • 解决字色相似难以分辨问题
  • 标题栏可点击收起
  • 图片可操作放大查看(demo待优化)
  • 图片加载失败显示具体原因

目前问题

  1. 实现操作逻辑造轮子代码量太多感觉不好维护,可否使用Telephoto组件库以减少代码量,方便后期维护
  2. 图片预览功能抽离可以给其他场景复用,如快照-查看图片,而不用重复再写一遍(待定)

目前效果

Screenrecording_20260329_085526.mp4

TODO

  • 字色相似难以分辨问题
  • 标题栏可点击收起
  • 图片可操作放大查看
  • 加载图片显示状态信息

cjy0812 added 4 commits March 29, 2026 09:38
- toggle top/bottom bars via tap using detectTapGestures
- animate bars with fade + slide transitions
- replace magic bottom padding with navigationBars insets
- rename showTopBar → showBars for clearer semantics
- improve error retry tap handling
- Box background: pure black
- Top bar with semi-transparent background, icons and text use white color on this page
- Pill-style page indicator

perf
Removed WindowInsets.navigationBars calculation at the bottom, centralized all UI control elements at the top to reduce visual clutter.

Used fontWeight = FontWeight.Bold to enhance number readability
… pinch zoom and pan gestures for images in ImagePreviewPage. Add double-tap zoom centered on the tap position and clamp offsets to image bounds. When the image is zoomed in, HorizontalPager scrolling is temporarily disabled to avoid gesture conflicts. Pager scrolling is restored when scale returns to 1f. Also allow tapping the image to toggle the top bar visibility.

- Implement pinch zoom and pan gestures for images in ImagePreviewPage.
Add double-tap zoom centered on the tap position and clamp offsets
to image bounds.

- When the image is zoomed in, HorizontalPager scrolling is temporarily
disabled to avoid gesture conflicts. Pager scrolling is restored when
scale returns to 1f.
@lisonge
Copy link
Copy Markdown
Member

lisonge commented Mar 29, 2026

可否使用Telephoto组件库

可以的

@lisonge
Copy link
Copy Markdown
Member

lisonge commented Apr 1, 2026

@cjy0812

hello 还在吗,我计划在几天后发布测试版,你如果写好了可以提交上来

@cjy0812
Copy link
Copy Markdown
Contributor Author

cjy0812 commented Apr 1, 2026

@cjy0812

hello 还在吗,我计划在几天后发布测试版,你如果写好了可以提交上来

在改,有些小瑕疵

cjy0812 added 6 commits April 1, 2026 23:38
- deps: add me.saket.telephoto:zoomable (0.18.0) to version catalog and app module.
- refactor(ImagePreviewPage):
    - Normalize single/multiple URI inputs into a unified `previewUris` list.
    - Implement immersive system bar handling using WindowInsetsController (hide on enter, restore on dispose).
    - Replace manual scale/offset logic with `Modifier.zoomable()` for smoother pinch-to-zoom and double-tap gestures.
    - Retain `AsyncImagePainter.State` branching to maintain existing Loading/Error UI feedback.
    - Integrate `ZoomableContentLocation` with `intrinsicSize` to ensure precise content boundary detection and pager gesture co-operation.
- 预加载改成最多 2 个并发,整组图片会分批预取,不再一次性全冲出去。

- 去掉了 `newBuilder().build()` 的临时 loader,图片显示和预取都改成走 `LocalContext.current.imageLoader`,阶段监听挂到 `ImageRequest` 上。

- 规则组图片标题改成 `uri -> List<title>` 聚合,同一张图被多个子规则复用时,副标题会合并展示,不再只保留第一个命中的归属。

- 清除preKeys标题生成的多余强转
@cjy0812
Copy link
Copy Markdown
Contributor Author

cjy0812 commented Apr 2, 2026

这回应该是没问题了

Screenshot_20260403_011628
Screenshot_20260403_011846

实机测试

Screenrecording_20260403_011446_2026.04.03-01.21.00.mp4

@cjy0812 cjy0812 marked this pull request as ready for review April 2, 2026 17:23
@cjy0812
Copy link
Copy Markdown
Contributor Author

cjy0812 commented Apr 2, 2026

麻烦大佬辛苦看下👍

@lisonge lisonge merged commit 95f5d00 into gkd-kit:main Apr 3, 2026
@cjy0812 cjy0812 deleted the pr-preView branch April 4, 2026 03:02
Comment thread app/src/main/kotlin/li/songe/gkd/ui/ImagePreviewPage.kt
Comment thread app/src/main/kotlin/li/songe/gkd/ui/ImagePreviewPage.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants