Browse Source
Merge pull request #13052 from t895/serializable-stuff
Merge pull request #13052 from t895/serializable-stuff
android: Move CoreErrorDialogFragment to its own filepull/15/merge
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 53 additions and 42 deletions
-
48src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
-
47src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/CoreErrorDialogFragment.kt
@ -0,0 +1,47 @@ |
|||
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
package org.yuzu.yuzu_emu.fragments |
|||
|
|||
import android.app.Dialog |
|||
import android.content.DialogInterface |
|||
import android.os.Bundle |
|||
import androidx.fragment.app.DialogFragment |
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder |
|||
import org.yuzu.yuzu_emu.NativeLibrary |
|||
import org.yuzu.yuzu_emu.R |
|||
|
|||
class CoreErrorDialogFragment : DialogFragment() { |
|||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = |
|||
MaterialAlertDialogBuilder(requireActivity()) |
|||
.setTitle(requireArguments().getString(TITLE)) |
|||
.setMessage(requireArguments().getString(MESSAGE)) |
|||
.setPositiveButton(R.string.continue_button, null) |
|||
.setNegativeButton(R.string.abort_button) { _: DialogInterface?, _: Int -> |
|||
NativeLibrary.coreErrorAlertResult = false |
|||
synchronized(NativeLibrary.coreErrorAlertLock) { |
|||
NativeLibrary.coreErrorAlertLock.notify() |
|||
} |
|||
} |
|||
.create() |
|||
|
|||
override fun onDismiss(dialog: DialogInterface) { |
|||
super.onDismiss(dialog) |
|||
NativeLibrary.coreErrorAlertResult = true |
|||
synchronized(NativeLibrary.coreErrorAlertLock) { NativeLibrary.coreErrorAlertLock.notify() } |
|||
} |
|||
|
|||
companion object { |
|||
const val TITLE = "Title" |
|||
const val MESSAGE = "Message" |
|||
|
|||
fun newInstance(title: String, message: String): CoreErrorDialogFragment { |
|||
val frag = CoreErrorDialogFragment() |
|||
val args = Bundle() |
|||
args.putString(TITLE, title) |
|||
args.putString(MESSAGE, message) |
|||
frag.arguments = args |
|||
return frag |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue