package Ġcom . ek o app . ek os dk . u ikit . community . news feed . fragment Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . util . Log Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . fragment . app . activity ViewModels Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcom . bump tech . glide . G lide Ċ import Ġcom . ek o app . ek os dk . community . E ko Community Ċ import Ġcom . ek o app . ek os dk . file . E ko Image Ċ import Ġcom . ek o app . ek os dk . u ikit . base . E ko Base Fragment Ċ import Ġcom . ek o app . ek os dk . u ikit . community . R Ċ import Ġcom . ek o app . ek os dk . u ikit . community . databinding . Am ity Fragment Post Target Selection Binding Ċ import Ġcom . ek o app . ek os dk . u ikit . community . news feed . activity . E ko Create Post Activity Ċ import Ġcom . ek o app . ek os dk . u ikit . community . news feed . adapter . E ko Create Post Community Selection Adapter Ċ import Ġcom . ek o app . ek os dk . u ikit . community . news feed . listener . IC reate Post Community Selection Listener Ċ import Ġcom . ek o app . ek os dk . u ikit . community . news feed . view model . E ko Create Post Role Selection ViewModel Ċ import Ġcom . ek o app . ek os dk . u ikit . utils . E ko RecyclerView Item Decoration Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ import Ġkotlinx . android . synt hetic . main . am ity _ fragment _ post _ target _ selection .* Ċ Ċ class ĠE ko Post Target Selection Fragment Ġinternal Ġconstructor () Ġ: ĠE ko Base Fragment (), ĊĠĠĠ ĠI Create Post Community Selection Listener Ġ{ ĊĠĠĠ Ġprivate Ġval Ġm ViewModel : ĠE ko Create Post Role Selection ViewModel Ġby Ġactivity ViewModels () ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Adapter : ĠE ko Create Post Community Selection Adapter ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Binding : ĠAm ity Fragment Post Target Selection Binding ĊĠĠĠ Ġprivate Ġval ĠTAG Ġ= ĠE ko Post Target Selection Fragment :: class . java . canonical Name ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġm Binding Ġ= ĠData Binding Util . inflate ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinflater , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . layout . am ity _ fragment _ post _ target _ selection , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontainer , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfalse ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġm Binding . viewModel Ġ= Ġm ViewModel ĊĠĠĠĠĠĠĠ Ġreturn Ġm Binding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġinit RecyclerView () ĊĠĠĠĠĠĠĠ Ġinit Profile Image () ĊĠĠĠĠĠĠĠ Ġcl My Timeline . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate To Create Post ( null ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Profile Image () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= Ġm ViewModel . getUser () ĊĠĠĠĠĠĠĠ Ġval Ġimage URL Ġ= Ġuser . get Avatar ()?. getUrl ( E ko Image . Size . SMALL ) ĊĠĠĠĠĠĠĠ ĠG lide . with ( this ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. load ( image URL ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. placeholder ( R . drawable . am ity _ ic _ default _ profile _ large ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. center Crop () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. into ( av Profile ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit RecyclerView () Ġ{ ĊĠĠĠĠĠĠĠ Ġm Adapter Ġ= ĠE ko Create Post Community Selection Adapter ( this ) ĊĠĠĠĠĠĠĠ Ġrv Community . layout Manager Ġ= ĠLinearLayoutManager ( require Context ()) ĊĠĠĠĠĠĠĠ Ġrv Community . adapter Ġ= Ġm Adapter ĊĠĠĠĠĠĠĠ Ġrv Community . addItem Decoration ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE ko RecyclerView Item Decoration ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresources . get Dimension Pixel Size ( R . dim en . am ity _ padding _ xs ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ 0 , Ġresources . get Dimension Pixel Size ( R . dim en . am ity _ padding _ xs ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġrv Community . has Fixed Size () ĊĠĠĠĠĠĠĠ Ġm ViewModel . get Community List (). subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. do On Next Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm Adapter . submit List ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġhandle Community Section Visibility () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}. do OnError Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . e ( TAG , Ġ" init RecyclerView : Ġ${ it . localized Message }") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}. subscribe () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġhandle Community Section Visibility () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommunity Section Visibility Ġ= Ġif Ġ( m Adapter . item Count Ġ> Ġ 0 ) ĠView . VISIBLE Ġelse ĠView . GONE ĊĠĠĠĠĠĠĠ Ġm Binding . separator . visibility Ġ= Ġcommunity Section Visibility ĊĠĠĠĠĠĠĠ Ġm Binding . tv Community Label . visibility Ġ= Ġcommunity Section Visibility ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun ĠonClick Community ( community : ĠE ko Community , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigate To Create Post ( community ) ĊĠĠĠĠĠĠĠ Ġ// ĠE ko Community Navigation . navigate To Create Post ( require Context (), Ġcommunity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To Create Post ( community : ĠE ko Community ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcreate Post Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġregister For Activity Result ( E ko Create Post Activity . E ko Create Community Post Activity Contract ()) Ġ{ Ġdata Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġactivity ?. finish () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġcreate Post . launch ( community ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠBuilder () Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġbuild ( activity : ĠAppCompatActivity ): ĠE ko Post Target Selection Fragment Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠE ko Post Target Selection Fragment () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }