Ubisam-MobileGit/tasks/053-code-viewer.md
choiminyeong d1a45abc16 TASK-050..054: tabs, Home, Work, code viewer, C++ pairs, fold layouts
Four tabs in an app shell that becomes a rail from 600dp, a brighter sky-blue palette with the real UbiSam logo, a Home tab built on Gitea's activity feeds, a Work tab that searches issues and pull requests across repositories, a full-screen code viewer with search, outline and Visual Studio colors, C/C++ header/source pairing, and two-pane layouts for wide windows.

The five tasks were built and checked together, so they are one commit: MainActivity, the routes and the shared components belong to all of them. 409 unit tests pass, lint reports 0 errors. Verified on an emulator up to the sign-in screen only; no physical device was available.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-28 14:35:00 +09:00

78 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# TASK-053: Code viewer: full screen, search, outline, Visual Studio colors
Status: implemented; required checks pass; not yet confirmed on a device
Owner: Claude
Reviewer: human product owner
## Outcome
Reading code was what the product owner was most concerned about on a phone. The team reads C#
and C++, in Visual Studio. A file now opens full screen, outside the Files/Commit pager, with the
tools for getting to the part that matters: search within the file, an outline, a strip that says
which method the top line is in, a font size, and wrapping on by default. Colors follow Visual
Studio's defaults; the background and plain text follow the app theme.
## Scope
- Included: `CodeViewerScreen`, `CodePane` (lazily composed lines), `SymbolOutline`, `CodeSearch`, type /
method / control-keyword coloring in `SyntaxHighlighter`, the code settings in `AppSettingsStore`,
a compact landscape layout, and the unified diff of `FileDiffScreen` on a narrow window.
- Excluded: code folding; blame; a real parser. Multi-line strings are still colored only on the line they
start on.
## Writable paths
- `app/src/main/java/com/ubisam/ubgitea/feature/codebrowser/`
- `app/src/main/java/com/ubisam/ubgitea/feature/branchdetail/`
- `app/src/main/java/com/ubisam/ubgitea/feature/history/`
- `app/src/main/java/com/ubisam/ubgitea/domain/history/UnifiedDiffParser.kt`
- `app/src/main/java/com/ubisam/ubgitea/core/settings/AppSettingsStore.kt`
## Acceptance criteria
- [x] A file opens full screen with a back button; the tabs and the app navigation step aside.
- [x] Wrapping is on by default; a wrapped line continues indented past the line's own indentation.
- [x] With wrapping off, the whole pane scrolls sideways together, not line by line.
- [x] Search highlights every match, starts from what is on screen, and moves to the next and previous match.
- [x] The outline lists namespaces, types, methods and fields for C#, C++, Java and Kotlin; a line number can be entered for any file.
- [x] Comments and string literals do not confuse the outline.
- [x] Word wrap and font size are remembered.
- [x] Lines are composed lazily, so a long file costs only what is on screen.
- [x] In landscape the chrome is one row.
- [x] A diff marks added and removed lines with + and − as well as color, and can jump between changes and files.
- [x] Build, unit tests and lint pass.
- [ ] Confirmed on the human product owner's device (phone and unfolded Z Fold).
## Security and privacy
No additional concerns. File content is shown, never logged or stored.
## Required checks
```text
./gradlew compileDebugKotlin compileDebugUnitTestKotlin testDebugUnitTest assembleDebug lintDebug
```
## Evidence
Recorded on 2026-09-28 in the worktree `awesome-pascal-3f2ada`, with Android Studio's bundled JDK (`D:\AndroidStudio\jbr`, OpenJDK 21). TASK-050 to TASK-054 were built together and checked together:
- `./gradlew compileDebugKotlin compileDebugUnitTestKotlin testDebugUnitTest assembleDebug lintDebug` -- passed.
- Unit tests: 409 in 45 suites, 0 failures, 0 errors (289 before this work).
- Lint: 0 errors, 55 warnings (dependency updates, unused resources, KTX suggestions).
- Emulator (API 36, `sdk_gphone64_x86_64`): the debug APK installs and launches without a crash and shows the sign-in screen with the logo and the new palette. Nothing past sign-in could be reached: that needs a company account.
- Not done: any check on a physical device. None was visible to `adb` during this work.
- New and extended tests: `SyntaxHighlighterTest` (34), `SymbolOutlineTest` (11), `CodeSearchTest` (25), `UnifiedDiffParserTest` (10), `FileDiffChangesTest` (4).
- Unit tests were written by a delegated worker from `handoff/2026-09-28_unit-tests-redesign.md`; the full run above was repeated here afterwards.
## Known limitations
- The outline recognizes declarations by their shape on the line they start on. It is right for code written the usual way and can miss a declaration written unusually or produced by a macro.
- Type and method coloring is by naming convention, not by resolving symbols: a PascalCase property after a dot is left plain, a PascalCase local would be colored as a type.
- Two light-theme colors are darker than Visual Studio's (type, comment) because the originals fall below 4.5:1 on white at code size.
- Sideways scrolling, text selection across lazily composed lines and the bottom sheet could not be exercised without a device.
## Review findings
None yet.