Use `showErrorToast`

This commit is contained in:
Naveen 2022-07-17 11:46:08 +05:30
parent 9643dbea28
commit e73117b872
1 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,6 @@ import android.view.inputmethod.EditorInfo
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.LinearLayout.LayoutParams import android.widget.LinearLayout.LayoutParams
import android.widget.RelativeLayout import android.widget.RelativeLayout
import android.widget.Toast
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -742,7 +741,7 @@ class ThreadActivity : SimpleActivity() {
try { try {
startActivityForResult(this, PICK_ATTACHMENT_INTENT) startActivityForResult(this, PICK_ATTACHMENT_INTENT)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
toast(R.string.no_app_found) showErrorToast(getString(R.string.no_app_found))
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} }
@ -847,7 +846,7 @@ class ThreadActivity : SimpleActivity() {
private fun sendMessage() { private fun sendMessage() {
var msg = thread_type_message.value var msg = thread_type_message.value
if (msg.isEmpty() && attachmentSelections.isEmpty()) { if (msg.isEmpty() && attachmentSelections.isEmpty()) {
toast(R.string.unknown_error_occurred, length = Toast.LENGTH_LONG) showErrorToast(getString(R.string.unknown_error_occurred))
return return
} }
@ -881,7 +880,7 @@ class ThreadActivity : SimpleActivity() {
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} catch (e: Error) { } catch (e: Error) {
toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred), length = Toast.LENGTH_LONG) showErrorToast(e.localizedMessage ?: getString(R.string.unknown_error_occurred))
} }
} }
} }
@ -906,7 +905,7 @@ class ThreadActivity : SimpleActivity() {
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} catch (e: Error) { } catch (e: Error) {
toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred), length = Toast.LENGTH_LONG) showErrorToast(e.localizedMessage ?: getString(R.string.unknown_error_occurred))
} }
} }
@ -1010,7 +1009,7 @@ class ThreadActivity : SimpleActivity() {
action = Intent.ACTION_VIEW action = Intent.ACTION_VIEW
putExtra(CONTACT_ID, contact.rawId) putExtra(CONTACT_ID, contact.rawId)
putExtra(IS_PRIVATE, true) putExtra(IS_PRIVATE, true)
`package` = if (isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug setPackage(if (isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug)
setDataAndType(ContactsContract.Contacts.CONTENT_LOOKUP_URI, "vnd.android.cursor.dir/person") setDataAndType(ContactsContract.Contacts.CONTENT_LOOKUP_URI, "vnd.android.cursor.dir/person")
launchActivityIntent(this) launchActivityIntent(this)
} }
@ -1036,7 +1035,7 @@ class ThreadActivity : SimpleActivity() {
try { try {
startActivityForResult(this, PICK_SAVE_FILE_INTENT) startActivityForResult(this, PICK_SAVE_FILE_INTENT)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
toast(R.string.system_service_disabled, Toast.LENGTH_LONG) showErrorToast(getString(R.string.system_service_disabled))
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
} }