package Ġcom . can hub . crop per . sample Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġcom . can hub . crop per . sample . crop _ image . app . SC rop Image Fragment Ċ import Ġcom . can hub . crop per . sample . crop _ image _ java . app . SC rop Image Fragment Java Ċ import Ġcom . can hub . crop per . sample . crop _ image _ view . app . SC rop ImageView Fragment Ċ import Ġcom . can hub . crop per . sample . extend _ activity . app . S Extend Activity Ċ import Ġcom . example . crop per sample . databinding . Activity Main Binding Ċ Ċ internal Ġclass ĠS MainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠActivity Main Binding ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠActivity Main Binding . inflate ( layout Inflater ) ĊĊĠĠĠĠĠĠĠ ĠsetContentView ( binding . root ) ĊĊĠĠĠĠĠĠĠ Ġbinding . sample Crop ImageView . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSC rop ImageView Fragment . newInstance (). show () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . sample Custom Activity . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠS Extend Activity . start ( this ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . sample Crop Image . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSC rop Image Fragment . newInstance (). show () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġbinding . sample Crop Image Java . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSC rop Image Fragment Java . newInstance (). show () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠFragment . show () Ġ{ ĊĠĠĠĠĠĠĠ Ġsupport FragmentManager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. beginTransaction () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. replace ( binding . container . id , Ġthis ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. commit () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Back Pressed () Ġ{ ĊĠĠĠĠĠĠĠ Ġsupport FragmentManager . find Fragment ById ( binding . container . id )?. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupport FragmentManager . beginTransaction (). remove ( this ). commit () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġsuper . on Back Pressed () ĊĠĠĠ Ġ} Ċ } Ċ