Skip to content

Commit

Permalink
Disable closing dialog on touch outside
Browse files Browse the repository at this point in the history
  • Loading branch information
shubertm committed Jan 9, 2024
1 parent 3908b60 commit fe144f4
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.arkbuilders.arkmemo.ui.dialogs

import android.Manifest
import android.content.DialogInterface
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Environment
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -23,21 +23,17 @@ class FilePickerDialog: ArkFilePickerFragment() {

@Inject lateinit var memoPreferences: MemoPreferences

override fun dismiss() {
super.dismiss()
checkStorage()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (storageNotAvailable()) { isCancelable = false }
}

override fun onCancel(dialog: DialogInterface) {
super.onCancel(dialog)
checkStorage()
override fun dismiss() {
super.dismiss()
if (storageNotAvailable()) { activity?.finish() }
}

private fun checkStorage() {
if (memoPreferences.getPath().isEmpty()) {
activity?.finish()
}
}
private fun storageNotAvailable(): Boolean = memoPreferences.getPath().isEmpty()

companion object{

Expand Down

0 comments on commit fe144f4

Please sign in to comment.