-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes #4329 "Back button in edit categories triggers back of media details." #4346
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
Conversation
Up for review @nicolas-raoul , @neslihanturan . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @4D17Y4 , thanks the logic seems okay to me, however I frequently get this error when I am testing this PR. Do you think if this is related?
USER_COMMENT=
APP_VERSION_CODE=876
APP_VERSION_NAME=3.0.0-debug-4D17Y4-backbutton
ANDROID_VERSION=10
PHONE_MODEL=Redmi Note 8
STACK_TRACE=java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 240, found: 260 Pager id: fr.free.nrw.commons.beta:id/mediaDetailsPager Pager class: class androidx.viewpager.widget.ViewPager Problematic adapter: class fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter
at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1143)
at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25086)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25086)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6872)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:742)
at android.view.View.measure(View.java:25086)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3083)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1857)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2146)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7768)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
at android.view.Choreographer.doCallbacks(Choreographer.java:791)
at android.view.Choreographer.doFrame(Choreographer.java:726)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
IS_SILENT=false
I think its another issue #4283 |
The mentioned issue is resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fixes the issue in the case:
Tap picture, Tap pencil, Tap Back
I wonder if fixing this case would also be possible? (I know it is not described in the issue but very close) :
Tap picture, Tap pencil, Tap search icon, Tap Back (keyboard disappears), Tap Back (now back to contributions instead of back to media details)
Codecov Report
@@ Coverage Diff @@
## master #4346 +/- ##
============================================
- Coverage 10.30% 10.21% -0.09%
+ Complexity 471 469 -2
============================================
Files 342 342
Lines 13145 13104 -41
Branches 1063 1072 +9
============================================
- Hits 1354 1338 -16
+ Misses 11723 11698 -25
Partials 68 68
Continue to review full report at Codecov.
|
Removed the focus logic as it needed much modification to track every event on the fragment and was not the best way. Used other logic to check if the mediaDetails is closed or open.
I've modified every instance of the Pager fragment to keep it consistent on each mediaDetails. Need confirmation on the function name. Let me know if I missed something. Up for review @nicolas-raoul , @neslihanturan , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the changes on many activities, it works great!
The source code looks good too, I only request very minors changes.
app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, we can merge it as soon as @nicolas-raoul 's reviews are done :)
Done @neslihanturan, Thanks. |
Merging as @nicolas-raoul 's reviews are done, thanks @4D17Y4 :) |
Description (required)
Fixes #4329
What changes did you make and why?
Added onKey listener to the fragment view.
Tests performed (required)
Tested BetaDebug on Nokia 6.1+ with API level 29.