android: Convert DirectoryStateReceiver to Kotlin

master
Charles Lombardo 2023-03-11 00:36:19 +07:00 committed by bunnei
parent a8994a57d6
commit 711aedeaae
2 changed files with 15 additions and 22 deletions

@ -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<DirectoryInitializationState> callback;
public DirectoryStateReceiver(Action1<DirectoryInitializationState> callback) {
this.callback = callback;
}
@Override
public void onReceive(Context context, Intent intent) {
DirectoryInitializationState state = (DirectoryInitializationState) intent
.getSerializableExtra(DirectoryInitialization.EXTRA_STATE);
callback.call(state);
}
}

@ -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)
}
}