-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add Categories #65
base: master
Are you sure you want to change the base?
Add Categories #65
Conversation
Signed-off-by: tobiasKaminsky <[email protected]>
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.
I think it is problematic that the GUI is quite disconnected from the underlying datastructure. The List in the GUI is sectioned, but the text file is just a flat list. This introduces problems when reordering items. Moving them across sections would move them to other categories (if that worked). And the index/position gets messed up.
What do you think about adding a new field to each list item with a tiny font (and additionally color coding). And then adding new sorting functionality to sort by category? And then maybe extend the app settings to let the user define (multiple) orderings of categories?
@@ -44,4 +44,5 @@ dependencies { | |||
implementation 'com.android.support:design:28.0.0' | |||
implementation 'com.android.support:preference-v7:28.0.0' | |||
implementation 'com.android.support:recyclerview-v7:28.0.0' | |||
implementation 'com.afollestad:sectioned-recyclerview:0.5.0' |
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.
I'm not too happy about this dependency, since it seems to be pretty much dead. The author even removed it from his GitHub profile
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.
I know, this is totally outdated, but also used in NC Files App…
If you find a proper replace, I am more than happy to change it.
(also the other way around, if I find one for NC Files App).
But for now it "just works" (for >500k users…)
public void move(int oldIndex, int newIndex) { | ||
public void move(ListItem from, ListItem to) { | ||
int oldIndex = indexOf(from); | ||
int newIndex = indexOf(to); |
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.
This could be problematic. What if an item has been added twice? The GUI probably creates new objects for every item, though. What was the rationale for this change?
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.
This addresses the problem you described above: GUI is disconnected from flat last.
Instead of relying on indexes, this is now really using the objects as stored in ArrayList.
Therefore it uses the real object and moves them in the List.
(upon write it then just goes through all ordered categories and writes the items to list.
ItemViewHolder sourceViewHolder = (ItemViewHolder) viewHolder; | ||
ItemViewHolder targetViewHolder = (ItemViewHolder) target; | ||
|
||
RecyclerListAdapter.this.move(sourceViewHolder.listItem, targetViewHolder.listItem); |
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.
Not entirely sure where it was introduced, but when moving items, it only swaps with the neighbor item.
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.
I will have a look 👍
UPDATE: What do you think? |
Signed-off-by: tobiasKaminsky <[email protected]>
update: Sorting is now working again 🎉 |
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
This adds support for categories:
![2020-05-17-080859](https://user-images.githubusercontent.com/5836855/82137143-acdb2680-9815-11ea-9121-8b8b6afbb194.png)
Currently missing is UI for changing/adding/resorting categories.
This can be done via editing plain text file, for now.
Signed-off-by: tobiasKaminsky [email protected]