adding some crashfixes

This commit is contained in:
tibbi 2020-12-21 11:38:57 +01:00
parent 35bbd27d42
commit f412f401d3
6 changed files with 16 additions and 9 deletions

View File

@ -56,13 +56,13 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.32.5'
implementation 'com.simplemobiletools:commons:5.32.8'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
implementation "me.leolin:ShortcutBadger:1.1.22"
kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-runtime:2.2.5"
annotationProcessor "androidx.room:room-compiler:2.2.5"
kapt "androidx.room:room-compiler:2.2.6"
implementation "androidx.room:room-runtime:2.2.6"
annotationProcessor "androidx.room:room-compiler:2.2.6"
}

View File

@ -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)

View File

@ -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)

View File

@ -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()) {

View File

@ -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)

View File

@ -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) {