Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2eea4d3 authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

AppOps: Guard against themes without colorAccent defined

If an applied theme omits the colorAccent attribute in their style
AppOpsSummary will crash because typedValue.resourceId is 0.

Check if typedValue.resourceId is 0 and if so use switch_accent_color
for tab indicator color.

Change-Id: Ib294fcdfd3bf3510aeb0d0f612bd5f46354e0b15
TICKET: CYNGNOS-2156
parent c9e29de3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -153,7 +153,9 @@ public class AppOpsSummary extends InstrumentedFragment {
        Resources.Theme theme = tabs.getContext().getTheme();
        TypedValue typedValue = new TypedValue();
        theme.resolveAttribute(android.R.attr.colorAccent, typedValue, true);
        final int colorAccent = getContext().getColor(typedValue.resourceId);
        final int colorAccent = typedValue.resourceId != 0
                ? getContext().getColor(typedValue.resourceId)
                : getContext().getColor(R.color.switch_accent_color);
        tabs.setTabIndicatorColor(colorAccent);

        // We have to do this now because PreferenceFrameLayout looks at it