-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes Issue #6384: java.lang.NullPointerException in ReviewActivity #6394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fixes Issue #6384: java.lang.NullPointerException in ReviewActivity #6394
Conversation
Before this commit, the info icon shared the same GUI element with the "Skip this image" text. This made the Kotlin code to handle taps on the info icon difficult to write, and would crash with a NPE when the user used a language that is read right to left and the info icon was pressed. This commit creates new GUI elements. Notably, the info icon has it's own element. A LinearLayout is used to place the skip button and the info icon button together. Kotlin code can now be simplified and the NPE bug can be fixed.
Before this commit, if the language was set to a language that is read right to left, pressing the info icon would crash the app with a NPE. This was because the Kotlin code assumed that the icon would always be on the right of the skip button (index 2 in the drawable array). When a right to left language was used, the icon would be on the left and index 2 would be null. This commit builds upon prior GUI changes. The info icon now has its own button. Kotlin changes now remove the use of the drawable array to find the info icon and instead directly references the new info icon button. The info icon button now works properly for both left-to-right and right-to-left languages while maintaining correct positioning.
This commit moves around some lines in the XML to make it more readable.
The "Skip this image" text and the info icon appear to have more space between them in this PR with the way I wrote the XML. I thought about moving them closer to their original distance, but I think it might be better if they were further apart. If the two buttons are too close, then users may accidentally press the wrong one, especially on smaller screens. If needed, I can easily change the distance between the buttons. |
Also, please consider merging main as well :) |
Hi @Jason-Whitmore, could you please look at the suggested changes? Do you think my suggestions make sense here, @RitikaPahwa4444? |
This change simplifies the button configuration XML and makes the info icon button slightly smaller
✅ Generated APK variants! |
Thanks for the changes @Jason-Whitmore, it works great now and without any crashes. However, the Apart from that, it's ready to merge @RitikaPahwa4444 Screen_recording_20250829_232412.webm |
Description (required)
Fixes #6384
What changes did you make and why?
The GUI for the Review Activity was modified so that the info icon (the "I" inside the circle), had it's own button rather than being a
Drawable
for the "Skip this image" button.The Kotlin code was then simplified to show the information when this new button was pressed.
These changes eliminate the NPE because the Kotlin code no longer uses array accesses to find the icon and instead refers directly to the new button.
Tests performed (required)
How to test this fix:
On main, the app will crash with a NPE. On this branch, the popup appears correctly.
The same steps can be repeated with a left to right language (e.g. English) to confirm that the info icon appears on the right and is working correctly.
Tested ProdDebug on Android Studio emulator with API level 36.
Screenshots (for UI changes only)
