package Ġorg . m if os . mobile . cn . ui . m if os . identification details Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroid . view .* Ċ import Ġcom . google . gson . Gson Ċ import Ġkotlinx . android . synt hetic . main . fragment _ identification _ details .* Ċ import Ġorg . m if os . mobile . cn . data . models . customer . identification . Identification Ċ import Ġorg . m if os . mobile . cn . data . models . customer . identification . Scan Card Ċ import Ġorg . m if os . mobile . cn . R Ċ import Ġorg . m if os . mobile . cn . ui . adapter . Identification Scan Adapter Ċ import Ġorg . m if os . mobile . cn . ui . base . M if os Base Activity Ċ import Ġorg . m if os . mobile . cn . ui . base . M if os Base Fragment Ċ import Ġorg . m if os . mobile . cn . ui . m if os . view Scan Card . View Scan Card Activity Ċ import Ġorg . m if os . mobile . cn . ui . utils . Constant Keys Ċ import Ġorg . m if os . mobile . cn . ui . utils . Date Utils Ċ import Ġjava . util .* Ċ import Ġjavax . annotation . Nullable Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠIdent ification Details Fragment : M if os Base Fragment (), Identification Details Contract . View , ĠIdent ification Scan Adapter . On ItemClickListener Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġidentification Details Presenter : ĠIdent ification De at ils Presenter ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġidentification Scan Adapter Ġ: ĠIdent ification Scan Adapter ĊĊĠĠĠ Ġlateinit Ġvar Ġroot View : ĠView ĊĊĠĠĠ Ġlateinit Ġvar Ġcustomer Identifier : ĠString ĊĠĠĠ Ġlateinit Ġvar Ġidentification Card : ĠIdent ification ĊĠĠĠ Ġlateinit Ġvar Ġscan Cards : ĠList < Scan Card > ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance ( customer Identifier : String , identification : ĠIdent ification ): ĠIdent ification Details Fragment { ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfragment Ġ= ĠIdent ification Details Fragment () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġargs Ġ= ĠBundle () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġargs . putString ( Constant Keys . CUSTOMER _ IDENTIFIER , Ġcustomer Identifier ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġargs . put Parcelable ( Constant Keys . IDENT IFICATION _ CARD , identification ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfragment . arguments Ġ= Ġargs ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfragment ĊĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġif Ġ( arguments Ġ!= Ġnull ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcustomer Identifier Ġ= Ġarguments !!. getString ( Constant Keys . CUSTOMER _ IDENTIFIER ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġidentification Card Ġ= Ġarguments !!. get Parcelable ( Constant Keys . IDENT IFICATION _ CARD ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġset Has Options Menu ( true ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Nullable ĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġ@ Nullable Ġcontainer : ĠViewGroup ?, @ Nullable ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġroot View Ġ= Ġinflater . inflate ( R . layout . fragment _ identification _ details , container , false ) ĊĠĠĠĠĠĠĠ Ġ( activity Ġas ĠM if os Base Activity ). activity Component . inject ( this ) ĊĠĠĠĠĠĠĠ Ġidentification Details Presenter . attach View ( this ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġroot View ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġshow User Interface () ĊĠĠĠĠĠĠĠ Ġinitialize RecyclerView () ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ Ġfetch Identification Scan Card () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġfetch Identification Scan Card () Ġ{ ĊĠĠĠĠĠĠĠ Ġtv _ sc ans _ status . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġlayout _ error . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġidentification Details Presenter . fetch Identification Scan Cards ( customer Identifier , Ġidentification Card . number !! ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow User Interface () Ġ{ ĊĠĠĠĠĠĠĠ Ġtv _ number . text Ġ= Ġidentification Card . number ĊĠĠĠĠĠĠĠ Ġtv _ issuer . text Ġ= Ġidentification Card . issuer ĊĠĠĠĠĠĠĠ Ġtv _ type . text Ġ= Ġidentification Card . type ĊĊĠĠĠĠĠĠĠ Ġval Ġcalendar : ĠCalendar Ġ= ĠCalendar . getInstance () ĊĠĠĠĠĠĠĠ Ġcalendar . set ( Calendar . YEAR , Ġidentification Card . expiration Date !!. year !! ) ĊĠĠĠĠĠĠĠ Ġcalendar . set ( Calendar . MONTH , Ġidentification Card . expiration Date !!. month !! Ġ- Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġcalendar . set ( Calendar . DAY _ OF _ MONTH , Ġidentification Card . expiration Date !!. day !! ) ĊĠĠĠĠĠĠĠ Ġtv _ expiration _ date . text Ġ= ĠDate Utils . convert Server Date ( calendar ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġinitialize RecyclerView () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlayout manager Ġ= ĠLinearLayoutManager ( activity ) ĊĠĠĠĠĠĠĠ Ġlayout manager . orientation Ġ= ĠLinearLayoutManager . VERTICAL ĊĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . layout Manager Ġ= Ġlayout manager ĊĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . set Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠ Ġidentification Scan Adapter . set on ItemClickListener ( this ) ĊĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . adapter Ġ= Ġidentification Scan Adapter ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow Scan Cards ( scan Cards : ĠList < Scan Card >) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . scan Cards Ġ= Ġscan Cards ĊĠĠĠĠĠĠĠ Ġshow RecyclerView ( true ) ĊĠĠĠĠĠĠĠ Ġidentification Scan Adapter . set Scan Cards ( scan Cards ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow RecyclerView ( status : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( status ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout _ error . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrv _ sc ans _ uploaded . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout _ error . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġtv _ sc ans _ status . visibility Ġ= ĠView . GONE ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow Sc ans Status ( message : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġshow RecyclerView ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow Error ( message : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġshow RecyclerView ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Item Click ( view : ĠView , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent ( activity , ĠView Scan Card Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Constant Keys . CUSTOMER _ IDENTIFIER , Ġcustomer Identifier ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Constant Keys . IDENT IFICATION _ NUMBER , Ġidentification Card . number ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Constant Keys . IDENT IFICATION _ SCAN _ CARD , ĠGson (). toJson ( scan Cards )) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Constant Keys . POSITION , Ġposition ) ĊĠĠĠĠĠĠĠ ĠstartActivity ( intent ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate Options Menu ( menu : ĠMenu ?, Ġinflater : ĠMenu Inflater ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġinflater !!. inflate ( R . menu . menu _ identification _ card , menu ) ĊĠĠĠĠĠĠĠ Ġsuper . onCreate Options Menu ( menu , Ġinflater ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠĠĠĠĠ Ġidentification Details Presenter . detach View () ĊĠĠĠ Ġ} Ċ Ċ }