/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 Ġ- Ġpresent ĠIn structure , ĠInc . Ċ Ġ* Ċ Ġ* ĠĠĠĠ ĠThis Ġprogram Ġis Ġfree Ġsoftware : Ġyou Ġcan Ġredistribute Ġit Ġand / or Ġmodify Ċ Ġ* ĠĠĠĠ Ġit Ġunder Ġthe Ġterms Ġof Ġthe ĠGNU ĠGeneral ĠPublic ĠLicense Ġas Ġpublished Ġby Ċ Ġ* ĠĠĠĠ Ġthe ĠFree ĠSoftware ĠFoundation , Ġversion Ġ 3 Ġof Ġthe ĠLicense . Ċ Ġ* Ċ Ġ* ĠĠĠĠ ĠThis Ġprogram Ġis Ġdistributed Ġin Ġthe Ġhope Ġthat Ġit Ġwill Ġbe Ġuseful , Ċ Ġ* ĠĠĠĠ Ġbut ĠWITHOUT ĠANY ĠWARRANTY ; Ġwithout Ġeven Ġthe Ġimplied Ġwarranty Ġof Ċ Ġ* ĠĠĠĠ ĠMERCHANTABILITY Ġor ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE . Ġ ĠSee Ġthe Ċ Ġ* ĠĠĠĠ ĠGNU ĠGeneral ĠPublic ĠLicense Ġfor Ġmore Ġdetails . Ċ Ġ* Ċ Ġ* ĠĠĠĠ ĠYou Ġshould Ġhave Ġreceived Ġa Ġcopy Ġof Ġthe ĠGNU ĠGeneral ĠPublic ĠLicense Ċ Ġ* ĠĠĠĠ Ġalong Ġwith Ġthis Ġprogram . Ġ ĠIf Ġnot , Ġsee Ġ< http :// www . gnu . org / licenses />. Ċ Ġ* Ċ Ġ*/ Ċ package Ġcom . in structure . student . mob ius . assignment Details . submission Details . ui Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . in structure . canvas api 2 . models . Canvas Context Ċ import Ġcom . in structure . canvas api 2 . models . Course Ċ import Ġcom . in structure . canvas api 2 . utils . Api Prefs Ċ import Ġcom . in structure . canvas api 2 . utils . Context Keeper Ċ import Ġcom . in structure . canvas api 2 . utils . page view . Page View Ċ import Ġcom . in structure . canvas api 2 . utils . page view . Page View Url Param Ċ import Ġcom . in structure . inter actions . router . Route Ċ import Ġcom . in structure . inter actions . router . Router Params Ċ import Ġcom . in structure . p anda utils . utils .* Ċ import Ġcom . in structure . student . Submission Ċ import Ġcom . in structure . student . db . Db Ċ import Ġcom . in structure . student . db . getInstance Ċ import Ġcom . in structure . student . mob ius . assignment Details . submission Details .* Ċ import Ġcom . in structure . student . mob ius . common . Channel Source Ċ import Ġcom . in structure . student . mob ius . common . DB Source Ċ import Ġcom . in structure . student . mob ius . common . ui . Mob ius Fragment Ċ Ċ @ Page View ( url Ġ= Ġ"{ canvas Context }/ assignments /{ assignment Id }/ submissions ") Ċ class ĠSubmission Details Fragment Ġ: ĊĠĠĠ ĠMob ius Fragment < Submission Details Model , ĠSubmission Details Event , ĠSubmission Details Effect , ĠSubmission Details View , ĠSubmission Details ViewState >() Ġ{ ĊĊĠĠĠ Ġval Ġcanvas Context Ġby ĠParcel able Arg < Course >( key Ġ= ĠConst . CAN V AS _ CONTEXT ) ĊĊĠĠĠ Ġ@ get : Page View Url Param ( name Ġ= Ġ" assignment Id ") ĊĠĠĠ Ġval Ġassignment Id Ġby ĠLong Arg ( key Ġ= ĠConst . ASSIGN MENT _ ID ) ĊĠĠĠ Ġval Ġis Observer Ġby ĠBoolean Arg ( key Ġ= ĠConst . IS _ OB SERVER , Ġdefault Ġ= Ġfalse ) ĊĊĠĠĠ Ġoverride Ġfun Ġmake Effect Handler () Ġ= ĠSubmission Details Effect Handler () ĊĊĠĠĠ Ġoverride Ġfun Ġmake Update () Ġ= ĠSubmission Details Update () ĊĊĠĠĠ Ġoverride Ġfun Ġmake View ( in flater : ĠLayoutInflater , Ġparent : ĠViewGroup ) Ġ= ĊĠĠĠĠĠĠĠ ĠSubmission Details View ( in flater , Ġparent , Ġcanvas Context , Ġchild FragmentManager ) ĊĊĠĠĠ Ġoverride Ġfun Ġmake Presenter () Ġ= ĠSubmission Details Presenter ĊĊĠĠĠ Ġoverride Ġfun Ġmake Init Model () Ġ= ĠSubmission Details Model ( canvas Context Ġ= Ġcanvas Context , Ġassignment Id Ġ= Ġassignment Id , Ġis Observer Ġ= Ġis Observer ) ĊĊĠĠĠ Ġoverride Ġfun Ġget External Event Sources () Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ ĠChannel Source . getSource < Submission Details Shared Event , ĠSubmission Details Event > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( it ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠSubmission Details Shared Event . File Selected Ġ-> ĠSubmission Details Event . Attachment Clicked ( it . file ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠSubmission Details Shared Event . Audio Recording View La unched Ġ-> ĠSubmission Details Event . Audio Recording Clicked ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠSubmission Details Shared Event . Video Recording View La unched Ġ-> ĠSubmission Details Event . Video Recording Clicked ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠSubmission Details Shared Event . Submission Clicked Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠSubmission Details Event . Submission Clicked ( it . submission . attempt ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠSubmission Details Shared Event . Submission Attachment Clicked Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠSubmission Details Event . Submission And Attachment Clicked ( it . submission . attempt , Ġit . attachment ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠ ĠDB Source . of Single < Submission , ĠSubmission Details Event >( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDb . getInstance ( Context Keeper . app Context ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. submission Queries ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. getSub missions By Assignment Id ( assignment Id , ĠApi Prefs . user ?. id Ġ?: Ġ- 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) Ġ{ Ġsubmission Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( submission ?. progress Ġ== Ġ 1 0 0 . 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠA Ġsubmission Ġfor Ġthis Ġassignment Ġwas Ġfinished Ġ- Ġwe 'll Ġwant Ġto Ġreload Ġdata ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠSubmission Details Event . Submission Upload Finished ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠSubmission Ġis Ġeither Ġcurrently Ġbeing Ġuploaded , Ġor Ġthere Ġis Ġno Ġsubmission Ġbeing Ġuploaded Ġ- Ġdo Ġnothing ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġmake Route ( course : ĠCanvas Context , Ġassignment Id : ĠLong , Ġis Observer : ĠBoolean Ġ= Ġfalse ): ĠRoute Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbundle Ġ= Ġcourse . make Bundle Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Long ( Const . ASSIGN MENT _ ID , Ġassignment Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Boolean ( Const . IS _ OB SERVER , Ġis Observer ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRoute ( null , ĠSubmission Details Fragment :: class . java , Ġcourse , Ġbundle ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġvalid Route ( route : ĠRoute ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġroute . canvas Context Ġis ĠCourse Ġ&& ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( route . arguments . containsKey ( Const . ASSIGN MENT _ ID ) Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġroute . params Hash . containsKey ( Router Params . ASSIGN MENT _ ID )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance ( route : ĠRoute ): ĠSubmission Details Fragment ? Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! valid Route ( route )) Ġreturn Ġnull ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠIf Ġro uted Ġfrom Ġa ĠURL , Ġset Ġthe Ġbundle 's Ġassignment ĠID Ġfrom Ġthe Ġurl Ġvalue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( route . params Hash . containsKey ( Router Params . ASSIGN MENT _ ID )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġassignment Id Ġ= Ġroute . params Hash [ Router Params . ASSIGN MENT _ ID ]?. to Long () Ġ?: Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġroute . arguments . put Long ( Const . ASSIGN MENT _ ID , Ġassignment Id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠSubmission Details Fragment (). with Args ( route . arguments ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} Ċ Ċ } Ċ