package Ġcom . h encoder . h encoder pract iced raw 4 Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . annotation . Layout Res Ċ import Ġandroid . support . annotation . String Res Ċ import Ġandroid . support . design . widget . Tab Layout Ċ import Ġandroid . support . v 4 . app . Fragment Ċ import Ġandroid . support . v 4 . app . Fragment Pager Adapter Ċ import Ġandroid . support . v 4 . view . ViewPager Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġandroid . view . Menu Ċ import Ġjava . util .* Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġinternal Ġlateinit Ġvar Ġtab Layout : ĠTab Layout ĊĠĠĠ Ġinternal Ġlateinit Ġvar Ġpager : ĠView Pager ĊĠĠĠ Ġinternal Ġvar Ġpage Models : ĠMutable List < Page Model > Ġ= ĠArrayList () ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ clip _ rect , ĠR . string . title _ clip _ rect , ĠR . layout . practice _ clip _ rect )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ clip _ path , ĠR . string . title _ clip _ path , ĠR . layout . practice _ clip _ path )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ translate , ĠR . string . title _ translate , ĠR . layout . practice _ translate )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ scale , ĠR . string . title _ scale , ĠR . layout . practice _ scale )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ rotate , ĠR . string . title _ rotate , ĠR . layout . practice _ rotate )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ skew , ĠR . string . title _ skew , ĠR . layout . practice _ skew )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ matrix _ translate , ĠR . string . title _ matrix _ translate , ĠR . layout . practice _ matrix _ translate )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ matrix _ scale , ĠR . string . title _ matrix _ scale , ĠR . layout . practice _ matrix _ scale )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ matrix _ rotate , ĠR . string . title _ matrix _ rotate , ĠR . layout . practice _ matrix _ rotate )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ matrix _ skew , ĠR . string . title _ matrix _ skew , ĠR . layout . practice _ matrix _ skew )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ camera _ rotate , ĠR . string . title _ camera _ rotate , ĠR . layout . practice _ camera _ rotate )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ camera _ rotate _ fixed , ĠR . string . title _ camera _ rotate _ fixed , ĠR . layout . practice _ measure _ text )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ camera _ rotate _ hit ting _ face , ĠR . string . title _ camera _ rotate _ hit ting _ face , ĠR . layout . practice _ camera _ rotate _ hit ting _ face )) ĊĠĠĠĠĠĠĠ Ġpage Models . add ( Page Model ( R . layout . sample _ flip board , ĠR . string . title _ flip board , ĠR . layout . practice _ flip board )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĊĠĠĠĠĠĠĠ Ġpager Ġ= ĠfindViewById ( R . id . pager ) Ġas ĠView Pager ĊĠĠĠĠĠĠĠ Ġpager . adapter Ġ= Ġobject Ġ: ĠFragment Pager Adapter ( support FragmentManager ) Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun ĠgetItem ( position : ĠInt ): ĠFragment Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpage Model Ġ= Ġpage Models [ position ] ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠPage Fragment . newInstance ( page Model . sample Layout Res , Ġpage Model . practice Layout Res ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġget Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġpage Models . size ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġget Page Title ( position : ĠInt ): ĠCharSequence Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠgetString ( page Models [ position ]. title Res ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġtab Layout Ġ= ĠfindViewById ( R . id . tab Layout ) Ġas ĠTab Layout ĊĠĠĠĠĠĠĠ Ġtab Layout . setup With ViewPager ( pager ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate Options Menu ( menu : ĠMenu ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġsuper . onCreate Options Menu ( menu ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠPage Model Ġinternal Ġconstructor (@ param : Layout Res Ġ@ field : Layout Res Ġinternal Ġvar Ġsample Layout Res : ĠInt , Ġ@ param : String Res Ġ@ field : String Res Ġinternal Ġvar Ġtitle Res : ĠInt , Ġ@ param : Layout Res Ġ@ field : Layout Res Ġinternal Ġvar Ġpractice Layout Res : ĠInt ) Ċ } Ċ