package Ġcom . github . lon ely wood . architecture . android Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . util . Log Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġcom . github . lon ely wood . architecture . android . components . photo component . Default Photo T aker Component Ċ import Ġcom . github . lon ely wood . architecture . android . components . photo component . Photo T aker Component Ċ import Ġcom . github . lon ely wood . architecture . android . components . photo component . Photo T aker Listener Ċ import Ġkotlinx . android . synt hetic . main . main _ activity .* ĊĊ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity (), ĠPhoto T aker Listener Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġphoto T aker Component : ĠPhoto T aker Component ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . main _ activity ) ĊĊĠĠĠĠĠĠĠ Ġphoto T aker Component Ġ= ĠDefault Photo T aker Component () ĊĠĠĠĠĠĠĠ Ġphoto T aker Component . addListener ( this ) ĊĊĠĠĠĠĠĠĠ Ġmain Photo Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġphoto T aker Component . take Photo () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Photo Taken ( success : ĠBoolean , Ġpath : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . e (" on Photo Taken ", Ġ" success : Ġ$ success , Ġpath : Ġ$ path ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġphoto T aker Component . remove Listener ( this ) ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy () ĊĠĠĠ Ġ} Ċ }