Use animated timer in control message

This commit is contained in:
andrew 2023-10-31 14:18:54 +10:30
parent e3011c52c2
commit 1b5b7cfccc
3 changed files with 8 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import org.session.libsession.utilities.Util;
import org.thoughtcrime.securesms.database.model.MessageRecord;
import java.lang.ref.WeakReference;
import java.util.concurrent.TimeUnit;

View File

@ -9,6 +9,8 @@ import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import network.loki.messenger.R
import network.loki.messenger.databinding.ViewControlMessageBinding
import org.session.libsession.utilities.getColorFromAttr
import org.thoughtcrime.securesms.conversation.v2.components.ExpirationTimerView
import org.thoughtcrime.securesms.database.model.MessageRecord
class ControlMessageView : LinearLayout {
@ -34,9 +36,10 @@ class ControlMessageView : LinearLayout {
binding.root.contentDescription= null
when {
message.isExpirationTimerUpdate -> {
binding.iconImageView.setImageDrawable(
ResourcesCompat.getDrawable(resources, R.drawable.ic_timer, context.theme)
)
ExpirationTimerView(binding.iconImageView, context.getColorFromAttr(android.R.attr.textColorPrimary)).apply {
setExpirationTime(message.expireStarted, message.expiresIn)
startAnimation()
}
binding.iconImageView.visibility = View.VISIBLE
}
message.isMediaSavedNotification -> {

View File

@ -352,9 +352,7 @@ class VisibleMessageView : LinearLayout {
if (message.expireStarted > 0) {
expirationTimerView.setExpirationTime(message.expireStarted, message.expiresIn)
expirationTimerView.startAnimation()
if (message.expireStarted + message.expiresIn <= SnodeAPI.nowWithOffset) {
ApplicationContext.getInstance(context).expiringMessageManager.checkSchedule()
}
ApplicationContext.getInstance(context).expiringMessageManager.checkSchedule()
} else {
expirationTimerView.setPercentComplete(0.0f)
expirationTimerView.stopAnimation()