package Ġcom . blog . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . databinding . Observable ArrayList Ċ import Ġandroidx . lifecycle . Android ViewModel Ċ import Ġandroidx . lifecycle . Mediator LiveData Ċ import Ġcom . blog . model . Blog Tag Model Ċ import Ġcom . blog . model . Blog Url Ċ import Ġcom . blog . model . J soup Manager Ċ import Ġcom . common . base . Base Entity Ċ import Ġcom . common . base . ENTITY _ ERROR Ċ import Ġcom . common . base . ENTITY _ LOADING Ċ import Ġcom . common . base . ENTITY _ SUCCESS Ċ import Ġio . reactivex . js oup . network . manager . Rx J soup Net Work Ċ import Ġio . reactivex . js oup . network . manager . Rx J soup Net Work Listener Ċ import Ġorg . js oup . nodes . Document Ċ Ċ /** Ċ Ġ* Ġby Ġy Ġon Ġ 2 4 / 1 1 / 2 0 1 7 . Ċ Ġ*/ Ċ Ċ class ĠBlog Tag ViewModel ( application : ĠApplication ) Ġ: ĠAndroid ViewModel ( application ), ĠRx J soup Net Work Listener < Observable ArrayList < Blog Tag Model >> Ġ{ ĊĊĠĠĠ Ġval Ġblog Tag : ĠMed iator LiveData < Base Entity < Observable ArrayList < Blog Tag Model >>> Ġ= ĠMed iator LiveData () ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠRx J soup Net Work . getInstance (). cancel ( Blog Tag ViewModel :: class . java . simple Name ) ĊĠĠĠĠĠĠĠ ĠRx J soup Net Work . getInstance (). get Api ( Blog Tag ViewModel :: class . java . simple Name , ĠBlog Url . B LOG _ BASE _ URL Ġ+ ĠBlog Url . B LOG _ TAG _ URL , Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Net Work Complete () Ġ{ ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Net Work Error ( e : ĠThrowable ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġblog Tag . value Ġ= ĠBase Entity ( type Ġ= ĠENT ITY _ ERROR ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget T ( document : ĠDocument ): ĠObservable ArrayList < Blog Tag Model > Ġ= ĠJ soup Manager . getTag ( document ) ĊĊĠĠĠ Ġoverride Ġfun Ġon Net Work Start () Ġ{ ĊĠĠĠĠĠĠĠ Ġblog Tag . value Ġ= ĠBase Entity ( type Ġ= ĠENT ITY _ LOADING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Net Work Success ( t : ĠObservable ArrayList < Blog Tag Model >) Ġ{ ĊĠĠĠĠĠĠĠ Ġblog Tag . value Ġ= ĠBase Entity ( ENTITY _ SUCCESS , Ġ 0 , Ġt ) ĊĠĠĠ Ġ} Ċ } Ċ