Merge pull request #307 from FossifyOrg/remove_unused_instantiation
Remove unnecessary intent creation
This commit is contained in:
commit
f735763c21
1 changed files with 16 additions and 28 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
package org.fossify.messages.activities
|
package org.fossify.messages.activities
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
|
@ -122,11 +121,7 @@ class ManageBlockedKeywordsActivity : SimpleActivity(), RefreshRecyclerViewListe
|
||||||
|
|
||||||
private fun tryImportBlockedKeywords() {
|
private fun tryImportBlockedKeywords() {
|
||||||
if (isQPlus()) {
|
if (isQPlus()) {
|
||||||
Intent(Intent.ACTION_GET_CONTENT).apply {
|
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
|
||||||
val mimeType = "text/plain"
|
val mimeType = "text/plain"
|
||||||
type = mimeType
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
importActivityResultLauncher.launch(mimeType)
|
importActivityResultLauncher.launch(mimeType)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
|
@ -134,7 +129,6 @@ class ManageBlockedKeywordsActivity : SimpleActivity(), RefreshRecyclerViewListe
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
handlePermission(PERMISSION_READ_STORAGE) { isAllowed ->
|
handlePermission(PERMISSION_READ_STORAGE) { isAllowed ->
|
||||||
if (isAllowed) {
|
if (isAllowed) {
|
||||||
|
|
@ -208,11 +202,6 @@ 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 {
|
|
||||||
type = "text/plain"
|
|
||||||
putExtra(Intent.EXTRA_TITLE, file.name)
|
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
exportActivityResultLauncher.launch(file.name)
|
exportActivityResultLauncher.launch(file.name)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
|
@ -224,7 +213,6 @@ class ManageBlockedKeywordsActivity : SimpleActivity(), RefreshRecyclerViewListe
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) { isAllowed ->
|
handlePermission(PERMISSION_WRITE_STORAGE) { isAllowed ->
|
||||||
if (isAllowed) {
|
if (isAllowed) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue