kiwix-android icon indicating copy to clipboard operation
kiwix-android copied to clipboard

Order of the books

Open JensKorte opened this issue 5 years ago • 7 comments
trafficstars

Is your feature request related to a problem? Please describe. If I open the books, I see my local language first, which is nice. In german I have two books, an old WP and a new one. The old one is listed first. The newer and bigger ones should be at the top, imho. Another rule of sorting could be "Which ZIM file was mostly or recently opened, without ordering by language".
There could be even several tabs for different sortings.

Describe the solution you'd like Just a better sorting, though the preferred language at top is quite good.

Describe alternatives you've considered

Square icons with the descripton below or beside. Or maybe just icons and the first tap shows the file description, a message "Tap again to open" and the second tap on the same file opens it.

Edit: Or maybe the books could be filtered by category (no)Vid, (no)Pic...

JensKorte avatar Dec 14 '19 20:12 JensKorte

A good bit of thought would want to be put in to the design of this. Especially in light of the unification of the downloading/library tabs.

Maybe a sensible default for the list when you are opening a new tab is most recently opened first? Other than that I can see the usefulness of ordering the list by various criteria but where to put it? Make our language filtering a subsetting of a new screen FiltersActivity?

Lots to consider

macgills avatar Dec 16 '19 15:12 macgills

Have a look at Osmand~. Maybe the download map dialog could be a template. ;)

JensKorte avatar Dec 16 '19 18:12 JensKorte

I was thinking about the same thing. I thought about adding timestamp to the Book class representing when it was last opened/downloaded and sorting based on this order. The mainpage also needs a button to switch from default sort and recency sort. I would like to work on this if I can

mohamed-sameh-khalil avatar Apr 07 '20 13:04 mohamed-sameh-khalil

After reading more code I have an idea on implementing the recency sort in the hometab only.

  1. add timestamp to the Book entity with default value of the current time
  2. in the newBookDao add methods to update the timestamp to the current time
  3. in Repository.kt add methods to allow sorting based on the timestamp instead of just the book name. Also add methods to update timestamp of a book using the DAO
  4. in SharedPrefUtil add methods to save the sort type
  5. The MainPresenter will have methods to request the Repository to update the sorting
  6. CoreMainActivity will notify presenter with the sort type based on the sharedPreference
  7. UI: I see 2 ways to go about this. either add an item in the options menu that only appears when in homepage or Add it in settings.

@macgills your thoughts? I could open PR if you want to see the solution implemented directly

mohamed-sameh-khalil avatar Apr 08 '20 14:04 mohamed-sameh-khalil

this is somewhat related to #500 as that proposes a UI for filtering the Library and I would want our filtering ui to be consistent across our lists.

The filtering would want to be shared between Device and Home so it would have to be stored in sharedPreferences. We would have to define what our sorting strategies would be and how it is displayed. Do we still show the Language Headers when sorting by MostRecentlyOpened? Do we apply the sort filter within the Language sections or is the ? Are our filters Size,MostRecentlyOpened, MostRecentlyDownloaded, MostRecentlyCreated, Alphabetical? do we allow reverse sorting for all our strategies?

I would defer to @kelson42 for the design decision because I don't know what we want to do. The scope of this ticket is unbounded right now until we define filter strategies at least

macgills avatar Apr 09 '20 13:04 macgills

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jun 08 '20 17:06 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Oct 17 '20 02:10 stale[bot]