default role color if not provided

fixes sk22#430
This commit is contained in:
sk 2023-02-16 16:42:47 +01:00
parent a00ca599c1
commit c05d0b600e
2 changed files with 5 additions and 3 deletions

View File

@ -489,8 +489,10 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
for (Account.Role role : account.roles) {
TextView roleText = new TextView(getActivity(), null, 0, R.style.role_label);
roleText.setText(role.name);
GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
bg.setStroke(V.dp(2), Color.parseColor(role.color));
if (!TextUtils.isEmpty(role.color) && role.color.startsWith("#")) try {
GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
bg.setStroke(V.dp(2), Color.parseColor(role.color));
} catch (Exception ignored) {}
rolesView.addView(roleText);
}
}

View File

@ -4,5 +4,5 @@
android:shape="rectangle">
<corners android:radius="4sp" />
<solid android:color="?colorBackgroundLight" />
<stroke android:width="2dp" android:color="#00ff00" />
<stroke android:width="2dp" android:color="?android:colorAccent" />
</shape>