diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-04-05 16:09:01 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-04-06 15:41:23 -0700 |
| commit | be27c4f8770e8acc600ac6d2bdf1605ff720f9b2 (patch) | |
| tree | 37cf53ff9365e83a49fb4babdf29703fe3b8397f /Source/Android/app/src/main/java | |
| parent | d3073353a715a43061b6170c56ccc21745d37015 (diff) | |
NativeLibrary: Create displayToastMsg Method
Diffstat (limited to 'Source/Android/app/src/main/java')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index b83a489256..a3d02e31ee 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -455,6 +455,14 @@ public final class NativeLibrary private static native String GetCurrentTitleDescriptionUnchecked(); @Keep + public static void displayToastMsg(final String text, final boolean long_length) + { + final int length = long_length ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT; + new Handler(Looper.getMainLooper()) + .post(() -> Toast.makeText(DolphinApplication.getAppContext(), text, length).show()); + } + + @Keep public static boolean displayAlertMsg(final String caption, final String text, final boolean yesNo, final boolean isWarning, final boolean nonBlocking) { @@ -466,9 +474,7 @@ public final class NativeLibrary // and are allowed to block. As a fallback, we can use toasts. if (emulationActivity == null || nonBlocking) { - new Handler(Looper.getMainLooper()).post( - () -> Toast.makeText(DolphinApplication.getAppContext(), text, Toast.LENGTH_LONG) - .show()); + displayToastMsg(text, true); } else { |
