refresh the conversation manually in 2 seconds, if nothing happens meanwhile
This commit is contained in:
parent
a100ddb290
commit
659b9c59a5
|
@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable
|
||||||
import android.media.MediaMetadataRetriever
|
import android.media.MediaMetadataRetriever
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
import android.provider.Telephony
|
import android.provider.Telephony
|
||||||
import android.telephony.SubscriptionManager
|
import android.telephony.SubscriptionManager
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
@ -56,6 +57,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
private var threadId = 0L
|
private var threadId = 0L
|
||||||
private var currentSIMCardIndex = 0
|
private var currentSIMCardIndex = 0
|
||||||
private var isActivityVisible = false
|
private var isActivityVisible = false
|
||||||
|
private var refreshedSinceSent = false
|
||||||
private var threadItems = ArrayList<ThreadItem>()
|
private var threadItems = ArrayList<ThreadItem>()
|
||||||
private var bus: EventBus? = null
|
private var bus: EventBus? = null
|
||||||
private var participants = ArrayList<SimpleContact>()
|
private var participants = ArrayList<SimpleContact>()
|
||||||
|
@ -660,11 +662,18 @@ class ThreadActivity : SimpleActivity() {
|
||||||
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
|
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
|
||||||
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
|
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
|
||||||
|
|
||||||
|
refreshedSinceSent = false
|
||||||
transaction.sendNewMessage(message, threadId)
|
transaction.sendNewMessage(message, threadId)
|
||||||
thread_type_message.setText("")
|
thread_type_message.setText("")
|
||||||
attachmentUris.clear()
|
attachmentUris.clear()
|
||||||
thread_attachments_holder.beGone()
|
thread_attachments_holder.beGone()
|
||||||
thread_attachments_wrapper.removeAllViews()
|
thread_attachments_wrapper.removeAllViews()
|
||||||
|
|
||||||
|
Handler().postDelayed({
|
||||||
|
if (!refreshedSinceSent) {
|
||||||
|
refreshMessages()
|
||||||
|
}
|
||||||
|
}, 2000)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
} catch (e: Error) {
|
} catch (e: Error) {
|
||||||
|
@ -729,6 +738,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
@Subscribe(threadMode = ThreadMode.ASYNC)
|
@Subscribe(threadMode = ThreadMode.ASYNC)
|
||||||
fun refreshMessages(event: Events.RefreshMessages) {
|
fun refreshMessages(event: Events.RefreshMessages) {
|
||||||
|
refreshedSinceSent = true
|
||||||
if (isActivityVisible) {
|
if (isActivityVisible) {
|
||||||
notificationManager.cancel(threadId.hashCode())
|
notificationManager.cancel(threadId.hashCode())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue