Переглянути джерело

Refactor MediaBox

Use JvmOverloads constructor
Wayne 5 роки тому
батько
коміт
c4317f6549

+ 6 - 14
reader/src/main/java/com/kdanmobile/reader/screen/view/ViewerEditView.kt

@@ -19,7 +19,11 @@ import com.kdanmobile.reader.screen.view.edit.TitleButton
 import kotlinx.android.synthetic.main.view_viewer_edit.view.*
 import kotlinx.android.synthetic.main.view_viewer_edit_tab.view.*
 
-class ViewerEditView : ConstraintLayout {
+class ViewerEditView @JvmOverloads constructor(
+        context: Context,
+        attrs: AttributeSet? = null,
+        defStyleAttr: Int = 0
+): ConstraintLayout(context, attrs, defStyleAttr) {
 
     private companion object {
         const val COLOR_DISMISS = Color.TRANSPARENT
@@ -41,19 +45,7 @@ class ViewerEditView : ConstraintLayout {
     private var selected: ImageButton? = null
     var onViewerEditTabAddButtonClickListener: OnViewerEditTabAddButtonClickListener? = null
 
-    constructor(context: Context) : super(context) {
-        initView()
-    }
-
-    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
-        initView()
-    }
-
-    constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
-        initView()
-    }
-
-    private fun initView() {
+    init {
         LayoutInflater.from(context).inflate(R.layout.view_viewer_edit, this)
         visibility = View.INVISIBLE
         setupTabView()