From 711aedeaae8c7652c7e8707bc32eb28e8fb82c77 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 11 Mar 2023 00:36:19 -0500 Subject: [PATCH] android: Convert DirectoryStateReceiver to Kotlin --- .../utils/DirectoryStateReceiver.java | 22 ------------------- .../yuzu_emu/utils/DirectoryStateReceiver.kt | 15 +++++++++++++ 2 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.java create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.kt diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.java deleted file mode 100644 index 62c9b018ad..0000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.yuzu.yuzu_emu.utils; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState; - -public class DirectoryStateReceiver extends BroadcastReceiver { - Action1 callback; - - public DirectoryStateReceiver(Action1 callback) { - this.callback = callback; - } - - @Override - public void onReceive(Context context, Intent intent) { - DirectoryInitializationState state = (DirectoryInitializationState) intent - .getSerializableExtra(DirectoryInitialization.EXTRA_STATE); - callback.call(state); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.kt new file mode 100644 index 0000000000..20906941a9 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryStateReceiver.kt @@ -0,0 +1,15 @@ +package org.yuzu.yuzu_emu.utils + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState + +class DirectoryStateReceiver(var callback: (DirectoryInitializationState) -> Unit) : + BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + val state = intent + .getSerializableExtra(DirectoryInitialization.EXTRA_STATE) as DirectoryInitializationState + callback.invoke(state) + } +}