From 806cb216ae18baa3329aaeefb262335070c15361 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 10 Nov 2023 13:26:30 +1030 Subject: [PATCH] Fix disappearing off icon --- .../conversation/v2/components/ExpirationTimerView.kt | 5 +++++ .../securesms/conversation/v2/messages/ControlMessageView.kt | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/components/ExpirationTimerView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/components/ExpirationTimerView.kt index a1d37b0127..087ff85db7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/components/ExpirationTimerView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/components/ExpirationTimerView.kt @@ -31,6 +31,11 @@ class ExpirationTimerView @JvmOverloads constructor( ) fun setExpirationTime(startedAt: Long, expiresIn: Long) { + if (expiresIn == 0L) { + setImageResource(R.drawable.timer55) + return + } + val elapsedTime = nowWithOffset - startedAt val remainingTime = expiresIn - elapsedTime val remainingPercent = (remainingTime / expiresIn.toFloat()).coerceIn(0f, 1f) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt index 6099b7d49a..d3426c7548 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt @@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.conversation.v2.messages import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater -import android.view.View import android.widget.LinearLayout import androidx.core.content.res.ResourcesCompat import androidx.core.view.isGone @@ -11,8 +10,6 @@ import androidx.core.view.isVisible 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 {