From 40caf20188f7db09b025b7189bde79da987efa3d Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 13 Nov 2017 14:55:40 -0800 Subject: [PATCH] Make sure nav drawable is mutable before tinting --- .../thoughtcrime/securesms/components/SearchToolbar.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/components/SearchToolbar.java b/src/org/thoughtcrime/securesms/components/SearchToolbar.java index a1ef72dc55..c5714bf950 100644 --- a/src/org/thoughtcrime/securesms/components/SearchToolbar.java +++ b/src/org/thoughtcrime/securesms/components/SearchToolbar.java @@ -4,6 +4,7 @@ package org.thoughtcrime.securesms.components; import android.animation.Animator; import android.content.Context; import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.MainThread; import android.support.annotation.Nullable; @@ -40,15 +41,17 @@ public class SearchToolbar extends LinearLayout { initialize(); } - @SuppressWarnings("ConstantConditions") private void initialize() { inflate(getContext(), R.layout.search_toolbar, this); setOrientation(VERTICAL); Toolbar toolbar = findViewById(R.id.toolbar); - toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); - toolbar.getNavigationIcon().setColorFilter(getContext().getResources().getColor(R.color.grey_700), PorterDuff.Mode.SRC_IN); + Drawable drawable = getContext().getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); + drawable.mutate(); + drawable.setColorFilter(getContext().getResources().getColor(R.color.grey_700), PorterDuff.Mode.SRC_IN); + + toolbar.setNavigationIcon(drawable); toolbar.inflateMenu(R.menu.conversation_list_search); this.searchItem = toolbar.getMenu().findItem(R.id.action_filter_search);