1package soy.iko.opencode.util
3import android.app.Activity
4import android.content.Context
5import android.content.ContextWrapper
7/** Walk the [Context] wrapper chain to find the hosting [Activity], so window/fold/lifecycle
8 * APIs reachable only from an Activity can be used from a Composable via [LocalContext].
9 * Returns null when the context isn't hosted in an Activity (e.g. a preview), in which case
10 * the caller should skip the Activity-dependent path. */
11tailrec fun Context.findActivity(): Activity? = when (this) {
13 is ContextWrapper -> baseContext.findActivity()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list