/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 9 ĠAd yen ĠN . V . Ċ Ġ* Ċ Ġ* ĠThis Ġfile Ġis Ġopen Ġsource Ġand Ġavailable Ġunder Ġthe ĠMIT Ġlicense . ĠSee Ġthe ĠLICENSE Ġfile Ġfor Ġmore Ġinfo . Ċ Ġ* Ċ Ġ* ĠCreated Ġby Ġar man Ġon Ġ 2 / 7 / 2 0 1 9 . Ċ Ġ*/ Ċ Ċ package Ġcom . ady en . checkout . drop in . ui . payment methods Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . Frame Layout Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . appcompat . app . AlertDialog Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . ady en . checkout . components . api . Image Loader Ċ import Ġcom . ady en . checkout . components . ui . view . Ad yen Swipe To Re veal Layout Ċ import Ġcom . ady en . checkout . components . ui . view . Round Corner ImageView Ċ import Ġcom . ady en . checkout . components . util . Currency Utils Ċ import Ġcom . ady en . checkout . components . util . Date Utils Ċ import Ġcom . ady en . checkout . core . exception . Checkout Exception Ċ import Ġcom . ady en . checkout . core . log . Log Util Ċ import Ġcom . ady en . checkout . core . log . Logger Ċ import Ġcom . ady en . checkout . drop in . R Ċ import Ġcom . ady en . checkout . drop in . ui . payment methods . PaymentMethod ListItem . Companion . G IFT _ CARD _ PAYMENT _ METHOD Ċ import Ġcom . ady en . checkout . drop in . ui . payment methods . PaymentMethod ListItem . Companion . PAYMENT _ METHOD Ċ import Ġcom . ady en . checkout . drop in . ui . payment methods . PaymentMethod ListItem . Companion . PAYMENT _ METHO DS _ HEADER Ċ import Ġcom . ady en . checkout . drop in . ui . payment methods . PaymentMethod ListItem . Companion . PAYMENT _ METHO DS _ NOTE Ċ import Ġcom . ady en . checkout . drop in . ui . payment methods . PaymentMethod ListItem . Companion . STO RED _ PAYMENT _ METHOD Ċ Ċ @ SuppressWarnings (" Too Many Functions ") Ċ class ĠPayment Method Adapter Ġ@ Jvm Over loads Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġpayment Methods : ĠMutable List < PaymentMethod ListItem >, ĊĠĠĠ Ġprivate Ġval Ġimage Loader : ĠImage Loader , ĊĠĠĠ Ġprivate Ġval Ġon Under lay Expand Listener : Ġ(( Ad yen Swipe To Re veal Layout ) Ġ-> ĠUnit )? Ġ= Ġnull Ċ ) Ġ: ĠRecyclerView . Adapter < PaymentMethod Adapter . Base ViewHolder >() Ġ{ ĊĊĠĠĠ Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġpayment Methods : ĠCollection < PaymentMethod ListItem >, ĊĠĠĠĠĠĠĠ Ġimage Loader : ĠImage Loader , ĊĠĠĠĠĠĠĠ Ġon Under lay Expand Listener : Ġ(( Ad yen Swipe To Re veal Layout ) Ġ-> ĠUnit )? Ġ= Ġnull ĊĠĠĠ Ġ) Ġ: Ġthis ( payment Methods . to Mutable List (), Ġimage Loader , Ġon Under lay Expand Listener ) ĊĊĠĠĠ Ġprivate Ġvar Ġon PaymentMethod Selected Callback : ĠOn PaymentMethod Selected Callback ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġon Stored Payment Removed Callback : ĠOn Stored Payment Removed Callback ? Ġ= Ġnull ĊĊĠĠĠ Ġfun Ġset PaymentMethod Selected Callback ( on PaymentMethod Selected Callback : ĠOn PaymentMethod Selected Callback ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . on PaymentMethod Selected Callback Ġ= Ġon PaymentMethod Selected Callback ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Stored Payment Removed Callback ( on Stored Payment Removed Callback : ĠOn Stored Payment Removed Callback ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . on Stored Payment Removed Callback Ġ= Ġon Stored Payment Removed Callback ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġremove PaymentMethod With Id ( id : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġposition ToRemove Ġ= Ġpayment Methods . indexOf First Ġ{ Ġit Ġis ĠStored PaymentMethod Model Ġ&& Ġit . id Ġ== Ġid Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( position ToRemove Ġ== Ġ- 1 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLogger . e ( TAG , Ġ" Cannot Ġremove Ġstored Ġpayment Ġmethod Ġbecause Ġit Ġcannot Ġbe Ġfound .") ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpayment Methods . remove At ( position ToRemove ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotify Item Removed ( position ToRemove ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠBase ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( view Type ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠP AY MENT _ METHO DS _ HEADER Ġ-> ĠHeader VH ( getView ( parent , ĠR . layout . payment _ methods _ list _ header )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSTO RED _ PAYMENT _ METHOD Ġ-> ĠStored PaymentMethod VH ( getView ( parent , ĠR . layout . re mov able _ payment _ methods _ list _ item )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠP AY MENT _ METHOD Ġ-> ĠPayment Method VH ( getView ( parent , ĠR . layout . payment _ methods _ list _ item )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG IFT _ CARD _ PAYMENT _ METHOD Ġ-> ĠG ift Card PaymentMethod VH ( getView ( parent , ĠR . layout . payment _ methods _ list _ item )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠP AY MENT _ METHO DS _ NOTE Ġ-> ĠNote VH ( getView ( parent , ĠR . layout . payment _ methods _ list _ note )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġthrow ĠCheckout Exception (" Unexpected Ġview Type Ġon ĠonCreate ViewHolder Ġ- Ġ$ view Type ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem ViewType ( position : ĠInt ): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ]. getView Type () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠBase ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen Ġ( holder ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠHeader VH Ġ-> Ġbind Header ( holder , Ġposition ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠStored PaymentMethod VH Ġ-> Ġbind Stored PaymentMethod ( holder , Ġposition ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠPayment Method VH Ġ-> Ġbind PaymentMethod ( holder , Ġposition ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠG ift Card PaymentMethod VH Ġ-> Ġbind Gift Card PaymentMethod ( holder , Ġposition ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠNote VH Ġ-> Ġbind Note ( holder , Ġposition ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Header ( holder : ĠHeader VH , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġheader Ġ= Ġget Header At ( position ) ĊĠĠĠĠĠĠĠ Ġholder . title . setText ( header . title Res Id ) ĊĠĠĠĠĠĠĠ Ġwith ( holder . action ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( header . action Res Id Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġvisibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġvisibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Text ( header . action Res Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset OnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Header Action Click ( header ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Stored PaymentMethod ( holder : ĠStored PaymentMethod VH , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstored PaymentMethod Ġ= Ġget Stored PaymentMethod At ( position ) ĊĊĠĠĠĠĠĠĠ Ġwhen Ġ( stored PaymentMethod ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠStored Card Model Ġ-> Ġbind Stored Card ( holder , Ġstored PaymentMethod ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠGeneric Stored Model Ġ-> Ġbind Generic Stored ( holder , Ġstored PaymentMethod ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġholder . item View . findViewById < Frame Layout >( R . id . payment _ method _ item _ under lay _ button ). setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġshow Remove Stored Payment Dialog ( holder . item View , Ġstored PaymentMethod ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ( holder . item View Ġas ? ĠAd yen Swipe To Re veal Layout )?. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Under lay Listener Ġ{ Ġview Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Under lay Expand Listener ?. invoke ( view ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthis . setOn Main ClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Stored PaymentMethod Click ( stored PaymentMethod ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Drag Locked (! stored PaymentMethod . is Remov able ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġshow Remove Stored Payment Dialog ( item View : ĠView , Ġstored PaymentMethod Model : ĠStored PaymentMethod Model ) Ġ{ ĊĠĠĠĠĠĠĠ ĠAlertDialog . Builder ( item View . context ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setTitle ( R . string . checkout _ gift card _ remove _ gift _ cards _ title ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setMessage ( R . string . checkout _ remove _ stored _ payment _ method _ body ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Positive Button ( R . string . checkout _ gift card _ remove _ gift _ cards _ positive _ button ) Ġ{ Ġdialog , Ġ_ Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Stored Payment Removed Callback ?. on Stored PaymentMethod Removed ( stored PaymentMethod Model ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdialog . dismiss () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Negative Button ( R . string . checkout _ gift card _ remove _ gift _ cards _ negative _ button ) Ġ{ Ġdialog , Ġ_ Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( item View Ġas ? ĠAd yen Swipe To Re veal Layout )?. collapse Under lay () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdialog . dismiss () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. show () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Stored Card ( holder : ĠStored PaymentMethod VH , Ġstored Card Model : ĠStored Card Model ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= Ġholder . item View . context ĊĠĠĠĠĠĠĠ Ġholder . text . text Ġ= Ġcontext . getString ( R . string . card _ number _ 4 digit , Ġstored Card Model . last Four ) ĊĠĠĠĠĠĠĠ Ġimage Loader . load ( stored Card Model . image Id , Ġholder . logo ) ĊĠĠĠĠĠĠĠ Ġholder . detail . text Ġ= ĠDate Utils . parse Date To View ( stored Card Model . expiry Month , Ġstored Card Model . expiry Year ) ĊĠĠĠĠĠĠĠ Ġholder . detail . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġholder . end Text . visibility Ġ= ĠView . GONE ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Generic Stored ( holder : ĠStored PaymentMethod VH , Ġgeneric Stored Model : ĠGeneric Stored Model ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . text . text Ġ= Ġgeneric Stored Model . name ĊĠĠĠĠĠĠĠ Ġholder . detail . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġimage Loader . load ( generic Stored Model . image Id , Ġholder . logo ) ĊĠĠĠĠĠĠĠ Ġholder . end Text . visibility Ġ= ĠView . GONE ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind PaymentMethod ( holder : ĠPayment Method VH , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayment Method Ġ= Ġget PaymentMethod At ( position ) ĊĊĠĠĠĠĠĠĠ Ġholder . text . text Ġ= Ġpayment Method . name ĊĠĠĠĠĠĠĠ Ġholder . detail . visibility Ġ= ĠView . GONE ĊĊĠĠĠĠĠĠĠ Ġholder . logo . setBorder Enabled ( payment Method . draw Icon Border ) ĊĠĠĠĠĠĠĠ Ġimage Loader . load ( payment Method . icon , Ġholder . logo ) ĊĊĠĠĠĠĠĠĠ Ġholder . item View . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon PaymentMethod Click ( payment Method ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġholder . end Text . visibility Ġ= ĠView . GONE ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Gift Card PaymentMethod ( holder : ĠG ift Card PaymentMethod VH , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgift Card PaymentMethod Ġ= Ġget Gift Card PaymentMethod At ( position ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= Ġholder . item View . context ĊĠĠĠĠĠĠĠ Ġholder . text . text Ġ= Ġcontext . getString ( R . string . card _ number _ 4 digit , Ġgift Card PaymentMethod . last Four ) ĊĠĠĠĠĠĠĠ Ġimage Loader . load ( gift Card PaymentMethod . image Id , Ġholder . logo ) ĊĠĠĠĠĠĠĠ Ġif Ġ( gift Card PaymentMethod . transaction Limit Ġ== Ġnull Ġ|| Ġgift Card PaymentMethod . shop per Locale Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . detail . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . detail . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġvalue Ġ= ĠCurrency Utils . format Amount ( gift Card PaymentMethod . transaction Limit , Ġgift Card PaymentMethod . shop per Locale ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . detail . text Ġ= Ġcontext . getString ( R . string . checkout _ gift card _ max _ transaction _ limit , Ġvalue ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( gift Card PaymentMethod . amount Ġ== Ġnull Ġ|| Ġgift Card PaymentMethod . shop per Locale Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . end Text . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . end Text . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġvalue Ġ= ĠCurrency Utils . format Amount ( gift Card PaymentMethod . amount , Ġgift Card PaymentMethod . shop per Locale ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . end Text . text Ġ= Ġcontext . getString ( R . string . checkout _ negative _ amount , Ġvalue ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġholder . item View . setOnClickListener ( null ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbind Note ( holder : ĠNote VH , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġheader Ġ= Ġget Note At ( position ) ĊĠĠĠĠĠĠĠ Ġholder . note . text Ġ= Ġheader . note ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Header At ( position : ĠInt ): ĠPayment Method Header Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ] Ġas ĠPayment Method Header ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Stored PaymentMethod At ( position : ĠInt ): ĠStored PaymentMethod Model Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ] Ġas ĠStored PaymentMethod Model ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget PaymentMethod At ( position : ĠInt ): ĠPayment Method Model Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ] Ġas ĠPayment Method Model ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Gift Card PaymentMethod At ( position : ĠInt ): ĠG ift Card PaymentMethod Model Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ] Ġas ĠG ift Card PaymentMethod Model ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Note At ( position : ĠInt ): ĠPayment Method Note Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġpayment Methods [ position ] Ġas ĠPayment Method Note ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġon Stored PaymentMethod Click ( stored PaymentMethod Model : ĠStored PaymentMethod Model ) Ġ{ ĊĠĠĠĠĠĠĠ Ġon PaymentMethod Selected Callback ?. on Stored PaymentMethod Selected ( stored PaymentMethod Model ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġon PaymentMethod Click ( payment Method : ĠPayment Method Model ) Ġ{ ĊĠĠĠĠĠĠĠ Ġon PaymentMethod Selected Callback ?. on PaymentMethod Selected ( payment Method ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġon Header Action Click ( header : ĠPayment Method Header ) Ġ{ ĊĠĠĠĠĠĠĠ Ġon PaymentMethod Selected Callback ?. on Header Action Selected ( header ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget View ( parent : ĠViewGroup , Ġid : ĠInt ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠLayoutInflater . from ( parent . context ). inflate ( id , Ġparent , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval ĠTAG Ġ= ĠLog Util . getTag () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠOn PaymentMethod Selected Callback Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġon Stored PaymentMethod Selected ( stored PaymentMethod Model : ĠStored PaymentMethod Model ) ĊĠĠĠĠĠĠĠ Ġfun Ġon PaymentMethod Selected ( payment Method : ĠPayment Method Model ) ĊĠĠĠĠĠĠĠ Ġfun Ġon Header Action Selected ( header : ĠPayment Method Header ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠOn Stored Payment Removed Callback Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġon Stored PaymentMethod Removed ( stored PaymentMethod Model : ĠStored PaymentMethod Model ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠStored PaymentMethod VH ( root View : ĠView ) Ġ: ĠBase ViewHolder ( root View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġtext : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ text ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġdetail : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ detail ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġlogo : ĠRound Corner ImageView Ġ= Ġroot View . findViewById ( R . id . imageView _ logo ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġend Text : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ end Text ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠPayment Method VH ( root View : ĠView ) Ġ: ĠBase ViewHolder ( root View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġtext : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ text ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġdetail : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ detail ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġlogo : ĠRound Corner ImageView Ġ= Ġroot View . findViewById ( R . id . imageView _ logo ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġend Text : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ end Text ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠG ift Card PaymentMethod VH ( root View : ĠView ) Ġ: ĠBase ViewHolder ( root View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġtext : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ text ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġdetail : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ detail ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġlogo : ĠRound Corner ImageView Ġ= Ġroot View . findViewById ( R . id . imageView _ logo ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġend Text : ĠTextView Ġ= Ġroot View . findViewById ( R . id . textView _ end Text ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠHeader VH ( root View : ĠView ) Ġ: ĠBase ViewHolder ( root View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġtitle : ĠTextView Ġ= Ġroot View . findViewById ( R . id . payment _ method _ header _ title ) ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġaction : ĠTextView Ġ= Ġroot View . findViewById ( R . id . payment _ method _ header _ action ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠNote VH ( root View : ĠView ) Ġ: ĠBase ViewHolder ( root View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinternal Ġval Ġnote : ĠTextView Ġ= Ġroot View . findViewById ( R . id . payment _ method _ note ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġopen Ġclass ĠBase ViewHolder ( root View : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( root View ) Ċ } Ċ