From 49d08d1af01c515255ea110d8681c90d161e82f0 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Fri, 11 Sep 2020 09:49:32 +1000 Subject: [PATCH] Fix invisible disappearing messages icon --- res/layout/expiration_timer_menu.xml | 15 ++++++++------- .../conversation/ConversationActivity.java | 14 ++++++++++---- .../conversation/ConversationUpdateItem.java | 12 ++++++++---- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/res/layout/expiration_timer_menu.xml b/res/layout/expiration_timer_menu.xml index 4e146fea64..b281a5afca 100644 --- a/res/layout/expiration_timer_menu.xml +++ b/res/layout/expiration_timer_menu.xml @@ -1,11 +1,12 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + style="?android:attr/actionButtonStyle" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clickable="true" + android:focusable="true" + android:gravity="center"> \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 40ca0e4391..318a863313 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -30,6 +30,8 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.hardware.Camera; import android.net.Uri; import android.os.AsyncTask; @@ -61,6 +63,7 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; @@ -158,6 +161,7 @@ import org.thoughtcrime.securesms.loki.database.LokiThreadDatabaseDelegate; import org.thoughtcrime.securesms.loki.database.LokiUserDatabase; import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol; import org.thoughtcrime.securesms.loki.protocol.SessionManagementProtocol; +import org.thoughtcrime.securesms.loki.utilities.GeneralUtilitiesKt; import org.thoughtcrime.securesms.loki.utilities.MentionManagerUtilities; import org.thoughtcrime.securesms.loki.views.MentionCandidateSelectionView; import org.thoughtcrime.securesms.loki.views.ProfilePictureView; @@ -235,7 +239,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -737,10 +740,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity if (recipient.getExpireMessages() > 0) { inflater.inflate(R.menu.conversation_expiring_on, menu); - final MenuItem item = menu.findItem(R.id.menu_expiring_messages); - final View actionView = MenuItemCompat.getActionView(item); - final TextView badgeView = actionView.findViewById(R.id.expiration_badge); + final MenuItem item = menu.findItem(R.id.menu_expiring_messages); + final View actionView = MenuItemCompat.getActionView(item); + final ImageView iconView = actionView.findViewById(R.id.menu_badge_icon); + final TextView badgeView = actionView.findViewById(R.id.expiration_badge); + @ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getTheme()); + iconView.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); badgeView.setText(ExpirationUtil.getExpirationAbbreviatedDisplayValue(this, recipient.getExpireMessages())); actionView.setOnClickListener(v -> onOptionsItemSelected(item)); } else { diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java b/src/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java index b7e61d34b8..39a4212909 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java @@ -5,14 +5,16 @@ import android.content.Intent; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.thoughtcrime.securesms.BindableConversationItem; import org.thoughtcrime.securesms.VerifyIdentityActivity; import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable; @@ -20,6 +22,7 @@ import org.thoughtcrime.securesms.database.IdentityDatabase; import org.thoughtcrime.securesms.database.IdentityDatabase.IdentityRecord; import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.logging.Log; +import org.thoughtcrime.securesms.loki.utilities.GeneralUtilitiesKt; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientModifiedListener; @@ -135,12 +138,13 @@ public class ConversationUpdateItem extends LinearLayout } private void setTimerRecord(final MessageRecord messageRecord) { + @ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getContext().getTheme()); if (messageRecord.getExpiresIn() > 0) { icon.setImageResource(R.drawable.ic_timer); - icon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY)); + icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); } else { icon.setImageResource(R.drawable.ic_timer_disabled); - icon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY)); + icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); } title.setText(ExpirationUtil.getExpirationDisplayValue(getContext(), (int)(messageRecord.getExpiresIn() / 1000)));