adding some crashfixes
This commit is contained in:
parent
35bbd27d42
commit
f412f401d3
6 changed files with 16 additions and 9 deletions
|
|
@ -183,7 +183,7 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun getNewConversations(cachedConversations: ArrayList<Conversation>) {
|
||||
val privateCursor = getMyContactsCursor().loadInBackground()
|
||||
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||
val conversations = getConversations(privateContacts = privateContacts)
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class NewConversationActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun fillSuggestedContacts(callback: () -> Unit) {
|
||||
val privateCursor = getMyContactsCursor().loadInBackground()
|
||||
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
|
||||
val suggestions = getSuggestedContacts(privateContacts)
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupThread() {
|
||||
val privateCursor = getMyContactsCursor().loadInBackground()
|
||||
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
messages = getMessages(threadId)
|
||||
participants = if (messages.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,14 @@ class ThreadAdapter(activity: SimpleActivity, var messages: ArrayList<ThreadItem
|
|||
|
||||
private fun askConfirmDelete() {
|
||||
val itemsCnt = selectedKeys.size
|
||||
val items = resources.getQuantityString(R.plurals.delete_messages, itemsCnt, itemsCnt)
|
||||
|
||||
// not sure how we can get UnknownFormatConversionException here, so show the error and hope that someone reports it
|
||||
val items = try {
|
||||
resources.getQuantityString(R.plurals.delete_messages, itemsCnt, itemsCnt)
|
||||
} catch (e: Exception) {
|
||||
activity.showErrorToast(e)
|
||||
return
|
||||
}
|
||||
|
||||
val baseString = R.string.deletion_confirmation
|
||||
val question = String.format(resources.getString(baseString), items)
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ fun Context.getThreadId(addresses: Set<String>): Long {
|
|||
}
|
||||
|
||||
fun Context.showReceivedMessageNotification(address: String, body: String, threadID: Int, bitmap: Bitmap?) {
|
||||
val privateCursor = getMyContactsCursor().loadInBackground()
|
||||
val privateCursor = getMyContactsCursor()?.loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
var sender = getNameAndPhotoFromPhoneNumber(address)?.name ?: ""
|
||||
if (address == sender) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue