mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Use animated timer in control message
This commit is contained in:
parent
e3011c52c2
commit
1b5b7cfccc
@ -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;
|
||||
|
@ -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 -> {
|
||||
|
@ -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()
|
||||
}
|
||||
} else {
|
||||
expirationTimerView.setPercentComplete(0.0f)
|
||||
expirationTimerView.stopAnimation()
|
||||
|
Loading…
Reference in New Issue
Block a user