use the correct paddings for status info and follow notifications (#4958)
On my device the status info was just slighty misaligned, so I investigated. Turns out the dp values were correct, but the `Utils.dpToPx` method calculates with the exact density of the device, whereas everything else uses the density buckets Android defines. And on some devices that makes a visible difference. Did a little refactor and now everything should always be aligned correctly. And in `item_follow` the padding was just different from other notification items.
This commit is contained in:
parent
b9cdb02630
commit
ba4f57ecaa
4 changed files with 17 additions and 10 deletions
|
|
@ -18,7 +18,6 @@
|
|||
package com.keylesspalace.tusky.components.notifications
|
||||
|
||||
import android.view.View
|
||||
import at.connyduck.sparkbutton.helpers.Utils
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.adapter.StatusViewHolder
|
||||
import com.keylesspalace.tusky.entity.Notification
|
||||
|
|
@ -57,16 +56,16 @@ internal class StatusViewHolder(
|
|||
if (payloads.isNotEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
val res = itemView.resources
|
||||
if (viewData.type == Notification.Type.Poll) {
|
||||
statusInfo.setText(if (accountId == viewData.account.id) R.string.poll_ended_created else R.string.poll_ended_voted)
|
||||
statusInfo.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_poll_24dp, 0, 0, 0)
|
||||
statusInfo.setCompoundDrawablePadding(Utils.dpToPx(statusInfo.context, 10))
|
||||
statusInfo.setPaddingRelative(Utils.dpToPx(statusInfo.context, 28), 0, 0, 0)
|
||||
statusInfo.setCompoundDrawablePadding(res.getDimensionPixelSize(R.dimen.status_info_drawable_padding_large))
|
||||
statusInfo.setPadding(res.getDimensionPixelSize(R.dimen.status_info_padding_large), 0, 0, 0)
|
||||
statusInfo.show()
|
||||
} else if (viewData.type == Notification.Type.Mention) {
|
||||
statusInfo.setCompoundDrawablePadding(Utils.dpToPx(statusInfo.context, 6))
|
||||
statusInfo.setPaddingRelative(Utils.dpToPx(statusInfo.context, 38), 0, 0, 0)
|
||||
statusInfo.setCompoundDrawablePadding(res.getDimensionPixelSize(R.dimen.status_info_drawable_padding_small))
|
||||
statusInfo.setPaddingRelative(res.getDimensionPixelSize(R.dimen.status_info_padding_small), 0, 0, 0)
|
||||
statusInfo.show()
|
||||
if (viewData.statusViewData.status.inReplyToAccountId == accountId) {
|
||||
statusInfo.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_reply_18dp, 0, 0, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue