Skip to content

Commit

Permalink
feat: 커스텀 프로필 이미지에 들어갈 이미지가 png 형식의 투명한 배경일 경우 검은 색 배경 표시
Browse files Browse the repository at this point in the history
  • Loading branch information
no1msh committed Nov 14, 2023
1 parent 3a2e9df commit f3e35e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ class CustomProfileImage @JvmOverloads constructor(
).color,
),
)
Glide.with(profileImage.context)
.load(getString(R.styleable.CustomProfileImage_glideCircleImageUrl))
.circleCrop()
.into(profileImage)

setGlideCircleImageUrl(getString(R.styleable.CustomProfileImage_glideCircleImageUrl))
}.also { recycle() }
}
}

fun setGlideCircleImageUrl(image: String) {
Glide.with(profileImage.context)
.load(image)
.circleCrop()
.into(profileImage)
fun setGlideCircleImageUrl(imageUrl: String?) {
imageUrl?.let {
Glide.with(profileImage.context)
.load(imageUrl)
.circleCrop()
.into(profileImage)
}
}

fun setBorderProgress(successRate: Int) {
Expand Down
8 changes: 8 additions & 0 deletions android/app/src/main/res/drawable/bg_circle_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:angle="0" android:shape="oval" android:useLevel="false">
<solid android:color="@color/black" />
</shape>
</item>
</selector>
3 changes: 2 additions & 1 deletion android/app/src/main/res/layout/custom_profile_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
android:id="@+id/iv_custom_profile_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_gravity="center"
android:layout_margin="4dp"
android:background="@drawable/bg_circle_black"
android:contentDescription="@string/custom_profile_image_content_description"
tools:src="@drawable/ic_launcher_foreground" />

Expand Down

0 comments on commit f3e35e3

Please sign in to comment.