ui: fix edit layout crashes

Fix crashes that prevented android studio from showing layout previews
of certain views.
This commit is contained in:
Alexander Capehart 2023-07-27 15:42:19 -06:00
parent 6ac757b952
commit 507bc516ce
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 8 additions and 2 deletions

View file

@ -59,7 +59,9 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
override fun onAttachedToWindow() {
super.onAttachedToWindow()
(layoutParams as CoordinatorLayout.LayoutParams).behavior = Behavior(context)
if (!isInEditMode) {
(layoutParams as CoordinatorLayout.LayoutParams).behavior = Behavior(context)
}
}
private fun findTitleView(): TextView {

View file

@ -255,7 +255,7 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
}
private fun getCornerRadiusRes() =
if (uiSettings.roundMode) {
if (!isInEditMode && uiSettings.roundMode) {
SIZING_CORNER_RADII[sizing]
} else {
null

View file

@ -0,0 +1,4 @@
package org.oxycblt.auxio.ui
class IconToolbar {
}