forked from mirror/monocles_chat
improve background for colored nick names
This commit is contained in:
parent
6298e218f3
commit
a869d634f7
2 changed files with 21 additions and 1 deletions
|
@ -298,7 +298,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
final int shadowSize = 10;
|
||||
viewHolder.username.setVisibility(View.VISIBLE);
|
||||
viewHolder.username.setText(UIHelper.getColoredUsername(activity.xmppConnectionService, message));
|
||||
if (activity.xmppConnectionService.colored_muc_names()) {
|
||||
if (activity.xmppConnectionService.colored_muc_names() && ThemeHelper.showColoredUsernameBackGround(activity, darkBackground)) {
|
||||
viewHolder.username.setPadding(4, 2, 4, 2);
|
||||
viewHolder.username.setBackground(ContextCompat.getDrawable(activity, R.drawable.duration_background));
|
||||
}
|
||||
|
|
|
@ -540,4 +540,24 @@ public class ThemeHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean showColoredUsernameBackGround(Context context, boolean dark) {
|
||||
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final Resources resources = context.getResources();
|
||||
final String themeColor = sharedPreferences.getString("theme_color", resources.getString(R.string.theme_color));
|
||||
switch (themeColor) {
|
||||
case "blue":
|
||||
return dark ? false : false;
|
||||
case "blabber":
|
||||
return dark ? true : false;
|
||||
case "orange":
|
||||
return dark ? true : false;
|
||||
case "grey":
|
||||
return dark ? false : false;
|
||||
case "pink":
|
||||
return dark ? true : false;
|
||||
default:
|
||||
return dark ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue