package Ġcom . squareup . workflow 1 . ui Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Context Wrapper Ċ import Ġandroid . view . View Ċ import Ġandroidx . lifecycle . Lifecycle Owner Ċ import Ġandroidx . lifecycle . View Tree Lifecycle Owner Ċ Ċ /** Ċ Ġ* ĠNamespace Ġfor Ġsome Ġhelper Ġfunctions Ġfor Ġinteracting Ġwith Ġthe ĠAndroid X Ġlibraries . Ċ Ġ*/ Ċ public Ġobject ĠWorkflow Android X Support Ġ{ ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠT ries Ġto Ġget Ġthe Ġparent Ġlifecycle Ġfrom Ġthe Ġcurrent Ġview Ġvia Ġ[ View Tree Lifecycle Owner ], Ġif Ġthat ĊĠĠ Ġ* Ġfails Ġit Ġlooks Ġup Ġthe Ġcontext Ġchain Ġfor Ġa Ġ[ Lifecycle Owner ], Ġand Ġif Ġthat Ġfails Ġit Ġjust Ġreturns ĊĠĠ Ġ* Ġnull . ĊĠĠ Ġ*/ ĊĠ Ġ@ Workflow Ui Experimental Api ĊĠ Ġpublic Ġfun Ġlifecycle Owner From View Tree Or Context ( view : ĠView ): ĠLifecycle Owner ? Ġ= ĊĠĠĠ ĠView Tree Lifecycle Owner . get ( view ) Ġ?: Ġview . context . lifecycle Owner OrNull () ĊĊĠ Ġprivate Ġtail rec Ġfun ĠContext . lifecycle Owner OrNull (): ĠLifecycle Owner ? Ġ= Ġwhen Ġ( this ) Ġ{ ĊĠĠĠ Ġis ĠLifecycle Owner Ġ-> Ġthis ĊĠĠĠ Ġelse Ġ-> Ġ( this Ġas ? ĠContext Wrapper )?. base Context ?. lifecycle Owner OrNull () ĊĠ Ġ} Ċ } Ċ