mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-09 10:54:31 +02:00
feat(core/ff_message_preview): avenir next font
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
parent
bcbf54b35a
commit
a6d3c398c7
@ -85,8 +85,10 @@ class FriendFeedMessagePreview : Feature("FriendFeedMessagePreview", loadParams
|
|||||||
|
|
||||||
val feedEntryHeight = ffSdlAvatarSize + ffSdlAvatarMargin * 2 + (4 * context.resources.displayMetrics.density).toInt()
|
val feedEntryHeight = ffSdlAvatarSize + ffSdlAvatarMargin * 2 + (4 * context.resources.displayMetrics.density).toInt()
|
||||||
val separatorHeight = (context.resources.displayMetrics.density * 2).toInt()
|
val separatorHeight = (context.resources.displayMetrics.density * 2).toInt()
|
||||||
|
val avenirNextMedium = context.resources.getFont(context.resources.getIdentifier("avenir_next_medium", "font"))
|
||||||
val textPaint = TextPaint().apply {
|
val textPaint = TextPaint().apply {
|
||||||
textSize = secondaryTextSize
|
textSize = secondaryTextSize
|
||||||
|
typeface = avenirNextMedium
|
||||||
}
|
}
|
||||||
|
|
||||||
context.event.subscribe(BuildMessageEvent::class) { param ->
|
context.event.subscribe(BuildMessageEvent::class) { param ->
|
||||||
@ -134,10 +136,11 @@ class FriendFeedMessagePreview : Feature("FriendFeedMessagePreview", loadParams
|
|||||||
frameLayout.addForegroundDrawable("ffItem", ShapeDrawable(object: Shape() {
|
frameLayout.addForegroundDrawable("ffItem", ShapeDrawable(object: Shape() {
|
||||||
override fun draw(canvas: Canvas, paint: Paint) {
|
override fun draw(canvas: Canvas, paint: Paint) {
|
||||||
val offsetY = canvas.height.toFloat() - previewContainerHeight
|
val offsetY = canvas.height.toFloat() - previewContainerHeight
|
||||||
|
paint.textSize = secondaryTextSize
|
||||||
|
paint.color = sigColorTextPrimary
|
||||||
|
paint.typeface = avenirNextMedium
|
||||||
|
|
||||||
messageCache[conversationId]?.forEachIndexed { index, messageString ->
|
messageCache[conversationId]?.forEachIndexed { index, messageString ->
|
||||||
paint.textSize = secondaryTextSize
|
|
||||||
paint.color = sigColorTextPrimary
|
|
||||||
canvas.drawText(messageString,
|
canvas.drawText(messageString,
|
||||||
feedEntryHeight + ffSdlPrimaryTextStartMargin,
|
feedEntryHeight + ffSdlPrimaryTextStartMargin,
|
||||||
offsetY + index * maxTextHeight,
|
offsetY + index * maxTextHeight,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user