This commit is contained in:
tom5079
2020-09-05 12:51:41 +09:00
parent 86d528ba13
commit 081c890b4e
9 changed files with 22 additions and 20 deletions

View File

@@ -146,7 +146,7 @@ class DownloadLocationDialogFragment : DialogFragment() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
context.contentResolver.takePersistableUriPermission(uri, takeFlags)
if (FileX(context, uri).canWrite())
if (kotlin.runCatching { FileX(context, uri).canWrite() }.getOrDefault(false))
Preferences["download_folder"] = uri.toString()
else {
Snackbar.make(

View File

@@ -66,7 +66,7 @@ class ManageFavoritesFragment : PreferenceFragmentCompat() {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, response.body()?.use { it.string() }?.replace("\n", ""))
}.let {
context.startActivity(Intent.createChooser(it, getString(R.string.settings_backup_share)))
getContext()?.startActivity(Intent.createChooser(it, getString(R.string.settings_backup_share)))
}
}
})

View File

@@ -91,7 +91,7 @@ class ManageStorageFragment : PreferenceFragmentCompat(), Preference.OnPreferenc
}
if (dir.exists())
dir.listFiles()?.forEach { (it as FileX).deleteRecursively() }
dir.listFiles()?.forEach { (it as? FileX)?.deleteRecursively() }
job = launch {
var size = 0L