|
|
|
|
@ -13,6 +13,7 @@ import android.widget.TextView |
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout |
|
|
|
|
import androidx.core.content.ContextCompat.getColor |
|
|
|
|
import androidx.core.content.res.ResourcesCompat |
|
|
|
|
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory |
|
|
|
|
import androidx.core.net.toUri |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.model.realm.Player |
|
|
|
|
@ -93,7 +94,13 @@ class PlayerImageView : FrameLayout { |
|
|
|
|
// Picture |
|
|
|
|
player.picture?.let { picture -> |
|
|
|
|
Timber.d("picture = $picture") |
|
|
|
|
this.playerImage.setImageURI(picture.toUri()) |
|
|
|
|
if (picture.startsWith("content://")) { |
|
|
|
|
this.playerImage.setImageURI(picture.toUri()) |
|
|
|
|
} else { // older way |
|
|
|
|
val rDrawable = RoundedBitmapDrawableFactory.create(resources, picture) |
|
|
|
|
rDrawable.isCircular = true |
|
|
|
|
this.playerImage.setImageDrawable(rDrawable) |
|
|
|
|
} |
|
|
|
|
} ?: run { // no pic |
|
|
|
|
this.playerStroke.background = ResourcesCompat.getDrawable(resources, R.drawable.circle_stroke_kaki, null) |
|
|
|
|
this.playerImage.setImageDrawable(null) |
|
|
|
|
|