android: Convert DirectoryStateReceiver to Kotlin
This commit is contained in:
parent
a8994a57d6
commit
711aedeaae
|
@ -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)
|
||||
}
|
||||
}
|
Reference in New Issue