From 711aedeaae8c7652c7e8707bc32eb28e8fb82c77 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 11 Mar 2023 00:36:19 -0500 Subject: android: Convert DirectoryStateReceiver to Kotlin --- .../yuzu_emu/utils/DirectoryStateReceiver.java | 22 ---------------------- .../yuzu/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 (limited to 'src') 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 62c9b018a..000000000 --- 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 000000000..20906941a --- /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) + } +} -- cgit v1.2.3