Fixing bug where icon could be the wrong color

Without mutating icon could be the wrong color after theme change
This commit is contained in:
anthony restaino 2017-06-04 21:24:41 -04:00
parent 652daa2c3c
commit 5f222e2d5b

View File

@ -131,11 +131,17 @@ public class ReadingActivity extends AppCompatActivity {
getMenuInflater().inflate(R.menu.reading, menu); getMenuInflater().inflate(R.menu.reading, menu);
MenuItem invert = menu.findItem(R.id.invert_item); MenuItem invert = menu.findItem(R.id.invert_item);
MenuItem textSize = menu.findItem(R.id.text_size_item); MenuItem textSize = menu.findItem(R.id.text_size_item);
int iconColor = mInvert ? ThemeUtils.getIconDarkThemeColor(this) : ThemeUtils.getIconLightThemeColor(this);
if (invert != null && invert.getIcon() != null) int iconColor = ThemeUtils.getIconThemeColor(this, mInvert);
invert.getIcon().setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
if (textSize != null && textSize.getIcon() != null) if (invert != null && invert.getIcon() != null) {
textSize.getIcon().setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); invert.getIcon().mutate().setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
if (textSize != null && textSize.getIcon() != null) {
textSize.getIcon().mutate().setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }