OI Convert CSV + OI File Manager

21 views
Skip to first unread message

Peli

unread,
Dec 9, 2008, 11:26:13 PM12/9/08
to OpenIntents
We have pushed two new applications to the Market:

OI ConvertCSV lets you import / export OI Notepad notes and OI
Shopping Lists to CSV files.
http://www.openintents.org/en/node/158

OI File Manager lets you manage your files on your SD card. (open,
rename, move, delete).
http://www.openintents.org/en/node/159

The really great thing is that the Intent system is at its best:
Shopping list starts ConvertCSV, which in turn opens the FileManager
to pick a file location. :-)

It also works the other way round: You can open a .CSV file in
FileManager to launch the ConvertCSV activity.

Actually, the file manager features new PICK_FILE and PICK_DIRECTORY
intents that any application can use:

Intent intent = new Intent("org.openintents.action.PICK_FILE");
startActivityForResult(intent, 1);

The picked file URI can be obtained onActivityResult() through getData
().
With the extras "org.openintents.extra.TITLE" and
"org.openintents.extra.BUTTON_TEXT" one can further customize the PICK
intent (e.g. display "Open file" or "Save file" in the title bar).

Details can be found in the sample application TestFileManager in the
repository: http://code.google.com/p/openintents/source/browse/#svn/trunk/samples/TestFileManager

Peli


Peli

unread,
Dec 10, 2008, 9:09:11 AM12/10/08
to OpenIntents
I was thinking of the following possible improvements to the PICK_FILE
intent:
In PICK_FILE one could provide a MIME type of the files on is
interested in, like "audio/*" or "text/plain" (which would then work
as a kind of an extension filter).

Would this make sense, or would it be better to specify supported
extensions explicitly through another intent extra? ("*.mp3, *.mid,
*.ogg", "*.txt")

In any case, PICK_FILE could return additionally the MIME type of the
file being picked. Would this be of help to anyone?

Peli

On Dec 10, 5:26 am, Peli <peli0...@googlemail.com> wrote:
> We have pushed two new applications to the Market:
>
> OI ConvertCSV lets you import / export OI Notepad notes and OI
> Shopping Lists to CSV files.http://www.openintents.org/en/node/158
>
> OI File Manager lets you manage your files on your SD card. (open,
> rename, move, delete).http://www.openintents.org/en/node/159
>
> The really great thing is that the Intent system is at its best:
> Shopping list starts ConvertCSV, which in turn opens the FileManager
> to pick a file location. :-)
>
> It also works the other way round: You can open a .CSV file in
> FileManager to launch the ConvertCSV activity.
>
> Actually, the file manager features new PICK_FILE and PICK_DIRECTORY
> intents that any application can use:
>
>                 Intent intent = new Intent("org.openintents.action.PICK_FILE");
>                 startActivityForResult(intent, 1);
>
> The picked file URI can be obtained onActivityResult() through getData
> ().
> With the extras "org.openintents.extra.TITLE" and
> "org.openintents.extra.BUTTON_TEXT" one can further customize the PICK
> intent (e.g. display "Open file" or "Save file" in the title bar).
>
> Details can be found in the sample application TestFileManager in the
> repository:http://code.google.com/p/openintents/source/browse/#svn/trunk/samples...
>
> Peli

Peli

unread,
Dec 10, 2008, 9:10:45 AM12/10/08
to OpenIntents
By the way: this is the list of currently supported extensions and
mime types:
http://code.google.com/p/openintents/source/browse/trunk/FileManager/res/xml/mimetypes.xml

Let me know if extensions are missing that are used on the phone.

Peli

Peli

unread,
Dec 10, 2008, 1:51:26 PM12/10/08
to OpenIntents
Hi, this is me posting again to my thread. Another idea:

We can not possibly cover all extensions -> MIME type mappings ever
used. An application may come up with a custom extension and use the
vnd... type of MIME types - still it would be nice if the File browser
could launch their files correctly.

What about the following idea:
Each application can to declare which MIME types it supports, together
with what file extensions this would correspond to. Then at least for
those applications installed OI File Manager could find out about
their supported extensions and MIME types.

I can think of 2 possible implementations:
1) This info is stored in the Manifest in Meta-data. e.g.
<meta-data android:name="org.openintents.meta.extension2mime"
android:value=".mp3 audio/mp3 .wav audio/wav .oif application/
vnd.openintents.flashlight" />

2) There could be a broadcast intent SEND_MIMETYPES, and all listeners
reply with their list of extensions / mime types.

Advantage of 2) is that only those applications need to be polled that
support this feature, which could be quicker.
Advantage of 1) is that the information is available through the
PackageManager, but many applications have to be queried to find the
few that may implement this.

Then again, one should not need to poll this information too often, so
probably putting this information into the Manifest is the easiest for
us and application developers.

Opinions?

Peli

On Dec 10, 3:10 pm, Peli <peli0...@googlemail.com> wrote:
> By the way: this is the list of currently supported extensions and
> mime types:http://code.google.com/p/openintents/source/browse/trunk/FileManager/...

Friedger Müffke

unread,
Dec 10, 2008, 4:02:43 PM12/10/08
to openi...@googlegroups.com
Hi,

I was thinking about a similar mechnism as the menu extension (alternative menus):
The FileManager handles folders (vnd.android.cursor.dir/file) and files (vnd.android.cursor.item/file) maybe with the mime-type included.
Then an application could add its only handling to this file similar to the menu. I am not sure whether this works... have to dig into details..

Probably, the mechanism is similar to what Peli names as 2).

Friedger



2008/12/10 Peli <peli...@googlemail.com>

Peli

unread,
Dec 11, 2008, 8:47:23 AM12/11/08
to OpenIntents
Hm, this may go into the right direction.

Currently I define the following in the ConvertCSV Manifest:
<intent-filter android:label="@string/convert_csv_notepad">
<action android:name="android.intent.action.VIEW"/
>
<category android:name="android.intent.category.DEFAULT" /
>
<data android:mimeType="text/csv" />
</intent-filter>

I have not tried it, but it should also work if one includes
<data android:scheme="file" />

which is actually what I am expecting in the code anyway. (Currently
it could not handle other sources than file://. It would not open a
CSV file from http:// correctly...)

If this is the case, one could simply add the following META tag in
the intent filter:
<meta-data android:name="org.openintents.meta.extension"
android:value=".csv" />

So, the OI File Manager would just have to query through all Intents
with VIEW action and scheme="file" to retrieve mimeType and meta-
extension.

In case a mime type covers several extensions, they could be separated
by space, e.g. android:value=".htm .html"

I think this sounds like the best solution so far :-) Or are there
other views or comments?

Peli

On Dec 10, 10:02 pm, "Friedger Müffke" <fried...@googlemail.com>
wrote:
> Hi,
>
> I was thinking about a similar mechnism as the menu extension (alternative
> menus):
> The FileManager handles folders (vnd.android.cursor.dir/file) and files
> (vnd.android.cursor.item/file) maybe with the mime-type included.
> Then an application could add its only handling to this file similar to the
> menu. I am not sure whether this works... have to dig into details..
>
> Probably, the mechanism is similar to what Peli names as 2).
>
> Friedger
>
> 2008/12/10 Peli <peli0...@googlemail.com>
Reply all
Reply to author
Forward
0 new messages