MirakelX / mirakel-android

Easy task management for professionals
http://mirakel.azapps.de/
386 stars 117 forks source link

Sort option: sort alphabetically #613

Open seano0 opened 8 years ago

seano0 commented 8 years ago

Please implement a sort option to sort tasks (especially completed tasks) alphabetically. Use case: Mirakel Shopping List A shopping list has items as tasks (e.g. milk, bread, lettuce, etc.) to be ticked off. When a shopping list is being made, previously completed items can be "un-completed" to add them back to the list. It should be quick and easy to find those items. Sorting completed items by creation date or completion date does not make it easy to find a single item in a list of ~100 items. Sorting alphabetically by task name would make it easy, greatly enhancing Mirakel's flexibility as a list manager. Perhaps the sort by "Alphabetical" option could replace the redundant "Default" option (which appears to be the exact same as "Created date"?)

igoralmeida commented 8 years ago

I tried to implement this but got into a yak shaving quest trying to have the original app and my version coexist. Eventually I got fed up, and it sure didn't help that latest master does not build. Perhaps @azapps could chime in.

My approach was:

diff --git a/model/src/de/azapps/mirakel/model/list/ListMirakel.java b/model/src/de/azapps/mirakel/model/list/ListMirakel.java
index 15c4a5b..68d190f 100644
--- a/model/src/de/azapps/mirakel/model/list/ListMirakel.java
+++ b/model/src/de/azapps/mirakel/model/list/ListMirakel.java
@@ -83,6 +83,7 @@ public class ListMirakel extends ListBase implements ListMirakelInterface {
                                               };

     public enum SORT_BY {
+        //OPT, DUE, PRIO, ID, REVERT_DEFAULT, ALPHA;
         OPT, DUE, PRIO, ID, REVERT_DEFAULT;

         public short getShort() {
@@ -97,6 +98,8 @@ public class ListMirakel extends ListBase implements ListMirakelInterface {
                 return 3;
             case REVERT_DEFAULT:
                 return 4;
+            //case ALPHA:
+                //return 5;
             default:
                 throw new IllegalArgumentException("Unkown SORT_BY type " + this.toString());
             }
@@ -114,6 +117,8 @@ public class ListMirakel extends ListBase implements ListMirakelInterface {
                 return ID;
             case 4:
                 return REVERT_DEFAULT;
+            //case 5:
+                //return ALPHA;
             default:
                 throw new IllegalArgumentException("Cannot transform " + s + " to SORT_BY");
             }
@@ -156,6 +161,9 @@ public class ListMirakel extends ListBase implements ListMirakelInterface {
             qb.sort(Task.DONE, Sorting.ASC);
             qb.sort(dueSort, Sorting.ASC);
             break;
+        //case ALPHA:
+            //qb.sort(Task.NAME, Sorting.ASC);
+            //break;
         case REVERT_DEFAULT:
             qb.sort(Task.PRIORITY, Sorting.DESC);
             qb.sort(dueSort, Sorting.ASC);
radfish commented 8 years ago

@igoralmeida What's the build error? I had issues with nasty Android Studio eating line breaks in .gradle build files, which broke their syntax.

weiznich commented 8 years ago

@igoralmeida master builds fine for me. Take a look at our development tutorial. I think you are missing point 5 of "Clone our repo" (You must copy some files.).