mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 01:15:29 +03:00
Show dialog before deleting save
This commit is contained in:
parent
92c6eecfc8
commit
c57d572936
@ -17,6 +17,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
@ -132,9 +133,17 @@ class AppDialog : BottomSheetDialogFragment() {
|
|||||||
|
|
||||||
binding.deleteSave.isEnabled = saveExists
|
binding.deleteSave.isEnabled = saveExists
|
||||||
binding.deleteSave.setOnClickListener {
|
binding.deleteSave.setOnClickListener {
|
||||||
File(saveFolderPath).deleteRecursively()
|
AlertDialog.Builder(requireContext())
|
||||||
binding.deleteSave.isEnabled = false
|
.setTitle("Are you sure you want to delete this save?")
|
||||||
binding.exportSave.isEnabled = false
|
.setMessage("This action is irreversible.")
|
||||||
|
.setPositiveButton("Yes") { dialogInterface, _ ->
|
||||||
|
File(saveFolderPath).deleteRecursively()
|
||||||
|
binding.deleteSave.isEnabled = false
|
||||||
|
binding.exportSave.isEnabled = false
|
||||||
|
dialogInterface.dismiss()
|
||||||
|
}.setNegativeButton("No") { dialogInterface, _ ->
|
||||||
|
dialogInterface.cancel()
|
||||||
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.importSave.setOnClickListener {
|
binding.importSave.setOnClickListener {
|
||||||
|
Loading…
Reference in New Issue
Block a user