package Ġcom . vn gr s . vn gr s . status details . view ĊĊ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġcom . squareup . pic asso . Pic asso Ċ import Ġcom . vn gr s . base . view . Base Fragment Ċ import Ġcom . vn gr s . util . TextUtils Ċ Ċ import Ġcom . vn gr s . vn gr s . R Ċ import Ġcom . vn gr s . vn gr s . status details . presenter . Status Details Presenter Ċ import Ġcom . vn gr s . vn gr s . status details . presenter . Status Details Presenter Impl Ċ import Ġcom . vn gr s . vn gr s . twitter search . repo . Twitter Cloud Repo Impl Ċ import Ġcom . vn gr s . vn gr s . twitter search . repo . dto . Status Ċ import Ġkotlinx . android . synt hetic . main . fragment _ status _ details .* Ċ Ċ const Ġval ĠARG _ PARAM _ STATUS _ ID Ġ= Ġ" STATUS _ ID " Ċ const Ġval ĠARG _ PARAM _ STATUS Ġ= Ġ" STATUS " Ċ Ċ /** Ċ Ġ* ĠA Ġsimple Ġ[ Fragment ] Ġsubclass . Ċ Ġ* ĠUse Ġthe Ġ[ Status Details Fragment . newInstance ] Ġfactory Ġmethod Ġto Ċ Ġ* Ġcreate Ġan Ġinstance Ġof Ġthis Ġfragment . Ċ Ġ* Ċ Ġ*/ Ċ class ĠStatus Details Fragment Ġ: ĠBase Fragment < Status Details View , ĠStatus Details Presenter >(), ĠStatus Details View Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġm Status : ĠStatus ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Presenter (): ĠStatus Details Presenter Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠStatus Details Presenter Impl ( Twitter Cloud Repo Impl ()) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġvar Ġm Status Id : ĠString ? Ġ= Ġnull ĊĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinflater . inflate ( R . layout . fragment _ status _ details , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Activity Created ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Activity Created ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( savedInstanceState Ġ!= Ġnull ) Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġshow Status Details Success ( savedInstanceState . get Parcelable < Status >( ARG _ PARAM _ STATUS )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Save InstanceState ( out State ) ĊĊĠĠĠĠĠĠĠ Ġout State . put Parcelable ( ARG _ PARAM _ STATUS , Ġm Status ) ĊĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġstatus Details Swipe Refresh Layout . setOn Refresh Listener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġupdate Fragment ( m Status Id ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġupdate Fragment ( status Id : ĠString ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġm Status Id Ġ= Ġstatus Id ĊĠĠĠĠĠĠĠ Ġget Presenter (). getStatus Details ( m Status Id ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġshow Loading () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġstatus Details Swipe Refresh Layout . is Refresh ing Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġstatus Details Error TextView . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġstatus Details Error TextView . text Ġ= ĠText Utils . getString ( R . string . loading ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġhide Loading () Ġ{ ĊĠĠĠĠĠĠĠ Ġstatus Details Swipe Refresh Layout . is Refresh ing Ġ= Ġfalse ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġshow Status Details Success ( status : ĠStatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm Status Ġ= Ġstatus ĊĠĠĠĠĠĠĠ Ġstatus Details Error TextView . visibility Ġ= ĠView . GONE ĊĊĠĠĠĠĠĠĠ Ġstatus Details Container . visibility Ġ= ĠView . VISIBLE ĊĊĠĠĠĠĠĠĠ ĠPic asso . get (). load ( status . user ?. profile Background Image ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. placeholder ( R . drawable . default _ image _ thumbnail ). into ( cover ImageView ) ĊĊĠĠĠĠĠĠĠ ĠPic asso . get (). load ( status . user ?. profile Image ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. placeholder ( R . drawable . default _ image _ thumbnail ). into ( user Profile ImageView ) ĊĊĠĠĠĠĠĠĠ Ġstatus Number TextView . text Ġ= Ġstatus . ret weet Count . toString () ĊĠĠĠĠĠĠĠ Ġfollowing Number TextView . text Ġ= Ġstatus . user ?. followers Count . toString () ĊĊĠĠĠĠĠĠĠ Ġstatus TextView . text Ġ= Ġstatus . text ĊĊĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġshow Status Details Failure ( msg : ĠString ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġstatus Details Error TextView . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġstatus Details Error TextView . text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠString . format ( TextUtils . getString ( R . string . something _ w ent _ wrong _ tap _ to _ retry ), Ġmsg ) ĊĊĠĠĠ Ġ} Ċ Ċ } Ċ