fixed media status size crash

This commit is contained in:
Mariotaku Lee 2017-03-09 09:58:50 +08:00
parent 29f9fb9084
commit 89b70936bd
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 5 additions and 9 deletions

View File

@ -40,7 +40,7 @@ subprojects {
ObjectCursor : '0.9.16',
PlayServices : '10.2.0',
MapsUtils : '0.4.4',
Crashlyrics : '2.6.6',
Crashlyrics : '2.6.7',
FabricPlugin : '1.22.1',
DropboxCoreSdk : '2.1.2',
GoogleDriveApi : 'v3-rev61-1.22.0',

View File

@ -43,9 +43,7 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
private val mediaImageView = itemView.mediaImage
private val mediaTextView = itemView.mediaText
private val aspectRatioSource = SimpleAspectRatioSource().apply {
setSize(100, 100)
}
private val aspectRatioSource = SimpleAspectRatioSource()
private var listener: IStatusViewHolder.StatusClickListener? = null
@ -74,11 +72,7 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
mediaTextView.text = status.text_unescaped
}
if (firstMedia.width > 0 && firstMedia.height > 0) {
aspectRatioSource.setSize(firstMedia.width, firstMedia.height)
} else {
aspectRatioSource.setSize(100, 100)
}
aspectRatioSource.setSize(firstMedia.width, firstMedia.height)
mediaImageContainer.tag = firstMedia
mediaImageContainer.requestLayout()
@ -133,10 +127,12 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
private var height: Int = 0
override fun getWidth(): Int {
if (width <= 0 || height <= 0) return 100
return width
}
override fun getHeight(): Int {
if (width <= 0 || height <= 0) return 100
return height
}