fix: NPE in filter tabs view

This commit is contained in:
xtaodada 2023-01-04 22:39:16 +08:00
parent 7a9f6d861f
commit 0c0c717818
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 10 additions and 3 deletions

View File

@ -327,7 +327,7 @@ public class ActionBar extends FrameLayout {
}
}
}
if (NekoConfig.actionBarDecoration.Int() == 3 || !manualStart) {
if (NekoConfig.actionBarDecoration.Int() == 3) {
if (snowflakesEffect != null) {
snowflakesEffect = null;
}
@ -342,6 +342,13 @@ public class ActionBar extends FrameLayout {
if (snowflakesEffect == null) {
snowflakesEffect = new SnowflakesEffect(0);
}
} else if (!manualStart) {
if (snowflakesEffect != null) {
snowflakesEffect = null;
}
if (fireworksEffect != null) {
fireworksEffect = null;
}
}
if (snowflakesEffect != null) {
snowflakesEffect.onDraw(this, canvas);

View File

@ -415,8 +415,8 @@ public class FilterTabsView extends FrameLayout {
android.graphics.Rect bounds = new android.graphics.Rect(0, 0, emoticonSize, emoticonSize);
icon = getResources().getDrawable(FolderIconHelper.getTabIcon(currentTab.emoticon)).mutate();
icon.setBounds(bounds);
icon.setTint(textPaint.getColor());
}
icon.setTint(textPaint.getColor());
iconX = (int) ((getMeasuredWidth() - tabWidth) / 2f);
if (animateIconX) {
iconX = (int) (iconX * changeProgress + animateFromIconX * (1f - changeProgress));
@ -441,7 +441,7 @@ public class FilterTabsView extends FrameLayout {
canvas.restore();
iconAnimateInDrawable.setAlpha(alpha);
}
} else {
} else if (icon != null) {
canvas.save();
canvas.translate(iconX, iconY);
icon.draw(canvas);