Skip to content

fix(edit): keep editor toolbar below the status bar after activity recreation#3264

Open
MiMoHo wants to merge 1 commit into
nextcloud:mainfrom
MiMoHo:fix/editor-toolbar-status-bar-inset
Open

fix(edit): keep editor toolbar below the status bar after activity recreation#3264
MiMoHo wants to merge 1 commit into
nextcloud:mainfrom
MiMoHo:fix/editor-toolbar-status-bar-inset

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 8, 2026

Copy link
Copy Markdown

Fixes a UI glitch in the note editor: the toolbar (and the in-note search bar) is sometimes drawn behind the status bar, overlapping the clock.

Steps to reproduce (before this fix): open a note, then switch the system between light and dark theme (or trigger any other configuration change that recreates the activity), or have the editor restored after such a change. On an Android 15 emulator: adb shell cmd uimode night yes while a note is open.

Cause: EditNoteActivity registered its window insets listener (introduced in #2701 to fix #2700) on the DecorView. A listener set there replaces DecorView#onApplyWindowInsets during insets dispatch, so the platform's own system bar fitting silently depends on decor-internal state - after a recreation the new DecorView never applies the status bar offset.

Fix: register the listener on the activity's own content view and apply the insets that actually arrive there. The platform's decor handling stays intact: if the platform already fits the system bars, the arriving insets are consumed and no extra padding is added; on a truly edge-to-edge window the content view pads itself (including display cutout). The bottom padding keeps the max(IME, system bars) logic from #2700, verified against the keyboard-overlap scenario.

Testing: manually verified on an Android 15 emulator (cold start light/dark, theme toggle recreation both directions, keyboard open/close, in-note search, landscape); testFdroidDebugUnitTest and lintFdroidDebug pass.

Screenshots:
before_broken_after_dark_mode_recreation after_search_regression_check after_keyboard_regression_check after_fixed_dark_mode_recreation

Disclosure: this change was developed with the assistance of an AI coding agent (Claude Code, Claude Fable 5, xhigh); I reviewed and tested the change myself.

…creation

EditNoteActivity registered its window insets listener on the
DecorView. A listener set there replaces DecorView#onApplyWindowInsets
during insets dispatch, so the platform's own system bar fitting
silently depends on decor-internal state: after the activity is
recreated (for example when the system switches between light and dark
theme while a note is open), the new DecorView never applies the status
bar offset and the toolbar - including the in-note search bar - is
drawn behind the status bar.

Register the listener on the activity's content view instead and apply
the insets that actually arrive there. This leaves the platform's decor
handling intact: when the platform already fits the system bars, the
arriving insets are consumed and no extra padding is added; on a truly
edge-to-edge window the content view now pads itself, including the
display cutout. The bottom padding keeps the max(IME, system bar)
logic from the fix for nextcloud#2700.

Reproduced on an Android 15 emulator by toggling dark mode while a
note was open (adb shell cmd uimode night yes).

Assisted-by: Claude Code:claude-fable-5
AI-assistant: Claude Code 2.1.195 (Claude Fable 5)
Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

[4.4.0 RC1] Editing end of notes not working due to overlapping keyboard

1 participant