package Ġinfo . mqtt . android . ext sample . components Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . content . Context Ċ import Ġandroid . widget . Array Adapter Ċ import Ġinfo . mqtt . android . ext sample . R Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . widget . ImageView Ċ import Ġandroid . widget . TextView Ċ import Ġinfo . mqtt . android . ext sample . activity . Connection Ċ import Ġinfo . mqtt . android . ext sample . model . Subscription Ċ Ċ class ĠSubscription ListItem Adapter ( context : ĠContext , Ġprivate Ġval Ġconnection : ĠConnection ) Ġ: ĊĠĠĠ ĠArray Adapter < Subscription >( context , ĠR . layout . subscription _ list _ item , Ġconnection . get Subscriptions (). to Mutable List ()) Ġ{ ĊĊĠĠĠ Ġfun Ġrefresh () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . clear () ĊĠĠĠĠĠĠĠ Ġthis . addAll ( connection . get Subscriptions (). to Mutable List ()) ĊĠĠĠĠĠĠĠ Ġsuper . notify DataSet Changed () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress Lint (" ViewHolder ") ĊĠĠĠ Ġoverride Ġfun Ġget View ( position : ĠInt , ĠconvertView : ĠView ?, Ġparent : ĠViewGroup ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinflater Ġ= Ġcontext . getSystem Service ( Context . LAYOUT _ IN FL ATER _ SERVICE ) Ġas ĠLayoutInflater ĊĠĠĠĠĠĠĠ Ġval Ġrow View Ġ= Ġinflater . inflate ( R . layout . subscription _ list _ item , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġval Ġtopic TextView Ġ= Ġrow View . findViewById < TextView >( R . id . message _ text ) ĊĠĠĠĠĠĠĠ Ġval Ġtopic Delete Button Ġ= Ġrow View . findViewById < ImageView >( R . id . topic _ delete _ image ) ĊĠĠĠĠĠĠĠ Ġval Ġq os TextView Ġ= Ġrow View . findViewById < TextView >( R . id . qos _ label ) ĊĠĠĠĠĠĠĠ Ġtopic TextView . text Ġ= Ġconnection . get Subscriptions ()[ position ]. topic ĊĠĠĠĠĠĠĠ Ġval Ġq os String Ġ= Ġcontext . getString ( R . string . qos _ text , Ġconnection . get Subscriptions ()[ position ]. qos ) ĊĠĠĠĠĠĠĠ Ġq os TextView . text Ġ= Ġq os String ĊĠĠĠĠĠĠĠ Ġval Ġnotify TextView Ġ= Ġrow View . findViewById < TextView >( R . id . show _ notifications _ label ) ĊĠĠĠĠĠĠĠ Ġval Ġnotify String Ġ= Ġcontext . getString ( R . string . notify _ text , Ġconnection . get Subscriptions ()[ position ]. is Enable Notifications . toString ()) ĊĠĠĠĠĠĠĠ Ġnotify TextView . text Ġ= Ġnotify String ĊĠĠĠĠĠĠĠ Ġtopic Delete Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconnection . unsubscribe ( connection . get Subscriptions ()[ position ]) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrefresh () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġrow View ĊĠĠĠ Ġ} Ċ Ċ } Ċ