User pic placeholder colors tweaks.

Use proper username for settings activity placeholder.
This commit is contained in:
Anton Chekulaev 2020-09-04 00:08:34 +10:00
parent 18c4358d7d
commit 3e82c8f9ea
3 changed files with 7 additions and 10 deletions

View File

@ -108,11 +108,10 @@
<color name="default_background_end">#171717</color> <color name="default_background_end">#171717</color>
<array name="user_pic_placeholder_primary"> <array name="user_pic_placeholder_primary">
<item>#18da80</item> <item>#2bca81</item>
<item>#ee8917</item> <item>#ee7117</item>
<item>#239edf</item> <item>#239edf</item>
<item>#c33fe9</item> <item>#bb35e9</item>
<item>#83b433</item>
</array> </array>
</resources> </resources>

View File

@ -79,7 +79,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
glide = GlideApp.with(this) glide = GlideApp.with(this)
profilePictureView.glide = glide profilePictureView.glide = glide
profilePictureView.publicKey = hexEncodedPublicKey profilePictureView.publicKey = hexEncodedPublicKey
profilePictureView.displayName = displayNameToBeUploaded profilePictureView.displayName = origUserDisplayName
profilePictureView.isLarge = true profilePictureView.isLarge = true
profilePictureView.update() profilePictureView.update()
profilePictureView.setOnClickListener { showEditProfilePictureUI() } profilePictureView.setOnClickListener { showEditProfilePictureUI() }

View File

@ -29,7 +29,7 @@ object AvatarPlaceholderGenerator {
// Do not cache color array, it may be different depends on the current theme. // Do not cache color array, it may be different depends on the current theme.
val colorArray = context.resources.getIntArray(R.array.user_pic_placeholder_primary) val colorArray = context.resources.getIntArray(R.array.user_pic_placeholder_primary)
val colorPrimary = colorArray[(hash % colorArray.size).toInt()] val colorPrimary = colorArray[(hash % colorArray.size).toInt()]
val colorSecondary = changeColorHueBy(colorPrimary, 16f) val colorSecondary = changeColorHueBy(colorPrimary, 12f)
val labelText = when { val labelText = when {
!TextUtils.isEmpty(displayName) -> extractLabel(displayName!!) !TextUtils.isEmpty(displayName) -> extractLabel(displayName!!)
@ -41,8 +41,7 @@ object AvatarPlaceholderGenerator {
val canvas = Canvas(bitmap) val canvas = Canvas(bitmap)
// Draw background/frame // Draw background/frame
val paint = Paint() val paint = Paint(Paint.ANTI_ALIAS_FLAG)
paint.isAntiAlias = true
paint.shader = LinearGradient(0f, 0f, 0f, pixelSize.toFloat(), paint.shader = LinearGradient(0f, 0f, 0f, pixelSize.toFloat(),
colorPrimary, colorPrimary,
colorSecondary, colorSecondary,
@ -50,9 +49,8 @@ object AvatarPlaceholderGenerator {
canvas.drawCircle(pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, paint) canvas.drawCircle(pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, paint)
// Draw text // Draw text
val textPaint = TextPaint() val textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG)
textPaint.typeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL) textPaint.typeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)
textPaint.isAntiAlias = true
textPaint.textSize = pixelSize * 0.5f textPaint.textSize = pixelSize * 0.5f
textPaint.color = Color.WHITE textPaint.color = Color.WHITE
val areaRect = Rect(0, 0, pixelSize, pixelSize) val areaRect = Rect(0, 0, pixelSize, pixelSize)