javierpe / android-codepad

Automatically exported from code.google.com/p/android-codepad
0 stars 0 forks source link

"Android CodePad" is not an available view option for most filemanagers #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
> What steps will reproduce the problem?

Use OI FileManager to click on a *.java file. Half or more of all file managers 
I have tried from Market behave the same way.

> What is the expected output? What do you see instead?

I expect Android CodePad to be one of the options to view this *.java file.

> What version of the product are you using? On what operating system?

I'm using latest Android CodePad from market, but I'm also debugging with 
latest subversion HEAD checkout: "Version 1.01". I'm running this from a 
Samsung Galaxy S running CM7: Android 2.3.4.

> Please provide any additional information below.

I see that the code of OI FileManager determines MIME type like this:

  android.webkit.MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
  String webkitMimeType = mimeTypeMap.getMimeTypeFromExtension(ext);
  if (webkitMimeType != null) {
    // Found one. Let's take it!
    return webkitMimeType;
  }

This looks like a pretty reasonable way of doing this, but on my phone, this 
code for the "java" extension returns "text/x-java" not "text/plain".

I have tried out two solutions which both seem to work:

(1) Change OI FileManager to disregard this MIME type and use "text/plain".
(2) add <data android:mimeType="text/x-java" /> to the Android CodePad 
<intent-filter>.

I prefer solution #2: alter the Android CodePad AndroidManifest.xml to allow it 
to respond to more mimeType values than "text/plain" alone.

Original issue reported on code.google.com by james.ju...@gmail.com on 6 Oct 2011 at 7:00

Attachments: