mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 10:11:58 +00:00
Show static images for widgets
This commit is contained in:
parent
2237d638f6
commit
0461cc35f5
2 changed files with 8 additions and 4 deletions
|
|
@ -98,7 +98,8 @@ object DataBindingUtils {
|
|||
|
||||
fun getFullFilename(
|
||||
imageName: String,
|
||||
imageFormat: String? = null
|
||||
imageFormat: String? = null,
|
||||
disableAnimations: Boolean = false
|
||||
): String {
|
||||
val name =
|
||||
when {
|
||||
|
|
@ -108,7 +109,7 @@ object DataBindingUtils {
|
|||
else -> imageName
|
||||
}
|
||||
return name +
|
||||
if (!disableAnimations && imageFormat == null && FILEFORMAT_MAP.containsKey(imageName)) {
|
||||
if (!this.disableAnimations && !disableAnimations && imageFormat == null && FILEFORMAT_MAP.containsKey(imageName)) {
|
||||
"." + FILEFORMAT_MAP[imageName]
|
||||
} else if (!disableAnimations) {
|
||||
".${imageFormat ?: "png"}"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class AvatarView : FrameLayout {
|
|||
private var showPet = true
|
||||
private var showSleeping = true
|
||||
private var hasBackground: Boolean = false
|
||||
private var canAnimate: Boolean = true
|
||||
private var preview: Map<LayerType, String>? = null
|
||||
private var hasMount: Boolean = false
|
||||
private var hasPet: Boolean = false
|
||||
|
|
@ -122,10 +123,11 @@ class AvatarView : FrameLayout {
|
|||
init(attrs, defStyle)
|
||||
}
|
||||
|
||||
constructor(context: Context, showBackground: Boolean, showMount: Boolean, showPet: Boolean) : super(context) {
|
||||
constructor(context: Context, showBackground: Boolean, showMount: Boolean, showPet: Boolean, canAnimate: Boolean = true) : super(context) {
|
||||
this.showBackground = showBackground
|
||||
this.showMount = showMount
|
||||
this.showPet = showPet
|
||||
this.canAnimate = canAnimate
|
||||
}
|
||||
|
||||
private fun init(
|
||||
|
|
@ -185,7 +187,8 @@ class AvatarView : FrameLayout {
|
|||
imageView.load(
|
||||
DataBindingUtils.BASE_IMAGE_URL +
|
||||
DataBindingUtils.getFullFilename(
|
||||
layerName
|
||||
layerName,
|
||||
disableAnimations = !canAnimate
|
||||
)
|
||||
) {
|
||||
allowHardware(false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue