package Ġcom . rb ro ok s . in defin ite pager indicator sample . rtl ViewPager Sample Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroid . preference . Preference Manager Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . Button Ċ import Ġandroid . widget . ImageView Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . view pager . widget . Pager Adapter Ċ import Ġcom . rb ro ok s . in defin ite pager indicator sample . R Ċ import Ġcom . rb ro ok s . in defin ite pager indicator sample . util . Pager Number Picker Dialog Preference Ċ import Ġcom . rb ro ok s . in defin ite pager indicator sample . util . Photo Item Ċ Ċ class ĠRTL ViewPager Adapter ( private Ġval Ġcontext : ĠContext ) Ġ: ĠP ager Adapter () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġinstantiate Item ( container : ĠViewGroup , Ġposition : ĠInt ): ĠAny Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= ĠLayoutInflater . from ( context ). inflate ( R . layout . view holder _ image _ card , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġval Ġphoto Item Ġ= ĠPhoto Item . values ()[ position ] ĊĊĠĠĠĠĠĠĠ Ġview . findViewById < ImageView >( R . id . card _ image view ). setImage Resource ( photo Item . photo Id ) ĊĠĠĠĠĠĠĠ Ġview . findViewById < TextView >( R . id . card _ title ). setText ( photo Item . name Id ) ĊĠĠĠĠĠĠĠ Ġview . findViewById < TextView >( R . id . card _ location ). setText ( photo Item . location Id ) ĊĠĠĠĠĠĠĠ Ġview . findViewById < Button >( R . id . card _ see _ original _ button ). setOnClickListener Ġ{ Ġopen Link ( photo Item . link ) Ġ} ĊĊĠĠĠĠĠĠĠ Ġcontainer . addView ( view ) ĊĠĠĠĠĠĠĠ Ġreturn Ġview ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdestroy Item ( container : ĠViewGroup , Ġposition : ĠInt , Ġ` object `: ĠAny ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontainer . remove View (` object ` Ġas ĠView ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġis View From Object ( view : ĠView , Ġ` object `: ĠAny ): ĠBoolean Ġ= Ġview Ġ== Ġ` object ` ĊĊĠĠĠ Ġoverride Ġfun Ġget Count (): ĠInt Ġ= ĠPreference Manager . getDefault SharedPreferences ( context ). getInt ( Pager Number Picker Dialog Preference . KEY _ NUM _ PAGES , ĠP ager Number Picker Dialog Preference . DEFAULT _ PAGES ) ĊĊĠĠĠ Ġprivate Ġfun Ġopen Link ( link : ĠUri ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontext . startActivity ( Intent ( Intent . ACTION _ VIEW , Ġlink )) ĊĠĠĠ Ġ} Ċ }