Merge branch 'SimpleMobileTools:master' into feature_attachments

This commit is contained in:
Naveen 2022-11-02 18:14:05 +05:30
commit d202c3b172
39 changed files with 264 additions and 137 deletions

View file

@ -492,6 +492,7 @@ class MainActivity : SimpleActivity() {
private fun checkWhatsNewDialog() {
arrayListOf<Release>().apply {
add(Release(48, R.string.release_48))
add(Release(62, R.string.release_62))
checkWhatsNew(this, BuildConfig.VERSION_CODE)
}
}

View file

@ -224,7 +224,9 @@ class ThreadActivity : SimpleActivity() {
val data = resultData?.data
when (requestCode) {
CAPTURE_PHOTO_INTENT -> addAttachment(capturedImageUri!!)
CAPTURE_PHOTO_INTENT -> if (capturedImageUri != null) {
addAttachment(capturedImageUri!!)
}
CAPTURE_VIDEO_INTENT -> if (data != null) {
addAttachment(data)
}
@ -246,15 +248,6 @@ class ThreadActivity : SimpleActivity() {
}
}
private fun onHomePressed() {
hideKeyboard()
Intent(this, MainActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(this)
}
finish()
}
private fun setupCachedMessages(callback: () -> Unit) {
ensureBackgroundThread {
messages = try {
@ -623,7 +616,11 @@ class ThreadActivity : SimpleActivity() {
}
thread_select_sim_number.setTextColor(getProperTextColor().getContrastColor())
thread_select_sim_number.text = (availableSIMCards[currentSIMCardIndex].id).toString()
try {
thread_select_sim_number.text = (availableSIMCards[currentSIMCardIndex].id).toString()
} catch (e: Exception) {
showErrorToast(e)
}
}
}

View file

@ -301,6 +301,7 @@ class ConversationsAdapter(
draft_indicator.setTextColor(properPrimaryColor)
pin_indicator.beVisibleIf(activity.config.pinnedConversations.contains(conversation.threadId.toString()))
pin_indicator.applyColorFilter(textColor)
conversation_frame.isSelected = selectedKeys.contains(conversation.hashCode())

View file

@ -376,7 +376,11 @@ class ThreadAdapter(
builder.override(attachment.width, attachment.height)
}
builder.into(imageView.attachment_image)
try {
builder.into(imageView.attachment_image)
} catch (ignore: Exception) {
}
imageView.attachment_image.setOnClickListener {
if (actModeCallback.isSelectable) {
holder.viewClicked(message)

View file

@ -39,21 +39,21 @@ class DirectReplyReceiver : BroadcastReceiver() {
val transaction = Transaction(context, settings)
val message = com.klinker.android.send_message.Message(msg, address)
try {
val smsSentIntent = Intent(context, SmsStatusSentReceiver::class.java)
val deliveredIntent = Intent(context, SmsStatusDeliveredReceiver::class.java)
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
transaction.sendNewMessage(message)
} catch (e: Exception) {
context.showErrorToast(e)
}
context.notificationManager.cancel(threadId.hashCode())
ensureBackgroundThread {
try {
val smsSentIntent = Intent(context, SmsStatusSentReceiver::class.java)
val deliveredIntent = Intent(context, SmsStatusDeliveredReceiver::class.java)
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
transaction.sendNewMessage(message)
} catch (e: Exception) {
context.showErrorToast(e)
}
context.notificationManager.cancel(threadId.hashCode())
context.markThreadMessagesRead(threadId)
context.conversationsDB.markRead(threadId)
}