package Ġio . flater lab . mes hex am . exam ination . ui . joined Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . View Ċ import Ġandroidx . activity . add Callback Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ import Ġio . flater lab . mes hex am . android base . View Binding Fragment Ċ import Ġio . flater lab . mes hex am . android base . View Binding Provider Ċ import Ġio . flater lab . mes hex am . android base . ext . show Alert Ċ import Ġio . flater lab . mes hex am . android base . to Bundle Args Ċ import Ġio . flater lab . mes hex am . exam ination . R Ċ import Ġio . flater lab . mes hex am . exam ination . databinding . Fragment Joined Binding Ċ import Ġio . flater lab . mes hex am . exam ination . ui . exam . Exam Attempt Launcher Ċ Ċ @ Android EntryPoint Ċ internal Ġclass ĠJo ined Fragment Ġ: ĠView Binding Fragment < Fragment Joined Binding >() Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠJo ined ViewModel Ġby Ġvm () ĊĊĠĠĠ Ġoverride Ġval Ġview Binder : ĠView Binding Provider < Fragment Joined Binding > ĊĠĠĠĠĠĠĠ Ġget () Ġ= ĠFragment Joined Binding :: inflate ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġrequire Activity (). on Back Pressed Dispatcher . add Callback ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Back Pressed () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠviewModel . exam Name . observe ( view Lifecycle Owner , Ġbinding . tv Joined Exam Name :: setText ) ĊĠĠĠĠĠĠĠ ĠviewModel . command Exam Started . observe ( view Lifecycle Owner ) Ġ{ Ġ( exam Id , Ġattempt Id ) Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . id . action _ joined Fragment _ to _ exam Fragment , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠExam Attempt Launcher ( exam Id , Ġattempt Id ). to Bundle Args (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠviewModel . command Show Leave Prompt . observe ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġshow Alert ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmessage Ġ= ĠgetString ( R . string . exam _ join _ leave Confirm Message ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpositive Ġ= ĠgetString ( R . string . common _ yes ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnegative Ġ= ĠgetString ( R . string . common _ no ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpositive Callback Ġ= Ġ{ ĠviewModel . on Leave Clicked () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠviewModel . command Leave Exam . observe ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). pop Back Stack () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }