From 796b817ea67cb4ea09bc1c27e53fcdc5903d59a6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Sep 2019 21:41:07 +0800 Subject: [PATCH] up --- .../widget/dynamiclayout/DynamicFrameLayout.kt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt b/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt index 2b25fe55a..00bba86dd 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dynamiclayout/DynamicFrameLayout.kt @@ -62,33 +62,25 @@ class DynamicFrameLayout(context: Context, attrs: AttributeSet?) : FrameLayout(c } override fun addView(child: View) { - if (childCount > 2) { - throw IllegalStateException("DynamicFrameLayout can host only one direct child") - } + check(childCount <= 2) { "DynamicFrameLayout can host only one direct child" } super.addView(child) } override fun addView(child: View, index: Int) { - if (childCount > 2) { - throw IllegalStateException("DynamicFrameLayout can host only one direct child") - } + check(childCount <= 2) { "DynamicFrameLayout can host only one direct child" } super.addView(child, index) } override fun addView(child: View, params: ViewGroup.LayoutParams) { - if (childCount > 2) { - throw IllegalStateException("DynamicFrameLayout can host only one direct child") - } + check(childCount <= 2) { "DynamicFrameLayout can host only one direct child" } super.addView(child, params) } override fun addView(child: View, index: Int, params: ViewGroup.LayoutParams) { - if (childCount > 2) { - throw IllegalStateException("DynamicFrameLayout can host only one direct child") - } + check(childCount <= 2) { "DynamicFrameLayout can host only one direct child" } super.addView(child, index, params) }