diff options
| author | 2023-03-11 00:36:55 -0500 | |
|---|---|---|
| committer | 2023-06-03 00:05:41 -0700 | |
| commit | 7fb7f3e83fa09ccf5427a7e9047525d23140f43f (patch) | |
| tree | 69208eebb286b6014f355f5669e74021f7f2c00b /src/android | |
| parent | android: Convert EmulationMenuSettings to Kotlin (diff) | |
| download | yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.gz yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.tar.xz yuzu-7fb7f3e83fa09ccf5427a7e9047525d23140f43f.zip | |
android: Convert FileBrowserHelper to Kotlin
Diffstat (limited to 'src/android')
| -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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils; | ||
| 2 | |||
| 3 | import android.content.Intent; | ||
| 4 | import androidx.fragment.app.FragmentActivity; | ||
| 5 | |||
| 6 | public final class FileBrowserHelper { | ||
| 7 | public static void openDirectoryPicker(FragmentActivity activity, int requestCode, int title) { | ||
| 8 | Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); | ||
| 9 | i.putExtra(Intent.EXTRA_TITLE, title); | ||
| 10 | activity.startActivityForResult(i, requestCode); | ||
| 11 | } | ||
| 12 | |||
| 13 | public static void openFilePicker(FragmentActivity activity, int requestCode, int title) { | ||
| 14 | Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); | ||
| 15 | intent.addCategory(Intent.CATEGORY_OPENABLE); | ||
| 16 | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); | ||
| 17 | intent.putExtra(Intent.EXTRA_TITLE, title); | ||
| 18 | intent.setType("*/*"); | ||
| 19 | activity.startActivityForResult(intent, requestCode); | ||
| 20 | } | ||
| 21 | |||
| 22 | public static String getSelectedDirectory(Intent result) { | ||
| 23 | return result.getDataString(); | ||
| 24 | } | ||
| 25 | } | ||
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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils | ||
| 2 | |||
| 3 | import android.content.Intent | ||
| 4 | import androidx.fragment.app.FragmentActivity | ||
| 5 | |||
| 6 | object FileBrowserHelper { | ||
| 7 | fun openDirectoryPicker(activity: FragmentActivity, requestCode: Int, title: Int) { | ||
| 8 | val i = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) | ||
| 9 | i.putExtra(Intent.EXTRA_TITLE, title) | ||
| 10 | activity.startActivityForResult(i, requestCode) | ||
| 11 | } | ||
| 12 | |||
| 13 | fun openFilePicker(activity: FragmentActivity, requestCode: Int, title: Int) { | ||
| 14 | val intent = Intent(Intent.ACTION_OPEN_DOCUMENT) | ||
| 15 | intent.addCategory(Intent.CATEGORY_OPENABLE) | ||
| 16 | intent.flags = | ||
| 17 | Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | ||
| 18 | intent.putExtra(Intent.EXTRA_TITLE, title) | ||
| 19 | intent.type = "*/*" | ||
| 20 | activity.startActivityForResult(intent, requestCode) | ||
| 21 | } | ||
| 22 | |||
| 23 | fun getSelectedDirectory(result: Intent): String? { | ||
| 24 | return result.dataString | ||
| 25 | } | ||
| 26 | } | ||