Make sure nav drawable is mutable before tinting

This commit is contained in:
Moxie Marlinspike 2017-11-13 14:55:40 -08:00
parent 99ea6f9812
commit 40caf20188

View File

@ -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);