-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes #4589 :- The empty screen while no images found in custom picture selector #4863
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 #4589 :- The empty screen while no images found in custom picture selector #4863
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4863 +/- ##
============================================
- Coverage 50.57% 50.40% -0.18%
+ Complexity 2224 2215 -9
============================================
Files 338 338
Lines 15546 15561 +15
Branches 1359 1362 +3
============================================
- Hits 7862 7843 -19
- Misses 7100 7133 +33
- Partials 584 585 +1
Continue to review full report at Codecov.
|
Review by student
before.mp4
after.mp4Status : issue solved |
thanks a lot for the review |
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.
Wonderful! Thanks for adding javadoc.
Just a few requests added.
And thanks Arin for the review!
if(isImageGalleryEmpty()) { | ||
val linearLayout: LinearLayout = findViewById<View>(R.id.linear_layout_noimage) as LinearLayout | ||
val textView = TextView(this) | ||
textView.text = "No Image Found" |
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.
Could you please make this string localizable? See how internationalization is done for other strings of the app.
Also, could you make the English one No images found.
(plural, only first letter uppercase, point at the end)
|
||
// Checks if the Image gallery is empty. | ||
if(isImageGalleryEmpty()) { | ||
val linearLayout: LinearLayout = findViewById<View>(R.id.linear_layout_noimage) as LinearLayout |
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.
Unit test for this block
*/ | ||
private fun isImageGalleryEmpty(): Boolean { | ||
try { | ||
val projection = arrayOf(MediaStore.Images.Media._ID) |
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.
Unit test for this block
Hey @Rishavgupta12345, The basic reason why we don't want to go with this approach is that it queries images again which is inefficient as we are just concerned with the number of images returned. So I suggested to handle this in the results function. On a plus point all the test are done on the custom selector functions, major changes wont be necessary. |
I am not getting the perfect way of implementing it on Image fragments, because there I tried some approaches and they are not working as they should |
@Rishavgupta12345 you can try again if you want. I'll unassign the issue for now so that others can work on it. In case you plan to work on it again you can ping us to get assigned. |
don't un assign me I will work on it |
@4D17Y4 If I am making this in image and folder fragment then can I make another function isImageGalleryEmpty() and call them inside the handleResult() funtion? like I did in this pull request |
Yes you can do that. This time you don't have to query for the images. |
@4D17Y4 @nicolas-raoul finally done in best possible way. Ready to merge |
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.
Best approach indeed.
Nice work.
Just some minor changes.
app/src/main/java/fr/free/nrw/commons/customselector/ui/selector/FolderFragment.kt
Outdated
Show resolved
Hide resolved
@4D17Y4 done the requested changes |
Works. |
@Rishavgupta12345 It seems like 2 of the tests are failing after this PR was merged, can you take a look into it, please?
|
I have never faced any issue like this before , so can you please guide me what should I do now ? BY my knowledge i think I have to make some changes in the tests as new things were added which doesn't have tests on it |
You can run the tests locally from Android Studio and see the logs why they are failing and update the tests accordingly. |
@Rishavgupta12345 can you prioritise this issue over others for the time, build fails make it difficult for us to review PRs. |
okay |
@madhurgupta10 I have done the changes, merge #4883 and its done |
The empty screen while no images found in custom picture selector #4589 is fixed now
I was solving this issue in the Image fragment as mentioned by @4D17Y4 but it created a few unwanted bugs so I have to delete my previous pull request, I created a new one with a different approach and I as this is working perfectly so, for now, this can be an ideal solution
@nicolas-raoul screenshots added
No image found

Image found
