package Ġcom . tu uz ed . android x . ex dialog . lifecycle Ċ Ċ import Ġandroidx . annotation . Keep Ċ import Ġandroidx . lifecycle . Lifecycle Ċ import Ġandroidx . lifecycle . Lifecycle Observer Ċ import Ġandroidx . lifecycle . Lifecycle Owner Ċ import Ġandroidx . lifecycle . On Lifecycle Event Ċ import Ġcom . tu uz ed . android x . ex dialog . Ex Dialog Ċ Ċ fun ĠEx Dialog . lifecycle Owner ( owner : ĠLifecycle Owner ): ĠEx Dialog Ġ{ ĊĠĠĠ Ġowner . lifecycle . add Observer ( Ex Dialog Lifecycle Observer ( this )) ĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ @ Keep Ċ private Ġclass ĠEx Dialog Lifecycle Observer ( ĊĠĠĠ Ġprivate Ġval Ġdialog : ĠEx Dialog Ċ ) Ġ: ĠLifecycle Observer Ġ{ ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ DESTROY ) ĊĠĠĠ Ġfun Ġon Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġdialog . dismiss () ĊĠĠĠ Ġ} Ċ Ċ }