Hentoid icon indicating copy to clipboard operation
Hentoid copied to clipboard

Duplicate detector : Show how many items are left in main page

Open plive498 opened this issue 3 years ago • 1 comments

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.updateTitle has parameter count if count>0, updateTitle update title to "n duplicates" for the detail page if count<0, updateTitle update title to "n item(s) left" for the main page if count=0, updateTitle update title to "Duplicate Detector" for the main page without any items

@AVnetWS/admin-team

plive498 avatar Sep 18 '22 13:09 plive498

Thanks for your contribution plive 👍

I see two things that can be improved there :

  • The <0 => main page / >0 => details page convention 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 ?

RobbWatershed avatar Sep 19 '22 11:09 RobbWatershed

Thanks for your review. I added new commits.

plive498 avatar Sep 19 '22 20:09 plive498

Looks all good !

RobbWatershed avatar Sep 21 '22 06:09 RobbWatershed