package Ġcom . ph ag gu . file tracker . file list Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġcom . ph ag gu . file tracker . database . File Database Ċ import Ġcom . ph ag gu . file tracker . database . File Detail With Last Movement Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . Job Ċ import Ġtim ber . log . Tim ber Ċ Ċ class ĠFile List ViewModel ( application : ĠApplication , Ġshow Out List : ĠBoolean ): ĠViewModel () Ġ{ ĊĠĠĠ Ġprivate Ġvar ĠviewModel Job Ġ= ĠJob () ĊĠĠĠ Ġprivate Ġval Ġui Scope Ġ= ĠCor outine Scope ( Dispatch ers . Main Ġ+ ĠviewModel Job ) ĊĠĠĠ Ġprivate Ġval Ġdatabase Dao = ĠFile Database . getInstance ( application ). file Database Dao ĊĊĠĠĠ Ġprivate Ġval Ġ_ files With Last Movement : ĠLive Data < List < File Detail With Last Movement >> Ġ= Ġdatabase Dao . getAll Files With Last Movement ( show Out List ) ĊĠĠĠĠ Ġval Ġfiles With Last Movement : ĠLive Data < List < File Detail With Last Movement >> Ġget () Ġ= Ġ_ files With Last Movement ĊĊĠĠĠ Ġprivate Ġval Ġ_ navigate To Next Fragment Ġ= ĠMutable LiveData < Int ?> () ĊĠĠĠ Ġval Ġnavigate To Next Fragment : ĠLive Data < Int ?> Ġget () Ġ= Ġ_ navigate To Next Fragment ĊĊĠĠĠ Ġprivate Ġval Ġ_ navigate To Scanner Ġ= ĠMutable LiveData < Boolean >( false ) ĊĠĠĠ Ġval Ġnavigate To Scanner : ĠLive Data < Boolean > get () Ġ= Ġ_ navigate To Scanner ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠTim ber . i (" Initial ising ĠViewModel ") ĊĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon Item Click ( file Id : ĠInt ){ ĊĠĠĠĠĠĠĠ Ġ_ navigate To Next Fragment . value Ġ= Ġfile Id ĊĠĠĠ Ġ} ĊĠĠĠ Ġfun Ġdone Navig ating To Next Fragment (){ ĊĠĠĠĠĠĠĠ Ġ_ navigate To Next Fragment . value Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġ_ navigate To Scanner . value Ġ= Ġfalse ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon Navigate To Scanner (){ ĊĠĠĠĠĠĠĠ Ġ_ navigate To Scanner . value Ġ= Ġtrue ĊĠĠĠ Ġ} Ċ Ċ }