penguin/narou-android

Simple 縦書き reader for narou

CHANGELOG.md

raw · 5653 bytes

Version 1.3.0 — language packs

Reader controls and native Android dialogs now share bundled JSON strings in app/src/main/assets/reader/langpacks/en.json and ja.json. Labels use one language at a time. Open the reader controls and choose Language to switch immediately; the choice is saved and also applies to native menus and prompts. The chapter text remains Japanese.

langpacks/config.json sets defaultLanguage and the supportedLanguages map (language code → display name). The default is English. To add a language, copy en.json to <code>.json, translate its values, and register its code and name in the map. Language codes use letters with optional hyphen-separated subtags. Keep keys and {placeholder} names intact. Translation strings are plain text. Packs load from bundled extension assets, without remote requests. Missing keys, unsupported saved selections and failed selected-pack loads use the configured default pack. The config and default pack must be valid and bundled.

The native app reads the same config and restores its last language at startup; reader language changes reach it through the existing native message bridge. Already-open native dialogs use their language at creation time.

Validation (no APK build): node tests/i18n.test.cjs, node tests/motion.test.cjs, and node tests/reader.test.cjs. Reader tests cover live language changes, persistence, preserved colors/position and native messages. The extension version is bumped to ensure GeckoView reloads its bundled assets.

Version 1.2.0 — paragraph focus

Tap any paragraph, including its ruby text, to apply the focused text color. Only one paragraph is focused at a time. Enter or Space on a keyboard-focused paragraph also selects it. Links, swipes and long-press text selection keep their existing behavior. Tap the focused paragraph again or tap empty space to toggle controls.

While accelerometer scrolling moves the text outside the braking range, focus tracks the visible paragraph nearest the screen center, in either direction and during calibration preview. Inside the braking range, the current focus stays unchanged, even while residual velocity brakes. Manual scrolling does not automatically change focus.

Normal text and Focus text color controls save your choices locally. Custom colors apply across themes; Reset text colors restores the current theme's defaults. Focus changes only text color and does not shift the layout.

Version 1.1.1 — live calibration

Calibration shows a live tilt marker on a −1 to +1 g scale, a shaded braking range, its center, and exact trigger thresholds with reading direction labels. The stop-range offset slider moves the center; Set neutral captures the current tilt. The offset remains session-only and resets on rotation, as before. The marker keeps updating while paused, and the status shows actual scroll velocity.

Use Resume preview to scroll the chapter while calibration stays open; Pause preview stops immediately. Changes to the sliders take effect during preview. Collapsing calibration, toggling controls, disabling tilt or leaving the app cancels preview. Ordinary reading resumes when controls are hidden.

Tuning preferences and the enabled switch persist (default OFF). Opening a chapter, enabling motion, or rotating captures a fresh neutral angle; calibration is intentionally session-only so an old grip does not unexpectedly start scrolling. Touch/selection pauses motion. Closing the reader, losing app focus, backgrounding, missing sensor samples or navigation stops it. The Android listener has a one-second watchdog and unregisters when unused. Screen-on is requested only while moving. No new Android permission is required. Devices without an accelerometer show an unavailable message; ordinary swipe reading still works.

Implementation: TiltSensor.java collects filtered, display-relative samples; motion.js holds the acceleration/braking model; content.js owns calibration, controls, animation, and native polling. Android sensor coordinates follow the Android sensor documentation.

Run node tests/motion.test.cjs for physics checks and node tests/reader.test.cjs for Firefox integration checks with a simulated native accelerometer. The latter covers movement, pausing, reversing, inactive samples, rotation and settings. Actual sensor feel and device lifecycle still require a phone check.

Version 1.1.0 — accelerometer scrolling

Ported from your Windows AccelerScroll.cs and ReaderContent.xaml.cs. This uses sideways accelerometer tilt (including gravity), not gyroscope angular velocity. The acceleration → capped velocity → neutral-zone braking behavior is retained. Values now use CSS pixels/second and pixels/second², rather than pixels/timer tick. The neutral zone is symmetric around the calibrated position, correcting the old offset-dependent range. The old auto-anchor option is replaced by the reader's existing saved position, checkpointed every two seconds while motion scrolling.

  1. Tap empty space (or the focused paragraph) to show controls. Tap 傾き: OFF to enable it.
  2. Hold the phone at your comfortable reading angle; tap Set neutral.
  3. Tap 読書に戻る. Tilt sideways to accelerate, tilt the other way to reverse, or return to neutral to brake. Opening controls stops scrolling immediately.
  4. Expand Tilt scrolling to adjust acceleration, maximum speed, neutral-zone width, braking strength, or reverse direction. Controls initially pause scrolling.