-
Notifications
You must be signed in to change notification settings - Fork 249
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
Improve task list selection when creating a new task from widget #287
Conversation
I see how this is a useful enhancement for widgets that show only a single list. I'm not so sure about widgets that show multiple lists, though. In the latter case the "benefit/annoyance" factor is probably not high enough to justify this change. Some users might be annoyed by not being able to choose from the whole set of lists anymore (if you change your mind about the list you would have discard your changes and start over or store the task in the wrong list and go back to change the list). Here is a counter proposal, separated by the number of "writable" lists the widget shows: 0 writable listskeep the current behavior Reason: we're planning to add support for "smart lists" that show tasks that match certain criteria. These smart lists would be read-only by design as they are only "filtered views" on the set of tasks. Since these smart lists qualify perfectly for being shown in a widget (like "my tasks today") it would be counter-productive to not support adding tasks via the widget anymore. 1 writable listShow all lists in the dropdown but pre-select the one that the widget shows, so you don't have to change the selection, but you still have the option. In this case the benefit is exactly the same as in your PR - no need to change the list selection. 2+ writable listsLike "1 writable list" but pre-select one of the writable lists of the widget. Then we just need to decide which of these lists to select. That could be:
An approach like that could be done without any changes in the Editor code. The widget would just provision the Editor with a ContentSet that contains the pre-selected task list. What do you think? |
I think your considerations are reasonable. I thought about pre-selecting instead of filtering, too. But as you found out as well, this does not scale for widget with 2 or more lists. Therefore, I just tried the filter version. But I'm totally fine with switching to a pre-selecting approach. Let's do it this way. So, the open question is which list should be selected for the "2+" case. I think, the most recently used task list would fit best (a random list would drive me crazy), if it can be computed with reasonable effort. How would you do that? I see two options:
Regarding the implementation: If the widget should provide the |
As far as I can see, there is no index on This should be changed or another strategy should be chosen. What's your favorite? |
Using Since this is solely a UI feature we should do this entirely in UI code. So I'm in favor of your option 2. Of course we could also add a column to the lists table, but we should make sure that sync adapter updates don't update the value of this column. So we can't just use an SQL trigger. Instead we have to do this in Java code, which makes it non-trivial. |
OK, I understand. However, a disadvantage of the second option without using a column in the database is: if a task list is deleted, the corresponding entry in the shared preferences will not be deleted automatically. So we will get orphaned data -- on a long-term basis. For a typical user, this will not be serious (How often do you delete a task list? I would implement this using a sorted set of ids, so 1 deleted task list would leave over ~2-4 Byte). But from time to time, this should be cleaned up. This could be done, e.g., on every change of this list or (the other extrema) only when the app is updated. Or is there a trigger which is called when a task list was deleted? |
I've just implemented the strategy "recently used task list" using As far as I can see, I'm done so far. Please review, @dmfs |
Thank you! It looks good on a first glance. It's only the procedural approach of I'll have a closer look later this week. |
68ae655
to
c274839
Compare
c274839
to
8f3d7de
Compare
rebased to |
Any news on this? Can this be merged, now? (after 7 months 😉 ) |
Not sure why, but it doesn't work for me. I've created 4 lists and two widgets, showing 2 lists each. Whenever I click the ad button, the editor comes up with the last recently used list, even if the widget doesn't show that list. |
Hmmm. It was that a long time ago. It's fixed and tested again. Please test again and (hopefully) be able to merge now 😀 |
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.
work fine now, thx!
I'm using single widgets for every task list. In such a use case, it would be very useful, if a newly created task (using the
+
sign on the top-right corner of the widget) would use automatically the corresponding task list from the widget. Currently, the last selected list (from the previous edit) is used, which is often not desired.This pull request therefore introduces a filter for the TaskList list in
EditTaskFragment
. Now, only such tasklists are shown, that are activated in the widget on which the+
button was pressed.What do you think about this solution? I see it as work in progress and looking forward for feedback.
Tasks done