forked from upstream-mirrors/quik
Add isInEditMode support for AvatarView
This commit is contained in:
@@ -50,8 +50,11 @@ class AvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
View.inflate(context, R.layout.avatar_view, this)
|
if (!isInEditMode) {
|
||||||
appComponent.inject(this)
|
appComponent.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
View.inflate(context, R.layout.avatar_view, this)
|
||||||
|
|
||||||
setBackgroundResource(R.drawable.circle)
|
setBackgroundResource(R.drawable.circle)
|
||||||
clipToOutline = true
|
clipToOutline = true
|
||||||
@@ -59,6 +62,8 @@ class AvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
|||||||
|
|
||||||
override fun onAttachedToWindow() {
|
override fun onAttachedToWindow() {
|
||||||
super.onAttachedToWindow()
|
super.onAttachedToWindow()
|
||||||
|
|
||||||
|
if (!isInEditMode) {
|
||||||
colors.theme
|
colors.theme
|
||||||
.autoDisposable(scope())
|
.autoDisposable(scope())
|
||||||
.subscribe { color -> background.setTint(color) }
|
.subscribe { color -> background.setTint(color) }
|
||||||
@@ -82,6 +87,7 @@ class AvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onFinishInflate() {
|
override fun onFinishInflate() {
|
||||||
super.onFinishInflate()
|
super.onFinishInflate()
|
||||||
|
|||||||
Reference in New Issue
Block a user