File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
app/src/main/kotlin/com/rayfantasy/icode/extension Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -21,17 +21,16 @@ import com.amulyakhare.textdrawable.TextDrawable
2121import com.bumptech.glide.Glide
2222import com.rayfantasy.icode.postutil.PostUtil
2323import jp.wasabeef.glide.transformations.CropCircleTransformation
24- import org.jetbrains.anko.image
2524
26- fun ImageView.loadPortrait (username : String , errorRes : Int? = null) {
27- val errorIcon = errorRes ?.let { resources.getDrawable(errorRes ) } ? :
25+ fun ImageView.loadPortrait (username : String , placeholderRes : Int? = null) {
26+ val placeholder = placeholderRes ?.let { resources.getDrawable(placeholderRes ) } ? :
2827 TextDrawable
2928 .builder().buildRound(username[0 ].toString().toUpperCase(),
3029 username.hashCode().alpha(0xff ).shadowColor())
31- image = errorIcon
3230 Glide .with (context)
3331 .load(PostUtil .getProfilePicUrl(username))
34- .error(errorIcon)
32+ .placeholder(placeholder)
33+ .error(placeholder)
3534 .bitmapTransform(CropCircleTransformation (context))
3635 .into(this )
3736}
You can’t perform that action at this time.
0 commit comments