package Ġcom . ay ni . hero es at work . views . activities Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġandroid . support . v 7 . widget . Linear LayoutManager Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . widget . TextView Ċ import Ġbutter knife . BindView Ċ import Ġbutter knife . B utter Kn ife Ċ import Ġbutter knife . OnClick Ċ import Ġcom . ay ni . hero es at work . R Ċ import Ġcom . ay ni . hero es at work . application . Date Utils Ċ import Ġcom . ay ni . hero es at work . application . Hero es At Work Constants Ċ import Ġcom . ay ni . hero es at work . application . Preference Helper Ċ import Ġcom . ay ni . hero es at work . application . launch Activity Ċ import Ġcom . ay ni . hero es at work . models . Game Ċ import Ġcom . ay ni . hero es at work . models . Player Ċ import Ġcom . ay ni . hero es at work . views . adapters . Hero es Adapter Ċ import Ġcom . google . gson . Gson Ċ import Ġjava . text . SimpleDateFormat Ċ import Ġjava . util .* Ċ Ċ class ĠGame Detail Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġ@ BindView ( R . id . hero es _ recycler _ view ) ĊĠĠĠ Ġlateinit Ġvar Ġm Hero es RecyclerView : ĠRecyclerView ĊĊĠĠĠ Ġ@ BindView ( R . id . remaining _ text ) ĊĠĠĠ Ġlateinit Ġvar Ġm Remaining Text Ġ: ĠTextView ĊĊĠĠĠ Ġ@ BindView ( R . id . current _ score _ text ) ĊĠĠĠ Ġlateinit Ġvar ĠmCurrent Score Text Ġ: ĠTextView ĊĊĠĠĠ Ġ@ BindView ( R . id . days _ left _ text ) ĊĠĠĠ Ġlateinit Ġvar Ġm Days Left Text Ġ: ĠTextView ĊĊĠĠĠ Ġ@ BindView ( R . id . days _ left _ subtitle ) ĊĠĠĠ Ġlateinit Ġvar Ġm Days Left Subtitle Ġ: Ġ ĠTextView ĊĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Game Ġ: ĠGame ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Me Ġ: ĠPlayer ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . game _ detail _ act ) ĊĊĠĠĠĠĠĠĠ ĠB utter Kn ife . bind ( this ) ĊĊĠĠĠĠĠĠĠ Ġval Ġgame Json Ġ= Ġintent . getString Extra ( Hero es At Work Constants . GAME _ SELECTED _ B UNDLE _ KEY ) ĊĠĠĠĠĠĠĠ Ġm Game Ġ= ĠGson (). fromJson ( game Json , ĠGame :: class . java ) ĊĊĠĠĠĠĠĠĠ ĠsetTitle ( m Game . name ) ĊĊĠĠĠĠĠĠĠ Ġval Ġmy Member Id Ġ= ĠPreference Helper . getInt Preference ( Hero es At Work Constants . MEMBER _ ID _ PREFER ENCE _ KEY ) ĊĠĠĠĠĠĠĠ Ġm Me Ġ= Ġm Game . getPlayer ( my Member Id ) !! ĊĊĠĠĠĠĠĠĠ Ġval Ġpoints Per Hero Ġ= Ġm Game . get Setting ( Hero es At Work Constants . SETTING _ POINTS _ PER _ HER O ) !!. value . toFloat () ĊĊĠĠĠĠĠĠĠ Ġm Remaining Text . text Ġ= Ġ"% . 0 f ". format ( points Per Hero Ġ- Ġm Me . g iver Score ) ĊĠĠĠĠĠĠĠ ĠmCurrent Score Text . text Ġ= Ġ"% . 0 f ". format ( m Me . player Score ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtoday Ġ= ĠDate Utils . getStart OfDay ( Date ()) ĊĠĠĠĠĠĠĠ Ġval ĠendDate Setting Ġ= Ġm Game . get Setting ( Hero es At Work Constants . SETTING _ END _ DATE ) ĊĠĠĠĠĠĠĠ Ġval ĠendDate Ġ= ĠSimpleDateFormat ( Hero es At Work Constants . DATE _ FORMAT ). parse ( endDate Setting !!. value ) ĊĠĠĠĠĠĠĠ Ġval Ġdiff Ġ= Ġ( endDate . time Ġ- Ġtoday . time ) Ġ/ Ġ( 2 4 Ġ* Ġ 6 0 Ġ* Ġ 6 0 Ġ* Ġ 1 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġm Days Left Text . text Ġ= Ġdiff . toString () ĊĠĠĠĠĠĠĠ Ġm Days Left Subtitle . text Ġ= Ġif Ġ( diff Ġ== Ġ 1 L )" day Ġleft " Ġelse Ġ" days Ġleft " ĊĊĠĠĠĠĠĠĠ Ġm Hero es RecyclerView . set Has Fixed Size ( true ) ĊĠĠĠĠĠĠĠ Ġm Hero es RecyclerView . layout Manager Ġ= ĠLinearLayoutManager ( this , ĠLinearLayoutManager . VERTICAL , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġm Hero es RecyclerView . adapter Ġ= ĠHero es Adapter ( m Game . leader Board . players , Ġm Game ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ OnClick ( R . id . current _ score _ view ) ĊĠĠĠ Ġinternal Ġfun Ġon Current Score View Click () Ġ{ ĊĠĠĠĠĠĠĠ Ġlaunch Activity < Game Points Activity >() ĊĠĠĠ Ġ} Ċ }