Skip to content
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

Fixes #3879 #4283 Other pictures flickers when a media is selected from contributions list #4340

Closed
wants to merge 23 commits into from

Conversation

vinayak0505
Copy link
Contributor

Description (required)
I am sorry for previous pull request as i panicked and push the wrong one

Fixes #3879 #4283

What changes did you make and why?
I just added a feature to check it the clicked item is loaded before setting that item, which will remove image flicker as program will not wait for 5 milliseconds and random crashes

Tests performed (required)
manual testing

please check this i am really sorry about previous pull request @nicolas-raoul @madhurgupta10 @neslihanturan

@codecov-io
Copy link

codecov-io commented Apr 8, 2021

Codecov Report

Merging #4340 (1401c6d) into master (58408cf) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4340   +/-   ##
=========================================
  Coverage     10.22%   10.22%           
  Complexity      469      469           
=========================================
  Files           342      342           
  Lines         13084    13084           
  Branches       1062     1063    +1     
=========================================
  Hits           1338     1338           
  Misses        11678    11678           
  Partials         68       68           
Impacted Files Coverage Δ Complexity Δ
...e/nrw/commons/explore/ExploreListRootFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58408cf...1401c6d. Read the comment docs.

@nicolas-raoul
Copy link
Member

No problem!
By the way, you can edit a pull request simply by pushing to the same remote branch. No need to close the PR and open a new one :-)

@vinayak0505
Copy link
Contributor Author

vinayak0505 commented Apr 8, 2021 via email

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works great!
Tapping a contribution now leads to a very smooth experience (I mean there is no flickering).

I just asked for a few minor changes.
Thanks!

@vinayak0505
Copy link
Contributor Author

done

@neslihanturan neslihanturan changed the title Fixes #3879 #4283 Fixes #3879 #4283 Other pictures flickers when a media is selected from contributions list Apr 8, 2021
@neslihanturan
Copy link
Collaborator

When I was logged out and tried to display a media detail, it crashed with:

free.nrw.commons, PID: 29828
    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)
2021-04-08 19:33:20.862 29828-4650/fr.free.nrw.commons E/ACRA: ACRA caught a NullPointerException for fr.free.nrw.commons
    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)

@neslihanturan
Copy link
Collaborator

I works good on contributions list, however it crashes then it comes to explore fragment:

    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)
2021-04-08 19:36:22.588 29830-5120/fr.free.nrw.commons E/ACRA: ACRA caught a NullPointerException for fr.free.nrw.commons
    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)
        ```

@vinayak0505
Copy link
Contributor Author

When I was logged out and tried to display a media detail, it crashed with:

free.nrw.commons, PID: 29828
    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)
2021-04-08 19:33:20.862 29828-4650/fr.free.nrw.commons E/ACRA: ACRA caught a NullPointerException for fr.free.nrw.commons
    java.lang.NullPointerException: Attempt to invoke virtual method 'int fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter.getCount()' on a null object reference
        at fr.free.nrw.commons.media.MediaDetailPagerFragment$1.run(MediaDetailPagerFragment.java:354)
        at java.lang.Thread.run(Thread.java:919)

I see the adapter is not initialize here

@vinayak0505
Copy link
Contributor Author

image
nice catch, as you can see here adapter is not initialized for first 100 millisecond which cases a problem so there are two ways to solve this if i wait for adapter to get initialize or the right way ill fix this adapter, ill try to go with 2nd option first but i have no idea why the programmer has done this and why this was allowed

@neslihanturan
Copy link
Collaborator

And welcome to the project @vinayak0505 , please do not get stressed if something goes wrong with the PR. It is always normal to close them to start from scratch. It is normal to send new commits to the existing PR too.

@neslihanturan
Copy link
Collaborator

neslihanturan commented Apr 8, 2021

image
nice catch, as you can see here adapter is not initialized for first 100 millisecond which cases a problem so there are two ways to solve this if i wait for adapter to get initialize or the right way ill fix this adapter, ill try to go with 2nd option first but i have no idea why the programmer has done this and why this was allowed

I am not really sure why this delay is there, but considering this is a network operation, I assume it might be required. Anyway please share your further findings with us :)

@vinayak0505
Copy link
Contributor Author

And welcome to the project @vinayak0505 , please do not get stressed if something goes wrong with the PR. It is always normal to close them to start from scratch. It is normal to send new commits to the existing PR too.

Thank you very much and about stressing that you just mentioned if it's because you read the above comments then thank you I felt really good but if something I might blame a mistake on others for my PR then don't worry If I have do a mistake I'll accept that even if I lose an opportunity

@vinayak0505
Copy link
Contributor Author

hey!! thanks for the report but please create a different bug report for this as i have figured out what was wrong as problem was in the explore Fragment code i can solve this hear but then i wont get point for GSoC, if creating a issue would problematic then no issue ill upload it here only, ill make point from other bugs no issue @neslihanturan

@neslihanturan
Copy link
Collaborator

hey!! thanks for the report but please create a different bug report for this as i have figured out what was wrong as problem was in the explore Fragment code i can solve this hear but then i wont get point for GSoC, if creating a issue would problematic then no issue ill upload it here only, ill make point from other bugs no issue @neslihanturan

We don't only consider number of PRs, we consider their difficulty level for GSoC. There is not a second issue here, this issue covers all of the steps we talked about. So there is no need to create one more issue or one more PR.

Can you please commit your new solution (it is hard to follow from code screen shoots, I prefer to see commits instead)?

Also, sometimes I am having hard times to understand your messages. Could you please make sure you follow punctuation rules? So that I could follow sentence ends and beginnings. Thanks!:)

@vinayak0505
Copy link
Contributor Author

I am working on solving this.

I'll take care of punctuation from next time.

@vinayak0505
Copy link
Contributor Author

solved please review it.

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the stylistic issues!

I just tested with this branch's latest code, it works great for me even when scrolling and tapping like crazy.

Neslihan, if you know a way to trigger the crash with higher probability (for instance by tapping fast in a particular order), please let us know :-)

@vinayak0505
Copy link
Contributor Author

Can I start working on other issues?
I have checked from my side as this function is used in five different places and I have checked them

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Apr 9, 2021 via email

@vinayak0505
Copy link
Contributor Author

@neslihanturan please review this :)

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using this branch for 2 days, it is working great so far, I really appreciate that flickering (previous image shown briefly upon tapping) does not happen anymore.

Apart from the small detail I noticed right now, the code looks reasonable to me.

@vinayak0505
Copy link
Contributor Author

@neslihanturan I have made changes as per your requirement. so please check.

@vinayak0505
Copy link
Contributor Author

vinayak0505 commented Apr 11, 2021

I have merged upstream also please check

@neslihanturan
Copy link
Collaborator

Thanks @vinayak0505 and @nicolas-raoul , I am on it :)

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @vinayak0505 there are several irrelevant changes made in this PR, please revert them. Only required lines to solve the issue should be changed. So when you switched to files tab on github (or when you check git diff) you should only see related lines are edited. Please make sure you create a new branches on each task, otherwise (if you work on master for all tasks) such problems may occur. You can follow our contributors guideline for information about git flows. Please ping me for review as soon as you solved this issue.

If you are confused feel free to close this PR and open a new one.

@vinayak0505
Copy link
Contributor Author

vinayak0505 commented Apr 13, 2021

@neslihanturan in last 2 commits I only pull upstream to check , I revert them back but they didn't update. can you merge with leaving the last 2 commits

@vinayak0505
Copy link
Contributor Author

Check the third last commit

@nicolas-raoul
Copy link
Member

@vinayak0505 It is a good thing to keep PRs up-to-date, your intent was great.
To do so, better use Git's rebase operation, though. Would you mind trying?
If it does not work, an easy workaround is to create a new PR as Neslihan suggested.
Thanks!

@nicolas-raoul
Copy link
Member

I would be great if you could do it for this one :-)

@vinayak0505 vinayak0505 reopened this Apr 13, 2021
@vinayak0505
Copy link
Contributor Author

@nicolas-raoul I revert back the changes and made a rebase but then it shows more files changed so i created a new pull request

@vinayak0505
Copy link
Contributor Author

@neslihanturan please check pull request #4354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Other pictures flickers when a media is selected from contributions list
6 participants