mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 21:45:42 +03:00
ConversationItem: theme unread message bubbles
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
4de7d06e8e
commit
3283e5b4f6
2 changed files with 21 additions and 15 deletions
|
@ -168,29 +168,18 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
|
|||
int lightBubbleTextColor = ContextCompat.getColor(
|
||||
context,
|
||||
R.color.conversation_unread_bubble_text);
|
||||
ColorStateList lightBubbleStrokeColor = ColorStateList.valueOf(
|
||||
ContextCompat.getColor(context,
|
||||
R.color.colorPrimary));
|
||||
|
||||
if (conversation.getType() == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
|
||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||
} else if (conversation.getUnreadMention()) {
|
||||
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "direct-mention-flag")) {
|
||||
if (conversation.getUnreadMentionDirect()) {
|
||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||
} else {
|
||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.bg_default);
|
||||
holder.binding.dialogUnreadBubble.setTextColor(ContextCompat.getColor(
|
||||
context,
|
||||
R.color.colorPrimary));
|
||||
holder.binding.dialogUnreadBubble.setChipStrokeWidth(6.0f);
|
||||
holder.binding.dialogUnreadBubble.setChipStrokeColor(lightBubbleStrokeColor);
|
||||
viewThemeUtils.colorChipOutlined(holder.binding.dialogUnreadBubble, 6.0f);
|
||||
}
|
||||
} else {
|
||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||
}
|
||||
} else {
|
||||
holder.binding.dialogUnreadBubble.setChipBackgroundColor(lightBubbleFillColor);
|
||||
|
|
|
@ -37,6 +37,7 @@ import androidx.core.view.children
|
|||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
|
@ -219,6 +220,22 @@ class ViewThemeUtils @Inject constructor(val theme: ServerTheme) {
|
|||
return drawable
|
||||
}
|
||||
|
||||
fun colorChipBackground(chip: Chip) {
|
||||
withElementColor(chip) { color ->
|
||||
chip.chipBackgroundColor = ColorStateList.valueOf(color)
|
||||
chip.setTextColor(theme.colorText)
|
||||
}
|
||||
}
|
||||
|
||||
fun colorChipOutlined(chip: Chip, strokeWidth: Float) {
|
||||
withElementColor(chip) { color ->
|
||||
chip.chipBackgroundColor = ColorStateList.valueOf(Color.TRANSPARENT)
|
||||
chip.chipStrokeWidth = strokeWidth
|
||||
chip.chipStrokeColor = ColorStateList.valueOf(color)
|
||||
chip.setTextColor(color)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
|
||||
R.drawable.ic_mimetype_package_x_generic,
|
||||
|
|
Loading…
Reference in a new issue