Hentoid
Hentoid copied to clipboard
Duplicate detector : Show how many items are left in main page
Implements Feature: Show how many items are left in main page of a duplicate detector.
Summary of changes in this PR:
- Show how many items are left in main page of a duplicate detector.
Additional commit notes for project team:
DuplicateDetectorActivity.updateTitlehas parametercountif count>0,updateTitleupdate title to "n duplicates" for the detail page if count<0,updateTitleupdate title to "n item(s) left" for the main page if count=0,updateTitleupdate title to "Duplicate Detector" for the main page without any items
@AVnetWS/admin-team
Thanks for your contribution plive 👍
I see two things that can be improved there :
- The
<0 => main page/>0 => details pageconvention will probably be a little difficult to understand a few months later if the only explanation is in this PR.
Could you add comments as why you pass negative values to updateTitle ?
- Calling the ViewModel directly to get values (
DuplicateDetectorActivity:79) isn't exactly the right way to use the MVVM pattern. Ideally, you should observe values in the Activity or Fragment and react to their changes instead of pulling their value directly. e.g.DuplicateMainFragment:126
// Observe what the ViewModel publishes; process it using onDuplicatesChanged
viewModel.allDuplicates.observe(viewLifecycleOwner, { this.onDuplicatesChanged(it) })
Could you modify DuplicateDetectorActivity to use that technique instead of calling viewModel.allDuplicates.value directly ?
Thanks for your review. I added new commits.
Looks all good !