Skip to content

Improve home split-view behavior, auto two-column layout, and fragment replace with caching#295

Open
ZL114514 wants to merge 3 commits intomainfrom
codex/add-two-column-layout-to-homepage-recyclerview
Open

Improve home split-view behavior, auto two-column layout, and fragment replace with caching#295
ZL114514 wants to merge 3 commits intomainfrom
codex/add-two-column-layout-to-homepage-recyclerview

Conversation

@ZL114514
Copy link
Copy Markdown
Collaborator

Motivation

  • Automatically adapt the home feed layout to larger widths so items become two columns when appropriate.
  • Make split (two-pane) usage more ergonomic by keeping the home pane resident and routing comment/detail pages to the secondary pane.
  • Replace fragment add transactions with replace while preserving UI state to avoid reloading Lua views on navigation.

Description

  • Add updateHomeRecommendColumns and an OnLayoutChangeListener in layout/home.lua to compute and set the GridLayoutManager span count from the actual laid-out width and post an initial update.
  • Resize and toggle visibility of left/right fragment containers in home.lua updateSekai so f1 (home) and f2 (secondary) get explicit widths in split mode.
  • Implement selectTargetContainer and helper functions in mods/muk.lua, enable t.setReorderingAllowed(true), and change fragment transactions from t.add(...) to t.replace(...) so new fragments are placed into the chosen container.
  • Add a simple container-view cache using MyFragmentViewmodel and update MyLuaFileFragment to store/restore the Lua fragment content view across view destruction/creation by setting mVM.cachedContentView and mVM.luaFileLoaded, and avoid re-running Lua file when cached view is reused.

Testing

  • Ran git diff --check to ensure no trailing-whitespace issues (passed).
  • Attempted ./gradlew :app:compileDebugJavaWithJavac but the build failed in this environment with Unsupported class file major version 69, which is a tooling/JDK mismatch and not related to the code changes.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant