Fix disappearing off icon

This commit is contained in:
andrew 2023-11-10 13:26:30 +10:30
parent a312ef2b25
commit 806cb216ae
2 changed files with 5 additions and 3 deletions

View File

@ -31,6 +31,11 @@ class ExpirationTimerView @JvmOverloads constructor(
) )
fun setExpirationTime(startedAt: Long, expiresIn: Long) { fun setExpirationTime(startedAt: Long, expiresIn: Long) {
if (expiresIn == 0L) {
setImageResource(R.drawable.timer55)
return
}
val elapsedTime = nowWithOffset - startedAt val elapsedTime = nowWithOffset - startedAt
val remainingTime = expiresIn - elapsedTime val remainingTime = expiresIn - elapsedTime
val remainingPercent = (remainingTime / expiresIn.toFloat()).coerceIn(0f, 1f) val remainingPercent = (remainingTime / expiresIn.toFloat()).coerceIn(0f, 1f)

View File

@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.conversation.v2.messages
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.core.view.isGone import androidx.core.view.isGone
@ -11,8 +10,6 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import network.loki.messenger.R import network.loki.messenger.R
import network.loki.messenger.databinding.ViewControlMessageBinding 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 import org.thoughtcrime.securesms.database.model.MessageRecord
class ControlMessageView : LinearLayout { class ControlMessageView : LinearLayout {