mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-12-18 06:32:08 +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(
|
int lightBubbleTextColor = ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
R.color.conversation_unread_bubble_text);
|
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) {
|
if (conversation.getType() == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
|
||||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
|
||||||
} else if (conversation.getUnreadMention()) {
|
} else if (conversation.getUnreadMention()) {
|
||||||
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "direct-mention-flag")) {
|
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "direct-mention-flag")) {
|
||||||
if (conversation.getUnreadMentionDirect()) {
|
if (conversation.getUnreadMentionDirect()) {
|
||||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
|
||||||
} else {
|
} else {
|
||||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.bg_default);
|
viewThemeUtils.colorChipOutlined(holder.binding.dialogUnreadBubble, 6.0f);
|
||||||
holder.binding.dialogUnreadBubble.setTextColor(ContextCompat.getColor(
|
|
||||||
context,
|
|
||||||
R.color.colorPrimary));
|
|
||||||
holder.binding.dialogUnreadBubble.setChipStrokeWidth(6.0f);
|
|
||||||
holder.binding.dialogUnreadBubble.setChipStrokeColor(lightBubbleStrokeColor);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.binding.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
viewThemeUtils.colorChipBackground(holder.binding.dialogUnreadBubble);
|
||||||
holder.binding.dialogUnreadBubble.setTextColor(Color.WHITE);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.binding.dialogUnreadBubble.setChipBackgroundColor(lightBubbleFillColor);
|
holder.binding.dialogUnreadBubble.setChipBackgroundColor(lightBubbleFillColor);
|
||||||
|
|
|
@ -37,6 +37,7 @@ import androidx.core.view.children
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.card.MaterialCardView
|
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.floatingactionbutton.FloatingActionButton
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
|
@ -219,6 +220,22 @@ class ViewThemeUtils @Inject constructor(val theme: ServerTheme) {
|
||||||
return drawable
|
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 {
|
companion object {
|
||||||
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
|
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
|
||||||
R.drawable.ic_mimetype_package_x_generic,
|
R.drawable.ic_mimetype_package_x_generic,
|
||||||
|
|
Loading…
Reference in a new issue