Android: separate sort order for each folder

Created on 26 Aug 2017  路  13Comments  路  Source: nextcloud/android

Actual behaviour

  • all folders have the same sort order

Expected behaviour

  • I tend to have list views sorted alphanumerically
  • I tend to have tile views sorted new to old
  • once I decided by which order a folder should sorted, it should stay this way (the same already happens when I switched from list view to tile view)

Environment data

Android version: Android 7.1.1

Device model: OnePlus 5

Stock or customized system: Stock

Nextcloud app version: 2.0.0RC4

Nextcloud server version: 11.0.4

approved enhancement pr exists

Most helpful comment

In fact this is something me and @jancborchardt wanted do have quite a long long (oc) time ago, so then the behaviour would be the same as list vs grid view: (but no time :/)

  • store sorting decision per folder
  • if there is no sorting order in current folder, take the sorting order of parent folder (up to root folder)

Basically you can re-use the list vs grid logic, but please store it independently.

Maybe let's wait for @jancborchardt feedback, but I vote for doing it :+1:

EDIT: to not waste time, please wait for the final decision @srkunze. But I am really happy that you want to contribute :tada:

All 13 comments

Fine by me, what do you think @tobiasKaminsky @mario?

I'm not sure I understand? I vote for keeping sort order between list/grid views, but for EACH folder? Please no...

I would like to have my camera pictures sorted new to old and watch our trips to several major cities old to new.

Is there as technical reason why this couldn't be supported?

Of course not. It's just that the behaviour might be unwanted with the majority of the population and the way people are used to work. Dunno ... let me think about this further.

Actually, I would like to contribute this feature. But I'd need some sort of approval to start. :)

A quick research of some file explorers (Windows + Ubuntu) showed that sorting is indeed stored per folder hierarchy. I basically would (re-)use isGridViewPreferred, which already provides this behavior.

In fact this is something me and @jancborchardt wanted do have quite a long long (oc) time ago, so then the behaviour would be the same as list vs grid view: (but no time :/)

  • store sorting decision per folder
  • if there is no sorting order in current folder, take the sorting order of parent folder (up to root folder)

Basically you can re-use the list vs grid logic, but please store it independently.

Maybe let's wait for @jancborchardt feedback, but I vote for doing it :+1:

EDIT: to not waste time, please wait for the final decision @srkunze. But I am really happy that you want to contribute :tada:

Yup, agree with @srkunze, as we chatted @tobiasKaminsky :)

@srkunze a contribution would be really great!

@srkunze I'd say a 3 thumbs up is a Go 馃帀

Sounds good. :)

I'd like plan out details a little bit since some refactoring would make the solution to sort orders very easy to handle. Let me know if that's okay with you or if you prefer a less intrusive code change.

  • [x] find my way around in the code
  • [x] use a common way to address sort orders to make storage easy
  • [x] generalize isGridViewPreferred = getFolderPreference or something
  • [x] base getSortOrder on getFolderPreference
  • [x] generalize saveGridAsPreferred = setFolderPreference or something
  • [x] base setSortOrder on setFolderPreference

And some clean up.

  • [x] move GRID_IS_PREFERED_PREFERENCE to PreferenceManager
  • [x] base isGridViewPreferred on getFolderPreference
  • [x] base saveGridAsPreferred on setFolderPreference
  • [x] move isGridViewPreferred and saveGridAsPreferred to PreferenceManager

Done. It seems to work the way I tended it to work. I'm going to do some further testing then compiling some pull request(s) to have the changes reviewed. Stay tuned. :)

Sounds great @srkunze, also like the described solution :)
Nice, clean and tidy :+1:
Will be back at a computer tomorrow :)

@srkunze I just added you to the Nextcloud organization too, so you should be able to work in a branch on the main repository. :)

@jancborchardt Thanks. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThaDaVos picture ThaDaVos  路  3Comments

JSoko picture JSoko  路  3Comments

JSoko picture JSoko  路  3Comments

ezaquarii picture ezaquarii  路  3Comments

AndyScherzinger picture AndyScherzinger  路  3Comments