Fix layout bug

This commit is contained in:
Niels Andriesse 2020-01-17 14:06:35 +11:00
parent 9efa528377
commit 5c8bbc161b

View File

@ -7,6 +7,7 @@ import android.widget.LinearLayout
import kotlinx.android.synthetic.main.view_device.view.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.devicelist.Device
import org.thoughtcrime.securesms.loki.toPx
class DeviceView : LinearLayout {
var device: Device? = null
@ -38,6 +39,10 @@ class DeviceView : LinearLayout {
// region Updating
fun bind(device: Device) {
titleTextView.text = if (!device.name.isNullOrBlank()) device.name else "Unnamed Device"
// FIXME: Hacky way of getting the view to be screen width
val titleTextViewLayoutParams = titleTextView.layoutParams
titleTextViewLayoutParams.width = resources.displayMetrics.widthPixels - toPx(32, resources)
titleTextView.layoutParams = titleTextViewLayoutParams
subtitleTextView.text = device.shortId
}
// endregion