Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ParticipantChip(context: Context) : Chip(context) {
- fun setParticipant(participant: Participant) {
- text = if (participant.name.isEmpty()) context.getString(R.string.profile_without_public_name) else participant.name
- setChipIconResource(R.drawable.ic_person_24dp)
- if (participant.imageUri.isEmpty()) return
- val futureTarget: FutureTarget<Drawable> = GlideApp.with(context)
- .asDrawable()
- .load(participant.imageUri)
- .apply(RequestOptions.circleCropTransform())
- .submit()
- launch(UI) {
- (chipDrawable as ChipDrawable).chipIcon = withContext(DefaultDispatcher) { futureTarget.get() }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement