diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.java | 25 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.kt | 26 |
2 files changed, 26 insertions, 25 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.java deleted file mode 100644 index 4dab914c7..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.yuzu.yuzu_emu.utils; - -import android.content.Intent; -import androidx.fragment.app.FragmentActivity; - -public final class FileBrowserHelper { - public static void openDirectoryPicker(FragmentActivity activity, int requestCode, int title) { - Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); - i.putExtra(Intent.EXTRA_TITLE, title); - activity.startActivityForResult(i, requestCode); - } - - public static void openFilePicker(FragmentActivity activity, int requestCode, int title) { - Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - intent.putExtra(Intent.EXTRA_TITLE, title); - intent.setType("*/*"); - activity.startActivityForResult(intent, requestCode); - } - - public static String getSelectedDirectory(Intent result) { - return result.getDataString(); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.kt new file mode 100644 index 000000000..6789f44b2 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FileBrowserHelper.kt @@ -0,0 +1,26 @@ +package org.yuzu.yuzu_emu.utils + +import android.content.Intent +import androidx.fragment.app.FragmentActivity + +object FileBrowserHelper { + fun openDirectoryPicker(activity: FragmentActivity, requestCode: Int, title: Int) { + val i = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) + i.putExtra(Intent.EXTRA_TITLE, title) + activity.startActivityForResult(i, requestCode) + } + + fun openFilePicker(activity: FragmentActivity, requestCode: Int, title: Int) { + val intent = Intent(Intent.ACTION_OPEN_DOCUMENT) + intent.addCategory(Intent.CATEGORY_OPENABLE) + intent.flags = + Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION + intent.putExtra(Intent.EXTRA_TITLE, title) + intent.type = "*/*" + activity.startActivityForResult(intent, requestCode) + } + + fun getSelectedDirectory(result: Intent): String? { + return result.dataString + } +} |