Skip to content
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

Todo sorting #449

Merged
merged 6 commits into from
Dec 9, 2018
Merged

Todo sorting #449

merged 6 commits into from
Dec 9, 2018

Conversation

goldmanm
Copy link
Contributor

@goldmanm goldmanm commented Dec 8, 2018

This PR allows for users to sort todo.txt files by selecting an icon on the taskbar. Solves issue #211.

@gsantner
Copy link
Owner

gsantner commented Dec 8, 2018

@goldmanm
Thank you very much for contribtuion! very welcome!

I'm currently mobile so cant try, but will add some comments if I see something :).

@@ -306,4 +328,68 @@ public boolean onLongClick(View v) {
return new ArrayList<>();
}
}

public class SttTaskComparator implements Comparator<SttTask> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put that class aswell into Stt class (SttCommander for example). Theres no internal reference to the TextAction class right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting SttTaskComparator within SttCommander or SttTask throws an error since they are not enclosing classes. I've created a new file for SttTaskComparator next to SttTask.java instead of enclosing it within another class, since as you mentioned, it doesn't use any internal references to TextAction

This commit adds a dialogue used to sort todo.txt files by
context, project, or priority.
This commit creates a class implementing Comparator so that
SttTasks can be sorted with default Java sorting methods.
This commit adds a case which implements sorting of tasks
in todo.txt files.
This commit adds a button to the toolbar which brings
up the prompt to sort todo.txt files.
This commit used the reformat-text option on android-studio
to improve code formatting.
@gsantner
Copy link
Owner

gsantner commented Dec 9, 2018

Thanks for working on it! 👍 Very Happy about contributions, even more you are welcome to continue to do so, after all it's a community project :-).

As "ascending" and "project" "context" will be translated into user language, this split and == ascending won't work. I have an idea to solve it, but I think thats quite complicated. Likely will add that self then ;).

@gsantner gsantner merged commit b6c05d8 into gsantner:master Dec 9, 2018
@gsantner
Copy link
Owner

gsantner commented Dec 9, 2018

@goldmanm I made some rework in e2962ca .

Thats how it looks now: (Added highlighting for last selected item):
screenshot-2018-12-09__16-46-33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants