yuzu-emu
/
yuzu
Archived
1
0
Fork 0

android: Convert DirectoryStateReceiver to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-11 00:36:19 -05:00 committed by bunnei
parent a8994a57d6
commit 711aedeaae
2 changed files with 15 additions and 22 deletions

View File

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

View File

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