diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-11 06:36:55 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:41 +0200 |
commit | 7fb7f3e83fa09ccf5427a7e9047525d23140f43f (patch) | |
tree | 69208eebb286b6014f355f5669e74021f7f2c00b /src/android/app | |
parent | android: Convert EmulationMenuSettings to Kotlin (diff) | |
download | yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.gz yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.bz2 yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.lz yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.xz yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.zst yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.zip |
Diffstat (limited to 'src/android/app')
-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 + } +} |