-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX/#379] Event / SVG 이미지 로드 이슈 해결
- Loading branch information
Showing
12 changed files
with
82 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.el.yello.util.Image | ||
|
||
import android.widget.ImageView | ||
import coil.ImageLoader | ||
import coil.decode.SvgDecoder | ||
import coil.load | ||
import coil.request.ImageRequest | ||
import coil.transform.CircleCropTransformation | ||
|
||
fun ImageView.loadUrl(url: String) { | ||
if (url.endsWith(".svg")) { | ||
val imageLoader = ImageLoader.Builder(this.context) | ||
.componentRegistry { add(SvgDecoder(this@loadUrl.context)) } | ||
.build() | ||
|
||
val request = ImageRequest.Builder(this.context) | ||
.crossfade(true) | ||
.crossfade(500) | ||
.data(url) | ||
.target(this) | ||
.build() | ||
|
||
imageLoader.enqueue(request) | ||
return | ||
} | ||
|
||
load(url) | ||
} | ||
|
||
fun ImageView.loadUrlWithCircleCrop(url: String) { | ||
if (!url.endsWith(".svg")) { | ||
load(url) { | ||
transformations(CircleCropTransformation()) | ||
} | ||
return | ||
} | ||
|
||
val imageLoader = ImageLoader.Builder(this.context) | ||
.componentRegistry { add(SvgDecoder(this@loadUrlWithCircleCrop.context)) } | ||
.build() | ||
|
||
val request = ImageRequest.Builder(this.context) | ||
.crossfade(true) | ||
.crossfade(500) | ||
.data(url) | ||
.transformations(CircleCropTransformation()) | ||
.target(this) | ||
.build() | ||
|
||
imageLoader.enqueue(request) | ||
} |
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
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
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
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