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,8 +59,10 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
override fun onAttachedToWindow() { override fun onAttachedToWindow() {
super.onAttachedToWindow() super.onAttachedToWindow()
if (!isInEditMode) {
(layoutParams as CoordinatorLayout.LayoutParams).behavior = Behavior(context) (layoutParams as CoordinatorLayout.LayoutParams).behavior = Behavior(context)
} }
}
private fun findTitleView(): TextView { private fun findTitleView(): TextView {
val titleView = titleView val titleView = titleView

View file

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

View file

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