Extensions: use more idiomatic kotlin

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-09-16 10:44:50 +02:00
parent 8b9a40b3d7
commit abcb51d2a6

View File

@ -25,7 +25,7 @@ fun Fragment.requireTargetFragment(): Fragment {
}
val Preference.activity: SettingsActivity
get() = if (this.context is SettingsActivity) this.context as SettingsActivity else throw IllegalStateException("Failed to resolve SettingsActivity")
get() = context as? SettingsActivity ?: throw IllegalStateException("Failed to resolve SettingsActivity")
val Preference.lifecycleScope: CoroutineScope
get() = this.activity.lifecycleScope
get() = activity.lifecycleScope