Conversation
- Call `DeviceCompat.delayBeforeResumingDrawing()` before enabling raw drawing in `OnyxInputHandler`.
### Core Logic
- **einkHelper.kt**:
- Updated `resetScreenFreeze` to perform the `isRawDrawingRenderEnabled` toggle within a `CoroutineScope` using `Dispatchers.Default`.
- Integrated `DeviceCompat.delayBeforeResumingDrawing()` between the toggle states to ensure the Android UI settles before resuming raw drawing.
- Enhanced logging in `DeviceCompat.delayBeforeResumingDrawing` for better traceability.
- **OnyxInputHandler.kt**:
- Commented out the blocking `DeviceCompat.delayBeforeResumingDrawing()` call in the drawing state update, favoring the new asynchronous approach in the helper.
Fix ToolbarMenu.kt to close reliably on pen action.
Rename UpdateMenuOpenTo → ToggleEraserManu
### Core Logic & State
- **EditorViewModel**:
- Renamed `UpdateMenuOpenTo` to `ToggleEraserManu` for clarity.
- Updated `ToolbarAction` handlers to defer `updateDrawingState` calls to focus change events.
- Modified `updateDrawingState` to include a device-specific delay before resuming drawing via `DeviceCompat`.
- Removed `onFocusChanged` in favor of centralized handling in `CanvasObserverRegistry`.
- **CanvasObserverRegistry**: Now explicitly triggers `viewModel.updateDrawingState()` when the canvas gains focus.
- **MainActivity**: Added an `onResume` override to ensure full-screen mode is enabled and focus change events are emitted to the `CanvasEventBus`.
### UI & Components
- **Toolbar**: Updated eraser menu open change callback to use the renamed `ToggleEraserManu` action.
- **PenToolbarButton**: Commented out `onStrokeMenuOpenChange` logic and associated effects.
- **PageView**: Temporarily changed logical rect redraw color to `GREEN` for debugging.
- **ToolbarMenu**: Simplified `onDismissRequest` logic for the popup menu.
- **EditorView**: Cleaned up redundant focus change collectors.
…ns for preview/thumbnail storage.
### Editor & Canvas
- **Rendering Threading**: Changed coroutine dispatchers from `Dispatchers.Main.immediate` to `Dispatchers.Main` in `PageView` and `CanvasObserverRegistry` to prevent race conditions during UI updates and canvas refreshes.
- **Diagnostics**: Added detailed logging for canvas and bitmap memory addresses (`hashCode`) across `PageView`, `CanvasRefreshManager`, and `pageDrawing` to assist in tracking drawing state inconsistencies.
- **State Management**: Refactored `updateDrawingState` in `EditorViewModel` for clearer logging and better handling of canvas creation cycles.
### Storage & Persistence
- **Atomic Writes**: Updated `saveHQPagePreview` and `savePageThumbnail` to write to temporary files (`.tmp`) before renaming them to their final destination. This prevents corrupted or empty cache files if a write is interrupted.
- **Error Recovery**: Enhanced `decodeBitmapFromFile` to automatically delete invalid or zero-byte files that fail to decode, forcing a clean redraw in subsequent sessions.
- **Resource Management**: Improved bitmap recycling logic in thumbnail generation to prevent memory leaks during optimization.
### UI Components
- **SnackBar**: Added a manual dismiss button ("x") to the snackbar notification component.
- **Code Cleanup**: Removed redundant logging and added thread-safety warnings regarding dispatcher selection in `CanvasObserverRegistry`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeviceCompat.delayBeforeResumingDrawing()before enabling raw drawing inOnyxInputHandler.