ADFA-2548 | Fix drag-and-drop crash on Android 12+ for TextViews#875
ADFA-2548 | Fix drag-and-drop crash on Android 12+ for TextViews#875
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughIntroduced a private extension function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@layouteditor/src/main/java/org/appdevforall/codeonthego/layouteditor/editor/DesignEditor.kt`:
- Around line 579-584: The empty override onNothingSelected in the anonymous
AdapterView.OnItemSelectedListener is flagged by detekt; update the override in
the view.onItemSelectedListener block (the onNothingSelected(parent:
AdapterView<*>?)) to include an explicit no-op comment (e.g. add a "// no-op"
comment inside the method body) so the empty override is intentional and detekt
stops flagging it, leaving the onItemSelected implementation that calls
showDefinedAttributes(view) unchanged.
layouteditor/src/main/java/org/appdevforall/codeonthego/layouteditor/editor/DesignEditor.kt
Show resolved
Hide resolved
…View interaction Disable text selection and input focus in DesignEditor to avoid conflictive base class interactions in TextView.
256e6a2 to
6a32976
Compare
Description
This PR fixes a
NullPointerExceptionoccurring on Android 12+ (API 31) when dropping elements onto anEditTextor otherTextViewsubclasses within the Design Editor.The crash happens because
android.widget.Editorattempts to handle theACTION_DROPevent assuming validClipData, which is null during internal drag operations. To prevent this, I introduced aconfigureForDesignModeextension function that:textIsSelectable,cursorVisible, and removes thekeyListenerforTextViewsubclasses.This ensures these components remain passive visual elements in the editor, preventing the system's text editing logic from intercepting drag events. Additionally, I refactored the
Spinnerlistener assignment for better readability.Details
Logic-related fix. This resolves the following crash on API 31+:
java.lang.NullPointerException: null at android.widget.Editor.onDrop(Editor.java:3089)Before changes
Screen.Recording.2026-01-23.at.12.11.53.PM.mov
After changes
Screen.Recording.2026-01-23.at.12.14.18.PM.mov
Ticket
ADFA-2548
Observation
This fix applies to all views inheriting from
TextView(e.g.,Button,CheckBox,EditText), ensuring consistency across the editor.