/* Ċ Ġ* ĠCopyright Ġ 2 0 1 9 ĠSquare ĠInc . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . squareup . sample . main activity Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġcom . squareup . sample . todo . Todo Lists App Workflow Ċ import Ġcom . squareup . workflow . ui . Experimental Workflow Ui Ċ import Ġcom . squareup . workflow . ui . View Registry Ċ import Ġcom . squareup . workflow . ui . Workflow Runner Ċ import Ġcom . squareup . workflow . ui . setContent Workflow Ċ import Ġcom . squareup . workflow . ui . workflow On Back Pressed Ċ Ċ @ Use Experimental ( Experimental Workflow Ui :: class ) Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠ Ġprivate Ġlateinit Ġvar Ġroot Workflow : ĠTodo Lists App Workflow ĊĠ Ġprivate Ġlateinit Ġvar Ġworkflow Runner : ĠWorkflow Runner < *> ĊĊĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠ Ġroot Workflow Ġ= Ġlast Custom Non Configuration Instance Ġas ? ĠTodo Lists App Workflow ĊĠĠĠĠĠĠĠ Ġ?: ĠTodo Lists App Workflow () ĊĊĠĠĠ Ġworkflow Runner Ġ= Ġset Content Workflow ( view Registry , Ġroot Workflow , ĠsavedInstanceState ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Back Pressed () Ġ{ ĊĠĠĠ Ġif Ġ(! workflow On Back Pressed ()) Ġsuper . on Back Pressed () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ ĊĠĠĠ Ġsuper . on Save InstanceState ( out State ) ĊĠĠĠ Ġworkflow Runner . on Save InstanceState ( out State ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Ret ain Custom Non Configuration Instance (): ĠAny Ġ= Ġroot Workflow ĊĊĠ Ġprivate Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġval Ġview Registry Ġ= ĠView Registry ( Todo Editor Layout Runner ) Ġ+ ĠTodo Lists Layout Runner ĊĠ Ġ} Ċ } Ċ