Skip to content

Improve UI layout responsiveness and fix selection state management - #11

Merged
EL4CTEO merged 7 commits into
mainfrom
claude/quirky-hawking-m72zg1
Sep 28, 2026
Merged

EL4CTEO merged 7 commits into
mainfrom
claude/quirky-hawking-m72zg1

Conversation

@EL4CTEO

@EL4CTEO EL4CTEO commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves the responsiveness of UI layouts across both Android and desktop platforms, fixes selection state management in the library, and adds comprehensive test coverage for layout and UI behavior.

Key Changes

Android Library Screen

  • Selection state management: Added LaunchedEffect to automatically deselect books that are filtered out or removed from view, preventing orphaned selections that would remain counted in the selection bar
  • Selection bar refactoring: Extracted the complex selection toolbar into a new SelectionBar composable that intelligently adapts to screen width:
    • On narrow screens (< 560dp): shows only "Select All" and "Add to Shelf" actions, moves others to a dropdown menu
    • On wider screens: displays all actions inline
    • This keeps the selection count readable on phones where space is limited
  • Book cover state fix: Changed BookCover from produceState to mutableState keyed on path, ensuring covers update immediately when a card's book changes (e.g., "Continue reading" card switching books)

Desktop UI Layout Components

  • New ScreenHeader layout: Intelligently arranges title, tools, and action button:
    • On wide windows: all three components on one line
    • On narrow windows: tools drop to a second row under the title
    • Supports right-to-left layouts
  • New SettingRow layout: Stacks setting title/hint and control vertically when space is constrained, preventing text cutoff in narrow windows
  • Library and Notes screens: Updated to use new ScreenHeader for consistent, responsive header layout

Data Management

  • Cover cleanup: When removing library folders with books, now properly deletes associated cover images that would otherwise accumulate
  • Home screen rules: Extracted continueReadingBook() and alsoReading() functions to desktop for consistent book selection logic across platforms

Documentation & Tests

  • New test coverage:
    • BookCoverTest: Verifies covers update correctly when book changes on same card
    • ScreenHeaderTest: Tests responsive layout behavior in LTR and RTL modes
    • SettingRowTest: Validates stacking behavior at different widths
    • LibraryFoldersTest: Ensures cover cleanup when removing folders
    • HomeRulesTest: Validates home screen book selection logic
    • LibraryBehaviourTest: Updated to use new menu-based actions on narrow screens
  • DEVELOPING.md: Added comprehensive guide for building, running, and testing the project

UI Polish

  • README: Simplified installation instructions and feature descriptions, improved screenshot formatting
  • Home screen: Added key-based LazyColumn items to maintain scroll position when scan bar appears/disappears

https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V

On Android the cover image was held in produceState, which restarts its
loader when the cover path changes but keeps the old value. When another
book became the current one, the hero card (and a shelf's thumbnail)
kept the previous book's picture, and never loaded the new one. The
image state is now keyed on the path, so it resets in the same pass.

On the desktop the card only followed a book once it had progress, so
opening a new book didn't move it until a page was turned. It now follows
the book opened last, as on Android.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
Selecting a book showed a close button and up to six 48dp icon buttons
beside the "N selected" title, leaving it a few dp on a phone, so it
wrapped letter by letter. The title now stays on one line, and below
560dp the bar keeps select all and add to shelf, with details, favorite,
mark as and remove in the menu. Wide bars still show every action.

Books that a filter or a rescan takes off the screen are also dropped
from the selection, so the count and "Remove" can't reach them unseen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
At the smallest window the Library title was printed over by the search
and sort controls, the filter chips and selection buttons were cut off
(so Favorite, Remove and Clear selection couldn't be reached), Notes
overprinted its search box in German, and the Cover size setting lost its
title. Screens now use a ScreenHeader that drops the tools under the
title when they don't fit, chip and selection rows wrap, and a setting
whose control is too wide moves it under the title.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
Removing a library folder together with its books deleted the rows but
left every cover image behind, on Android and on the desktop. They are
now deleted with their books.

On Android each new cover also listed the whole covers folder to find the
old one, which is quadratic on a large library; it now removes the old
cover by its recorded path, as the desktop already did.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
- The splash screen waited on the "reopen the last book" lookup; if it
  failed, the app stayed on the splash. It now falls back to the library.
- Home rows are keyed, so a row keeps its scroll position when the scan
  bar or "Also reading" appears above it.
- The six accent swatches wrap instead of being cut off on a narrow
  screen or a large display size.
- The stats heatmap opens on the latest weeks rather than the oldest.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
The README now covers what a visitor needs: what ReadArea is, how to
install it, getting started, features, privacy and a few questions. The
layout, build, test and release notes moved to docs/DEVELOPING.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
Covers the desktop SettingRow: a small control stays beside its title, a
control too wide to leave the title 150px goes under it, the boundary
between the two, and the mirrored layout for right-to-left languages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjEn8xjjwh6yk6MZwhSD2V
@EL4CTEO
EL4CTEO merged commit 4619130 into main Sep 28, 2026
14 checks passed
@EL4CTEO
EL4CTEO deleted the claude/quirky-hawking-m72zg1 branch September 28, 2026 19:42
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