Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

fix: adjust image corner radius #1552

Merged
merged 2 commits into from
May 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import br.com.zup.beagle.android.engine.mapper.ViewMapper
import br.com.zup.beagle.android.imagedownloader.DefaultImageDownloader
import br.com.zup.beagle.android.logger.BeagleMessageLogs
import br.com.zup.beagle.android.setup.BeagleEnvironment
import br.com.zup.beagle.android.utils.dp
import br.com.zup.beagle.android.utils.observeBindChanges
import br.com.zup.beagle.android.view.ViewFactory
import br.com.zup.beagle.android.widget.RootView
Expand Down Expand Up @@ -73,11 +74,15 @@ data class Image constructor(
}

private fun getImageView(rootView: RootView) = viewFactory.makeImageView(rootView.getContext(),
style?.cornerRadius?.radius ?: 0.0).apply {
getCornerRadius()).apply {
adjustViewBounds = true
scaleType = viewMapper.toScaleType(mode ?: ImageContentMode.FIT_CENTER)
}

private fun getCornerRadius(): Double {
return style?.cornerRadius?.radius?.dp() ?: 0.0
}

private fun loadLocalImage(rootView: RootView, imageView: ImageView, pathType: ImagePath.Local) {
imageView.apply {
observeBindChanges(rootView, imageView, pathType.mobileId) { mobileId ->
Expand Down