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

4.4 KiB
Raw Blame History

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

  • A file opens full screen with a back button; the tabs and the app navigation step aside.
  • Wrapping is on by default; a wrapped line continues indented past the line's own indentation.
  • With wrapping off, the whole pane scrolls sideways together, not line by line.
  • Search highlights every match, starts from what is on screen, and moves to the next and previous match.
  • The outline lists namespaces, types, methods and fields for C#, C++, Java and Kotlin; a line number can be entered for any file.
  • Comments and string literals do not confuse the outline.
  • Word wrap and font size are remembered.
  • Lines are composed lazily, so a long file costs only what is on screen.
  • In landscape the chrome is one row.
  • A diff marks added and removed lines with + and − as well as color, and can jump between changes and files.
  • 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

./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.