diff --git a/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/activity/BaseActivity.kt b/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/activity/BaseActivity.kt index dca2a37..b4db3d7 100644 --- a/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/activity/BaseActivity.kt +++ b/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/activity/BaseActivity.kt @@ -12,14 +12,12 @@ import kotlinx.coroutines.cancel * @see[AppCompatActivity] * @since 0.1.0 */ -abstract class BaseActivity : AppCompatActivity, CoroutineScope { +abstract class BaseActivity @JvmOverloads constructor( + @LayoutRes contentLayoutId: Int = 0 +) : AppCompatActivity(contentLayoutId), CoroutineScope { override val coroutineContext = Dispatchers.Main + SupervisorJob() - constructor(): super() - - constructor(@LayoutRes contentLayoutId: Int): super(contentLayoutId) - override fun onDestroy() { super.onDestroy() coroutineContext.cancel() diff --git a/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/fragment/BaseFragment.kt b/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/fragment/BaseFragment.kt index 6c0afbd..4a1766d 100644 --- a/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/fragment/BaseFragment.kt +++ b/kaal-presentation/src/main/kotlin/cz/eman/kaal/presentation/fragment/BaseFragment.kt @@ -12,14 +12,12 @@ import kotlinx.coroutines.cancel * @see[Fragment] * @since 0.1.0 */ -abstract class BaseFragment : Fragment, CoroutineScope { +abstract class BaseFragment @JvmOverloads constructor( + @LayoutRes contentLayoutId: Int = 0 +) : Fragment(contentLayoutId), CoroutineScope { override val coroutineContext = Dispatchers.Main + SupervisorJob() - constructor(): super() - - constructor(@LayoutRes contentLayoutId: Int): super(contentLayoutId) - override fun onDestroy() { super.onDestroy() coroutineContext.cancel()