diff --git a/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/PythonSDLActivity.java b/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/PythonSDLActivity.java index af31820..ae9ef69 100644 --- a/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/PythonSDLActivity.java +++ b/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/PythonSDLActivity.java @@ -568,6 +568,22 @@ public void openUrl(String url) { openURL(url); } + public void openEditor(String file) { + File f = new File(file); + + Uri uri = null; + if (Build.VERSION.SDK_INT >= 24) { + uri = RenPyFileProvider.getUriForFile(this, getPackageName() + ".fileprovider", f); + } else { + uri = Uri.fromFile(f); + } + + Intent i = new Intent(Intent.ACTION_VIEW); + i.setDataAndType(uri, "text/plain"); + i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } + public void vibrate(double s) { Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (v != null) { diff --git a/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/RenPyFileProvider.java b/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/RenPyFileProvider.java new file mode 100644 index 0000000..7a846a3 --- /dev/null +++ b/rapt/prototype/renpyandroid/src/main/java/org/renpy/android/RenPyFileProvider.java @@ -0,0 +1,9 @@ +package org.renpy.android; + +import androidx.core.content.FileProvider; + +public class RenPyFileProvider extends FileProvider { + public RenPyFileProvider() { + super(R.xml.file_paths); + } +} diff --git a/rapt/prototype/renpyandroid/src/main/res/xml/file_paths.xml b/rapt/prototype/renpyandroid/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..1f5fd2a --- /dev/null +++ b/rapt/prototype/renpyandroid/src/main/res/xml/file_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/rapt/templates/app-AndroidManifest.xml b/rapt/templates/app-AndroidManifest.xml index f366580..44d2741 100644 --- a/rapt/templates/app-AndroidManifest.xml +++ b/rapt/templates/app-AndroidManifest.xml @@ -28,6 +28,16 @@ + + + + {% if (config.store in ("amazon", "all" )) %}