default role color if not provided
fixes sk22#430
This commit is contained in:
@@ -489,8 +489,10 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
|||||||
for (Account.Role role : account.roles) {
|
for (Account.Role role : account.roles) {
|
||||||
TextView roleText = new TextView(getActivity(), null, 0, R.style.role_label);
|
TextView roleText = new TextView(getActivity(), null, 0, R.style.role_label);
|
||||||
roleText.setText(role.name);
|
roleText.setText(role.name);
|
||||||
|
if (!TextUtils.isEmpty(role.color) && role.color.startsWith("#")) try {
|
||||||
GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
|
GradientDrawable bg = (GradientDrawable) roleText.getBackground().mutate();
|
||||||
bg.setStroke(V.dp(2), Color.parseColor(role.color));
|
bg.setStroke(V.dp(2), Color.parseColor(role.color));
|
||||||
|
} catch (Exception ignored) {}
|
||||||
rolesView.addView(roleText);
|
rolesView.addView(roleText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<corners android:radius="4sp" />
|
<corners android:radius="4sp" />
|
||||||
<solid android:color="?colorBackgroundLight" />
|
<solid android:color="?colorBackgroundLight" />
|
||||||
<stroke android:width="2dp" android:color="#00ff00" />
|
<stroke android:width="2dp" android:color="?android:colorAccent" />
|
||||||
</shape>
|
</shape>
|
||||||
Reference in New Issue
Block a user