Remove unnecessary intent creation
This commit is contained in:
parent
79d4782caf
commit
255cacbfd4
1 changed files with 16 additions and 27 deletions
|
|
@ -122,18 +122,13 @@ class ManageBlockedKeywordsActivity : SimpleActivity(), RefreshRecyclerViewListe
|
||||||
|
|
||||||
private fun tryImportBlockedKeywords() {
|
private fun tryImportBlockedKeywords() {
|
||||||
if (isQPlus()) {
|
if (isQPlus()) {
|
||||||
Intent(Intent.ACTION_GET_CONTENT).apply {
|
val mimeType = "text/plain"
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
try {
|
||||||
val mimeType = "text/plain"
|
importActivityResultLauncher.launch(mimeType)
|
||||||
type = mimeType
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
toast(org.fossify.commons.R.string.system_service_disabled, Toast.LENGTH_LONG)
|
||||||
try {
|
} catch (e: Exception) {
|
||||||
importActivityResultLauncher.launch(mimeType)
|
showErrorToast(e)
|
||||||
} catch (e: ActivityNotFoundException) {
|
|
||||||
toast(org.fossify.commons.R.string.system_service_disabled, Toast.LENGTH_LONG)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
showErrorToast(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handlePermission(PERMISSION_READ_STORAGE) { isAllowed ->
|
handlePermission(PERMISSION_READ_STORAGE) { isAllowed ->
|
||||||
|
|
@ -208,21 +203,15 @@ class ManageBlockedKeywordsActivity : SimpleActivity(), RefreshRecyclerViewListe
|
||||||
private fun tryExportBlockedNumbers() {
|
private fun tryExportBlockedNumbers() {
|
||||||
if (isQPlus()) {
|
if (isQPlus()) {
|
||||||
ExportBlockedKeywordsDialog(this, config.lastBlockedKeywordExportPath, true) { file ->
|
ExportBlockedKeywordsDialog(this, config.lastBlockedKeywordExportPath, true) { file ->
|
||||||
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
try {
|
||||||
type = "text/plain"
|
exportActivityResultLauncher.launch(file.name)
|
||||||
putExtra(Intent.EXTRA_TITLE, file.name)
|
} catch (e: ActivityNotFoundException) {
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
toast(
|
||||||
|
org.fossify.commons.R.string.system_service_disabled,
|
||||||
try {
|
Toast.LENGTH_LONG
|
||||||
exportActivityResultLauncher.launch(file.name)
|
)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: Exception) {
|
||||||
toast(
|
showErrorToast(e)
|
||||||
org.fossify.commons.R.string.system_service_disabled,
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
showErrorToast(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue