From 73d6236c6d41afc80dfde321dcaa7bfe35a95b32 Mon Sep 17 00:00:00 2001 From: Jason Whitmore Date: Wed, 6 Aug 2025 20:32:30 -0700 Subject: [PATCH] ReviewActivity.kt: simplify info icon code to work with some languages 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. --- .../main/java/fr/free/nrw/commons/review/ReviewActivity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/review/ReviewActivity.kt b/app/src/main/java/fr/free/nrw/commons/review/ReviewActivity.kt index 20f289f8f..83eb4e1c6 100644 --- a/app/src/main/java/fr/free/nrw/commons/review/ReviewActivity.kt +++ b/app/src/main/java/fr/free/nrw/commons/review/ReviewActivity.kt @@ -107,10 +107,8 @@ class ReviewActivity : BaseActivity() { setUpMediaDetailFragment() } - binding.skipImage.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_UP && - event.rawX >= (binding.skipImage.right - binding.skipImage.compoundDrawables[2].bounds.width()) - ) { + binding.skipImageInfo?.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP) { showSkipImageInfo() true } else {