Fix android version so it now opens files from mail and file browser again.

This commit is contained in:
Jos van den Oever
2012-06-29 20:03:24 +02:00
parent 6ab8df0d0d
commit 5262fc8805
3 changed files with 19 additions and 12 deletions
@@ -25,8 +25,8 @@ import android.view.MenuItem;
public class WebODFActivity extends DroidGap {
private String path;
private ZipReader zipreader;
private ZipReader zipreader;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -39,16 +39,21 @@ public class WebODFActivity extends DroidGap {
super.loadUrl("file:///android_asset/www/index.html");
}
private void openOdfFile() {
if (path == null) {
return;
}
String escapedPath = "file://" + path.replace("'", "\\'");
sendJavascript("invokeString = '" + escapedPath
+ "';application.openUrl(invokeString);");
}
@Override
protected void onResume() {
super.onResume();
zipreader = new ZipReader(appView);
appView.addJavascriptInterface(zipreader, "zipreader");
if (path == null) {
return;
}
String escapedPath = "file://" + path.replace("'", "\\'");
sendJavascript("invokeString = '" + escapedPath + "';");
openOdfFile();
}
@Override
@@ -148,7 +153,7 @@ public class WebODFActivity extends DroidGap {
private void reportIssue() {
File screenshotfile = takeScreenShot();
File odffile = (path == null) ?null :new File(path);
File odffile = (path == null) ? null : new File(path);
File attachmentfile = null;
String type = "text/plain";
if (screenshotfile != null) {