package Ġcom . el ig ust ilo software . the bag of holding . ui . character Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . el ig ust ilo software . the bag of holding . Character Information Ċ import Ġcom . el ig ust ilo software . the bag of holding . R ĊĊ Ċ class ĠCharacter Creation Fragment Ġ: ĠFragment () Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcharacter Creation ViewModel Ġ: ĠCharacter Creation ViewModel ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcharacter Creation RecyclerView : ĠRecyclerView ĊĠĠĠ Ġprivate Ġval Ġfragment Ġ= Ġthis ĊĠĠĠ Ġprivate Ġvar Ġcharacter Creation Recycler Adapter : ĠCharacter Creation Recycler Adapter ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġcharacter Creation Recycler Character Array Ġ= ĠArrayList < Character Information >() ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġroot Ġ= Ġinflater . inflate ( R . layout . fragment _ character _ creation , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġcharacter Creation RecyclerView Ġ= Ġroot . findViewById ( R . id . character _ creation _ recyclerview ) ĊĊĠĠĠĠĠĠĠ Ġ// toolbar ĊĠĠĠĠĠĠĠ Ġ( activity Ġas ĠAppCompatActivity ?) !!. support ActionBar ?. custom View ?. findViewById < TextView >( R . id . toolbar _ title _ text view )?. text Ġ= ĠgetString ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . string . toolbar _ title _ character _ selection ) ĊĊĊĠĠĠĠĠĠĠ Ġ// ViewModel Ġand ĠRecyclerView Adapter ĊĠĠĠĠĠĠĠ Ġcharacter Creation ViewModel Ġ= ĠViewModel Provider ( this ). get ( Character Creation ViewModel :: class . java ) ĊĠĠĠĠĠĠĠ Ġcharacter Creation ViewModel . character Data . observe ( view Lifecycle Owner , Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation Recycler Character Array Ġ= Ġit ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( character Creation Recycler Adapter Ġ== Ġnull ) Ġ{// create Ġit ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation RecyclerView . layout Manager Ġ= ĠLinearLayoutManager ( this . activity ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation Recycler Adapter Ġ= ĠCharacter Creation Recycler Adapter ( character Creation Recycler Character Array , Ġfragment ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation RecyclerView . adapter Ġ= Ġcharacter Creation Recycler Adapter ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation Recycler Adapter !!. notify DataSet Changed () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{// it Ġis Ġcreated Ġand Ġwe Ġneed Ġto Ġsync Ġdata . ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcharacter Creation Recycler Adapter !!. update Data ( character Creation Recycler Character Array ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġreturn Ġroot ĊĠĠĠ Ġ} Ċ } Ċ