kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix text size in generated text drawables.
rodzic
a484d48377
commit
1f3e04da29
|
@ -31,8 +31,8 @@ class TextAvatarDrawable(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun draw(canvas: Canvas) {
|
override fun draw(canvas: Canvas) {
|
||||||
val textSize = Avatars.getTextSizeForLength(context, avatar.text, size * 0.8f, size * 0.45f)
|
|
||||||
val width = bounds.width()
|
val width = bounds.width()
|
||||||
|
val textSize = Avatars.getTextSizeForLength(context, avatar.text, width * 0.8f, width * 0.45f)
|
||||||
val candidates = EmojiProvider.getCandidates(avatar.text)
|
val candidates = EmojiProvider.getCandidates(avatar.text)
|
||||||
|
|
||||||
textPaint.textSize = textSize
|
textPaint.textSize = textSize
|
||||||
|
|
|
@ -26,7 +26,10 @@ class AvatarView @JvmOverloads constructor(
|
||||||
isClickable = false
|
isClickable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private val avatar: AvatarImageView = findViewById(R.id.avatar_image_view)
|
private val avatar: AvatarImageView = findViewById<AvatarImageView>(R.id.avatar_image_view).apply {
|
||||||
|
initialize(context, attrs)
|
||||||
|
}
|
||||||
|
|
||||||
private val storyRing: View = findViewById(R.id.avatar_story_ring)
|
private val storyRing: View = findViewById(R.id.avatar_story_ring)
|
||||||
|
|
||||||
private fun showStoryRing(hasUnreadStory: Boolean) {
|
private fun showStoryRing(hasUnreadStory: Boolean) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class AvatarImageView extends AppCompatImageView {
|
||||||
initialize(context, attrs);
|
initialize(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(@NonNull Context context, @Nullable AttributeSet attrs) {
|
public void initialize(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||||
setScaleType(ScaleType.CENTER_CROP);
|
setScaleType(ScaleType.CENTER_CROP);
|
||||||
|
|
||||||
if (attrs != null) {
|
if (attrs != null) {
|
||||||
|
|
Ładowanie…
Reference in New Issue