From d9a77ffaffed74b22c8f5c2789977cca0cad368f Mon Sep 17 00:00:00 2001 From: Paul Woitaschek Date: Fri, 27 Dec 2024 19:08:37 +0100 Subject: [PATCH] Remove the unused ViewBindingController --- .../common/conductor/ViewBindingController.kt | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt diff --git a/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt b/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt deleted file mode 100644 index ee2360d689..0000000000 --- a/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt +++ /dev/null @@ -1,42 +0,0 @@ -package voice.common.conductor - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.viewbinding.ViewBinding -import com.bluelinelabs.conductor.Controller - -typealias InflateBinding = (LayoutInflater, ViewGroup?, Boolean) -> B - -abstract class ViewBindingController( - args: Bundle = Bundle(), - private val inflateBinding: InflateBinding, -) : Controller(args) { - - private var _binding: B? = null - val binding: B get() = _binding ?: error("No binding present.") - - final override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup, - savedViewState: Bundle?, - ): View { - return inflateBinding(inflater, container, false) - .also { - _binding = it - it.onBindingCreated() - } - .root - } - - final override fun onDestroyView(view: View) { - super.onDestroyView(view) - onDestroyView() - _binding = null - } - - open fun onDestroyView() {} - - open fun B.onBindingCreated() {} -}