Created
December 11, 2020 10:17
-
-
Save dadouf/9589a25cfa65c1f155b6a1fd871d4eeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var hasInitParentDimensions = false | |
private var maxImageWidth: Int = 0 | |
private var maxImageHeight: Int = 0 | |
private var maxImageAspectRatio: Float = 1f | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH { | |
if (!hasInitParentDimensions) { | |
maxImageWidth = parent.width | |
maxImageHeight = parent.height | |
maxImageAspectRatio = maxImageWidth.toFloat() / maxImageHeight.toFloat() | |
hasInitParentDimensions = true | |
} | |
return VH(ImageView(parent.context)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment