mpcjanssen / simpletask-android

GNU General Public License v3.0
549 stars 128 forks source link

implement support for notes (todo.txt Add on) #833

Open devpmts opened 6 years ago

devpmts commented 6 years ago

There is an add on for todo.txt-cli to store notes as files see here. In terms of simpletask, the extension syntax is used. For example note:XyZ.txt The notes files are stored relative to todo.txt in a folder called "notes" (see the add on page for more info).

The note extension can easily be recognized by the onLongClickListener fetching relevant actions. In this scenario, the user opens an EditText by longpressing and selecting the note action. I am already working on this. Just tell me, if someone is interested to bring it in the mainline.

mpcjanssen commented 6 years ago

If this works reliably for all storage backends I would be happy to integrate this.

devpmts commented 6 years ago

I have a somewhat working solution, that I use personally for Dropbox. It definitely is my plan to make it stable also for all other platforms in the future. Currently, this is possible, as soon, as my work schedule allows. I'll keep you in the line.

aisbergde commented 4 years ago

In terms of simpletask, the extension syntax is used. For example note:XyZ.txt The notes files are stored relative to todo.txt in a folder called "notes" (see the add on page for more info).

Why it should be stored in a folder called "notes" but not in the current folder?

I use VS Code and there is an extension: https://marketplace.visualstudio.com/items?itemName=davraamides.todotxt-mode it allows to quickly move some content from the current todo file into a separate note file which is created in the current folder, for example demo-item-123-note.md and it write this filename into the task entry: note:demo-item-123-note.md

That's why for me it's better to store the note in the current folder to be compatible with the VSC extension. test note:saved_filters.txt is a link to the file saved_filters.txt in the same folder as the todo file.

But finally, if a sub folder should be used as starting point this could be part of the notes configuration. Some users like @devpmts could set a notes folder = ./notes, other like me will set to use the current folder. Both will be happy.

What I want to request:

Could you implement the note:abc.def as a simple link to the file abc.def in the current folder, no matter what this file is? And when I press the link the default associated app defined by file extension would open the linked file. If note:jkl.jpeg then the default jpeg program will open :-) simpletask should not care about (or should it?)

note:ghi\abc.def should open the file abc.def in the folder ghi, maybe for Android this needs to be converted into ghi/abc.def

In a later version you could also add a feature to create a notes file and the note entry. Currently there are some quick action buttons below (complete, edit, list, ... , threshold date) and there could be one more butten to append a note file. This button could open a sub menu where I can select an existing file or create a new one.

Markor has this feature to create and add some file links to the todo.txt - something similar would be fine. https://github.com/gsantner/markor

But I can open the same plain text files in Simpletask (which has excellent filtering, which is missing in Markor) and in Markor, which is my favorite markdown editor and has additional some todo.txt support.

BTW, how I found simpletask: I was looking for an Android markdown editor, I found Markor (it is great for markdown) and there was this strange "todo.txt" "What is todo.txt?" - a great idea. And so I found from Markor to simpletask :-)

mpcjanssen commented 4 years ago

You can share other files in Android with Simpletask, this will then insert a content:// link which upon long press on the task will open the file with the associated viewer/editor. This is the only supported way to do something like this in Android. Accessing files directly is becoming more and more difficult which each Android version.

aisbergde commented 4 years ago

I tried to share a file to simpletask. But the result was that no content://... was created, but the content of the file was extended to the todo.txt file

aisbergde commented 4 years ago

but what you describe is exactly what I am looking for. So it seams to be implemented but I did not use the correct share method? Maybe it would better to open a share dialog and to ask me, what I want to do:

aisbergde commented 4 years ago

I tried both share icons, both insert the content but not a link

smichel17 commented 4 years ago

This depends on the app doing the sharing. Some apps share a link to the file, others share the full text of the file. If the app only shares the text, ST has no way of knowing what file the text came from.

If you just want to see how it ought to work, I just verified that simple gallery shares images as content:// links.

aisbergde commented 4 years ago

OK, i did not know. I used Astro file explorer to share. I will try some other ways.

I used simple gallery to test and this works fine. long press on the entry opens an action window. This is exactly what I need, for text files, markdown files But it is not clear which syntax is required to link an open txt files or md files content://todo.txt doesn't work

I tried to understand and to find the required example https://developer.android.com/guide/topics/providers/content-provider-basics https://www.tutorialspoint.com/android/android_content_providers.htm

But it looks like this a more abstract construct and I don't understand what exactly would be required <prefix>://<authority>/<data_type>/<id>

Maybe you could implement an file picker as action button so simpletask can ensure that the file is picked and the required content entry is created?

aisbergde commented 4 years ago

now I used several file explores and it looks like every explorer uses it's own format, starting with the identification of the app and then something different. So it looks like this content: thing is not very useful because it depends on the app which was used to create the content and this will not be available on the desktop.

So we return to the initial request: note:filename

aisbergde commented 4 years ago

This is the only supported way to do something like this in Android. Accessing files directly is becoming more and more difficult which each Android version.

terrible ...

aisbergde commented 4 years ago

what about supporting this syntax: <a href='../filename.txt'>filename</a> to make this clickable? I could use Markor to create these kind of links to files

mpcjanssen commented 4 years ago

The content:// links are not easy to generate by hand (unfortunately). One thing which should still work (but will probably be broken in future Android versions) is to insert a root://todo.txt link. Where the todo.txt is looked up relative to the the root directory configured in settings->Other

mpcjanssen commented 4 years ago

@aisbergde can you try the todo:// approach with a build from https://mpcjanssen.nl/artifacts/10.5.4-14-63839bf/

aisbergde commented 4 years ago

I tried:

2020-05-28 @@Test root://done.txt

but I get

Webpage not available

The webpage at content://nl.mpcjanssen.simpletask.provider/external_files/done.txt
could not be loaded because:

net::ERR_UNKNOWN_URL_SCHEME

I see, this is not easy to do. And it should work on android and in windows, and it should be future proof.

That's why the idea to use this human readable note:filename.fileextension is so interesting.

Maybe I should think about the usage of the uuid: which is in options, but currently I don't want to mess my real todo.txt until I find a way how to link notes and todo entries using UUID. I think the UUID could be a way to connect notes and todo entries. But this needs to be supported in one app on Android and in another system on Windows.

What are the reasons to implement the UUID? Maybe there are some planes?

Maybe there are some other experiences or ideas how to connect tasks entries and notes?

My idea is to build a combined system containing