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', ObjectCursor : '0.9.16',
PlayServices : '10.2.0', PlayServices : '10.2.0',
MapsUtils : '0.4.4', MapsUtils : '0.4.4',
Crashlyrics : '2.6.6', Crashlyrics : '2.6.7',
FabricPlugin : '1.22.1', FabricPlugin : '1.22.1',
DropboxCoreSdk : '2.1.2', DropboxCoreSdk : '2.1.2',
GoogleDriveApi : 'v3-rev61-1.22.0', 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 mediaImageView = itemView.mediaImage
private val mediaTextView = itemView.mediaText private val mediaTextView = itemView.mediaText
private val aspectRatioSource = SimpleAspectRatioSource().apply { private val aspectRatioSource = SimpleAspectRatioSource()
setSize(100, 100)
}
private var listener: IStatusViewHolder.StatusClickListener? = null private var listener: IStatusViewHolder.StatusClickListener? = null
@ -74,11 +72,7 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
mediaTextView.text = status.text_unescaped mediaTextView.text = status.text_unescaped
} }
if (firstMedia.width > 0 && firstMedia.height > 0) { aspectRatioSource.setSize(firstMedia.width, firstMedia.height)
aspectRatioSource.setSize(firstMedia.width, firstMedia.height)
} else {
aspectRatioSource.setSize(100, 100)
}
mediaImageContainer.tag = firstMedia mediaImageContainer.tag = firstMedia
mediaImageContainer.requestLayout() mediaImageContainer.requestLayout()
@ -133,10 +127,12 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
private var height: Int = 0 private var height: Int = 0
override fun getWidth(): Int { override fun getWidth(): Int {
if (width <= 0 || height <= 0) return 100
return width return width
} }
override fun getHeight(): Int { override fun getHeight(): Int {
if (width <= 0 || height <= 0) return 100
return height return height
} }