From 3e82c8f9ea288bdd3815a2b8bc1065972d16272c Mon Sep 17 00:00:00 2001 From: Anton Chekulaev Date: Fri, 4 Sep 2020 00:08:34 +1000 Subject: [PATCH] User pic placeholder colors tweaks. Use proper username for settings activity placeholder. --- res/values/colors.xml | 7 +++---- .../securesms/loki/activities/SettingsActivity.kt | 2 +- .../securesms/loki/todo/AvatarPlaceholderGenerator.kt | 8 +++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/res/values/colors.xml b/res/values/colors.xml index 390c3be09e..caaccd140b 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -108,11 +108,10 @@ #171717 - #18da80 - #ee8917 + #2bca81 + #ee7117 #239edf - #c33fe9 - #83b433 + #bb35e9 diff --git a/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt index 0d052d4221..efd7836ffe 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt @@ -79,7 +79,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { glide = GlideApp.with(this) profilePictureView.glide = glide profilePictureView.publicKey = hexEncodedPublicKey - profilePictureView.displayName = displayNameToBeUploaded + profilePictureView.displayName = origUserDisplayName profilePictureView.isLarge = true profilePictureView.update() profilePictureView.setOnClickListener { showEditProfilePictureUI() } diff --git a/src/org/thoughtcrime/securesms/loki/todo/AvatarPlaceholderGenerator.kt b/src/org/thoughtcrime/securesms/loki/todo/AvatarPlaceholderGenerator.kt index bca93db549..d79f736c89 100644 --- a/src/org/thoughtcrime/securesms/loki/todo/AvatarPlaceholderGenerator.kt +++ b/src/org/thoughtcrime/securesms/loki/todo/AvatarPlaceholderGenerator.kt @@ -29,7 +29,7 @@ object AvatarPlaceholderGenerator { // 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 colorPrimary = colorArray[(hash % colorArray.size).toInt()] - val colorSecondary = changeColorHueBy(colorPrimary, 16f) + val colorSecondary = changeColorHueBy(colorPrimary, 12f) val labelText = when { !TextUtils.isEmpty(displayName) -> extractLabel(displayName!!) @@ -41,8 +41,7 @@ object AvatarPlaceholderGenerator { val canvas = Canvas(bitmap) // Draw background/frame - val paint = Paint() - paint.isAntiAlias = true + val paint = Paint(Paint.ANTI_ALIAS_FLAG) paint.shader = LinearGradient(0f, 0f, 0f, pixelSize.toFloat(), colorPrimary, colorSecondary, @@ -50,9 +49,8 @@ object AvatarPlaceholderGenerator { canvas.drawCircle(pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, paint) // Draw text - val textPaint = TextPaint() + val textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG) textPaint.typeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL) - textPaint.isAntiAlias = true textPaint.textSize = pixelSize * 0.5f textPaint.color = Color.WHITE val areaRect = Rect(0, 0, pixelSize, pixelSize)