Extensions: use more idiomatic kotlin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
8b9a40b3d7
commit
abcb51d2a6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user