package Ġcom . example . ant ique mall . ui . favorites Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . View Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġcom . example . ant ique mall . base . Base Fragment With ViewModel Ċ import Ġcom . example . ant ique mall . databinding . Fragment F avorites Binding Ċ import Ġcom . example . ant ique mall . ui . favorites . F avorites Fragment Directions . action F avorites Fragment To Product Detail Fragment Ċ import Ġcom . example . ant ique mall . ui . home . Products Adapter Ċ import Ġcom . example . ant ique mall . ui . vm . F avorites ViewModel Ċ import Ġcom . example . ant ique mall . util . observe Ċ import Ġdagger . h ilt . android . Android EntryPoint ĊĊ Ċ @ Android EntryPoint Ċ class ĠF avorites Fragment Ġ: ĠBase Fragment With ViewModel < Fragment F avorites Binding , ĠF avorites ViewModel >( ĊĠĠĠ ĠFragment F avorites Binding :: inflate Ċ ) Ġ{ ĊĠĠĠ Ġoverride Ġval ĠviewModel : ĠF avorites ViewModel Ġby Ġview Models () ĊĊĠĠĠ Ġprivate Ġval Ġfavor ites Products Adapter Ġ= ĠProducts Adapter () ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġset Binding () ĊĠĠĠĠĠĠĠ Ġinit Adapter () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġset Binding () Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġinit Observer () Ġ{ ĊĠĠĠĠĠĠĠ Ġobserve ( viewModel . favorites Products Items ) Ġ{ Ġproduct List Items Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfavor ites Products Adapter . products List Items Ġ= Ġproduct List Items ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Adapter () Ġ{ ĊĠĠĠĠĠĠĠ Ġfavor ites Products Adapter . setOn Product Item CL ick Listener Ġ{ ĠproductId Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġaction Ġ= Ġaction F avorites Fragment To Product Detail Fragment (). also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . productId Ġ= ĠproductId ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate Directions ( action ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġbinding . rv F avorites Products . adapter Ġ= Ġfavor ites Products Adapter ĊĠĠĠ Ġ} Ċ }