ramack / ActivityDiary

Android diary for any kind of activities
GNU General Public License v3.0
73 stars 37 forks source link

Improve Search: Date #185

Open ramack opened 6 years ago

ramack commented 6 years ago

In the history allow to search for date / time frame or maybe a "jump to date" to scroll to a date

noki1234 commented 6 years ago

Hello I am working on it. My expectations: Entering part of date or full date (maybe also time) in search (activity history), click on "Search "yourString" in dates. Results filtered by entered string.

ramack commented 6 years ago

Nice to have you on board. In case you have any question, don't hesitate to ask. The code is neither clean, nor can I expect that everything is easy to understand.

Happy hacking!

noki1234 commented 6 years ago

Hi Ramack, can you please assign me to this issue until I won't finish it ?

Plus I have a question for you, In case user enters only part of date example (12.22.) it should be searching as 12.22. in actual year ? it means (2018.12.22.) (must be entered minimum month and date) or it should find all matches in start and end dates (so it will be looking for matches 12.22 with all dates in database).

Difference is in way of search, because for date 2018.12.22 it will be searching start and end dates but also between them (example activity took user 4 days start: 2018.12.20, end: 2018.12.23) so this date is between 2018.12.20 and 2018.12.23 meanwhile in first case 12.22. is searching only in start and end dates as string match, because year is not defined. Hope you understand my question :)

ramack commented 6 years ago

Nobody will take the flowers from your work, before anyone else starts to work on that he/she will contact you about the status, but technically assigning it to you is not possible until you are official part of the team - for that I would wait a few reasonable contributions if it is ok with you.

I would propose, to work a lot with search suggestions, such that for the search result you always have a clearly defined search range. So as soon as it looks like a date we should give a search suggestion with the closest expected date. I.e. as soon as we have a 1-2 digit number followed by dot, we can suggest to search for that day in the current and last month.

Example: we have October 2018 type "12." - suggest search "12. October", "12. September" if the locale is day first type "12." - suggest search "December 2017", "December 2016" if the locale is month first

But also the 12. could mean "December", which might be the next suggestions "December 2017".

If typing continues to "12.10" (even without the trailing dot) suggest "12th of October 2018" and "12th of October 2017" and "December 2010" if locale is day first if typing continues to "12.10" (even without the trailing dot) suggest "10th of December 2018" and "10th of December 2017" and "December 2010" if locale is month first.

The notation YYYY-MM-DD is ISO standard, so I propose to handle at least "YYYY-" "YYYY-MM", ... directly. Mabye even short forms of it "XX-" as proposal for "20XX" and if XX is in range [1-12] even to the month.

I even think the search suggestions for the 3 best fitting activity names can be hidden if they to not have the typed content as real substring. (e. g. an activity names "12. Festival" would stay visible if we search for "12.", but "13. Festival" would get hidden as soon as the dot after the 12 is typed.

If "10th of December 2018" is too long, go for the default date format, or the configured one "12.10.2018". But if possible use a textual representation of the month to make it obvious for the user that a date is suggested. But also the search suggestion icon can show a calendar to indicate that.

For the search result I am not sure whether searching for "12.22." without further specification does make too much sense. Ok, maybe someone really wants to check "what did I do 2 days before Christmas the last years". But if you want to allow that maybe the best it to give a search suggestion like "December 12 2017" "December 12 2016" "December 12 all years"? (2018 is not yet reasonable, as this year the 12.22. is still in future). Showing all "syntactical" matches of "12.22" in the dates doesn't seem reasonable to me.

Final remark: all I have written here are just ideas, how I would make my life hard to implement that, feel free to simplify or advance it. => Implement what you believe is useful for you and for others.

sesam commented 6 years ago

good stuff! As a user, I usually try to search near a date, or between two dates. So "Oct 12" could a timeline search and I'd like to scroll back/forward in time around that date. Or "Oct 12-13" to see only last weekend. Either way, probably start implementing whatever you feel yourself that is most needed for your needs, and don't complicate your first few PRs.

noki1234 commented 6 years ago

good stuff! As a user, I usually try to search near a date, or between two dates. So "Oct 12" could a timeline search and I'd like to scroll back/forward in time around that date. Or "Oct 12-13" to see only last weekend. Either way, probably start implementing whatever you feel yourself that is most needed for your needs, and don't complicate your first few PRs.

Hello as Ramack suggested :) I am already implementig it :) So as soon as it will be possible, we will see the result :) but thank you for your advice sesam. I will try to finish it as soon as possible (I had yet some duties, but I hope this weekend or at maximum on next it will be finished)

Best regards, Noro :)

noki1234 commented 6 years ago

Hello, so I finally completed task I've done it what fits me best as user but also as I was possible to do it (because I am not totaly PRO programmer, but I put best effort to it)

I changed your suggestions because you told to show user all those posibilities but it won't be looking nice and would be more confusing for user, that search would suggest him 3 or more possibilities of search for dates.

What I did is more simple, but in my honest opinion it is more better solution and clearer for user. I will summarize it in simple points:

(note: I was not creating searching with using name of months instead numbers -> like 12.January.2018... I think user never wants to write months by words + it would be difficult for distinguish the name of months in different languages)

In the near future (2-3 ? weeks later I will do also for that feature local tests and in case of finding any mistake in searching dates I will fix it, but you can also notice me here about finding some mistakes, any of you guys)

P.S: If links reffers to your github, just manually copy it and paste to new tab (where are pictuers of my work)

Tested: Android emulator - nexus 5x API26 Real (my) smartphone - Huawei p9 lite (android 7.0., API 24)

I also all my methods documented/commented for you.

Hope it will help you guys :) And very soon I will commit it.

ramack commented 6 years ago

Actually I like the idea of @sesam to jump the timeline to a dedicated date. Maybe we can have it as additional search suggestion to add a "jump to XXX" if a entered date is detected.

ramack commented 6 years ago

after merging the code from @noki1234 I think for this ticket the following points are open: