package Ġcom . sa ifer wp . imgur gallery . ui . gallery Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . Switch Ċ import Ġcom . sa ifer wp . imgur gallery . App Ċ import Ġcom . sa ifer wp . imgur gallery . R Ċ Ċ class ĠGallery User Submitted Fragment Ġ: ĠGallery Fragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġswitch V iral : ĠSwitch ĊĊĠĠĠ Ġprivate Ġval Ġpreferences Manager Ġ= ĠApp . component . get Preferences Manager () ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinflater . inflate ( R . layout . gallery _ user _ submitted _ fragment , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġswitch V iral Ġ= Ġview . findViewById ( R . id . switch _ vir al ) ĊĊĠĠĠĠĠĠĠ Ġswitch V iral . isChecked Ġ= Ġpreferences Manager . getUser Submitted Show V iral () ĊĊĠĠĠĠĠĠĠ Ġswitch V iral . setOn Checked ChangeListener Ġ{ Ġ_, Ġis Checked Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpreferences Manager . setUser Submitted Show V iral ( isChecked ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . reload () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ