mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Username search UI tweak.
This commit is contained in:
committed by
Greyson Parrelli
parent
d458ddba55
commit
993e49db48
@@ -24,7 +24,8 @@ public enum AvatarColor {
|
||||
A190("A190", 0xFFEAE6D5),
|
||||
A200("A200", 0xFFD2D2DC),
|
||||
A210("A210", 0xFFD7D7D9),
|
||||
UNKNOWN("UNKNOWN", 0x00000000);
|
||||
UNKNOWN("UNKNOWN", 0x00000000),
|
||||
ON_SURFACE_VARIANT("ON_SURFACE_VARIANT", 0x00000000);
|
||||
|
||||
/** Fast map of name to enum, while also giving us a location to map old colors to new ones. */
|
||||
private static final Map<String, AvatarColor> NAME_MAP = new HashMap<>();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.thoughtcrime.securesms.conversation.colors
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.avatar.Avatars
|
||||
|
||||
class AvatarColorPair private constructor(
|
||||
@ColorInt val foregroundColor: Int,
|
||||
@ColorInt val backgroundColor: Int
|
||||
) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun create(context: Context, avatarColor: AvatarColor): AvatarColorPair {
|
||||
return when (avatarColor) {
|
||||
AvatarColor.UNKNOWN -> AvatarColorPair(
|
||||
foregroundColor = ContextCompat.getColor(context, R.color.signal_colorOnSurface),
|
||||
backgroundColor = ContextCompat.getColor(context, R.color.signal_colorSurfaceVariant)
|
||||
)
|
||||
AvatarColor.ON_SURFACE_VARIANT -> AvatarColorPair(
|
||||
foregroundColor = ContextCompat.getColor(context, R.color.signal_colorOnSurfaceVariant),
|
||||
backgroundColor = ContextCompat.getColor(context, R.color.signal_colorSurfaceVariant)
|
||||
)
|
||||
else -> AvatarColorPair(
|
||||
foregroundColor = Avatars.getForegroundColor(avatarColor).colorInt,
|
||||
backgroundColor = avatarColor.colorInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user