maks / MGit

A Git client for Android.
https://manichord.com/projects/mgit.html
GNU General Public License v3.0
1.21k stars 166 forks source link

Choose external editor app according to one file's extension #219

Open Vigilans opened 6 years ago

Vigilans commented 6 years ago

I am using MarkdownX as an editor for my .md files, and when opening an .md file in my native file browser, I could see MarkdownX as an available choice.

However, when I was to edit an README.md file using MGit and tried to open an external editor to better modify it, the MarkdownX choice has gone.

I tried other files with different extensions (such as .cpp) in the same way, and discovered that they all showed identical app choices. Therefore, I guess that MGit might treat all this files as the same format, for example, "text file".

Am I right? If so, would it be possible to treat files with various extensions differently 0.0 ? I had wished to edit them in such way, just for a better experience...

206

maks commented 6 years ago

Thank you for reporting this. Looks like markdown and a number of other file types are not correctly mapped to their respective mimetypes using the api that MGit makes use of, Instead MGit just uses "text/plain" as the mimetype, along with the files url in the Intent it uses to select available apps with which to open the file externally.

On the MarkdownX I believe I've tracked down its source code and this is the manifest where it registers for the markdown mimetypes which ironically should work with the Intent that MGit creates, so I will need to investigate further what is happening.

Vigilans commented 6 years ago

⊙∀⊙ Thank you for your quick reply! I had also tried the MarkdownEditors app in the link you provide, and it failed as well...

My OS is MIUI, an Android ROM with some deeper customizations. I am not clear whether it could have some influence on this problem...

maks commented 6 years ago

@Vigilans-Yea no using MIUI is not the issue, I have a test device running MIUI and its behaviour is the same. Sorry no what I meant was that there was a comment saying that the MarkdownEditors repo was the source code for MarkdownX app, though I have not checked if that is actually the case as that repo is in Chinese. Anyways, I just need to set aside some time to look into this further, I'll update here once I've done that.

Vigilans commented 6 years ago

@maks

I had also tried the MarkdownEditors app in the link you provide, and it failed as well...

Oh...my fault for not saying it clearly (:з」∠) Before opening this issue, I have also found the issue you mentioned and have already tested the MarkdownEditors with the same outcome as MarkdownX.

As for whether or not it's the source code for MarkdownX, the MarkdownEditors repo declares that part of its UI and functions are modelled on MarkdownX, and MarkdownX itself is not open-source.

But I guess many of their mechanisms (such as the code you provided above) are the same , and thus it doesn't matter that much...

Anyway, so grateful for your response and wish you a plain sailing in your investigation (ง •̀_•́)ง